DDraceNetwork Docs
favorites.h
Go to the documentation of this file.
1#ifndef ENGINE_FAVORITES_H
2#define ENGINE_FAVORITES_H
3
4#include <memory>
5
6#include <base/types.h>
8
9#include "kernel.h"
10
11class IConfigManager;
12
13class IFavorites : public IInterface
14{
15 MACRO_INTERFACE("favorites")
16
17protected:
18 virtual void OnConfigSave(IConfigManager *pConfigManager) = 0;
19
20public:
21 class CEntry
22 {
23 public:
27 };
28
29 virtual ~IFavorites() {}
30
31 virtual TRISTATE IsFavorite(const NETADDR *pAddrs, int NumAddrs) const = 0;
32 // Only considers the addresses that are actually favorites.
33 virtual TRISTATE IsPingAllowed(const NETADDR *pAddrs, int NumAddrs) const = 0;
34 virtual void Add(const NETADDR *pAddrs, int NumAddrs) = 0;
35 // Only considers the addresses that are actually favorites.
36 virtual void AllowPing(const NETADDR *pAddrs, int NumAddrs, bool AllowPing) = 0;
37 virtual void Remove(const NETADDR *pAddrs, int NumAddrs) = 0;
38 virtual void AllEntries(const CEntry **ppEntries, int *pNumEntries) = 0;
39
40 // Pass the `IFavorites` instance as callback.
41 static void ConfigSaveCallback(IConfigManager *pConfigManager, void *pUserData);
42};
43
44std::unique_ptr<IFavorites> CreateFavorites();
45#endif // ENGINE_FAVORITES_H
Definition: config.h:9
Definition: favorites.h:22
bool m_AllowPing
Definition: favorites.h:26
int m_NumAddrs
Definition: favorites.h:24
Definition: favorites.h:14
virtual void Add(const NETADDR *pAddrs, int NumAddrs)=0
static void ConfigSaveCallback(IConfigManager *pConfigManager, void *pUserData)
Definition: favorites.cpp:257
virtual void AllowPing(const NETADDR *pAddrs, int NumAddrs, bool AllowPing)=0
virtual ~IFavorites()
Definition: favorites.h:29
virtual TRISTATE IsPingAllowed(const NETADDR *pAddrs, int NumAddrs) const =0
virtual void AllEntries(const CEntry **ppEntries, int *pNumEntries)=0
virtual void OnConfigSave(IConfigManager *pConfigManager)=0
virtual void Remove(const NETADDR *pAddrs, int NumAddrs)=0
virtual TRISTATE IsFavorite(const NETADDR *pAddrs, int NumAddrs) const =0
Definition: kernel.h:10
@ MAX_SERVER_ADDRESSES
Definition: protocol.h:86
std::unique_ptr< IFavorites > CreateFavorites()
Definition: favorites.cpp:262
#define MACRO_INTERFACE(Name)
Definition: kernel.h:25
Definition: types.h:67
TRISTATE
Definition: types.h:7