libdrmconf  0.10.4
A library to program DMR radios.
callsigndb.hh
1 #ifndef CALLSIGNDB_HH
2 #define CALLSIGNDB_HH
3 
4 #include "dfufile.hh"
5 
6 // Forward decl.
7 class UserDatabase;
8 
13 class CallsignDB : public DFUFile
14 {
15  Q_OBJECT
16 
17 public:
20  class Selection {
21  public:
23  Selection(int64_t count=-1);
25  Selection(const Selection &other);
26 
28  bool hasCountLimit() const;
30  size_t countLimit() const;
32  void setCountLimit(size_t n);
34  void clearCountLimit();
35 
36  protected:
39  int64_t _count;
40  };
41 
42 protected:
44  explicit CallsignDB(QObject *parent=nullptr);
45 
46 public:
48  virtual ~CallsignDB();
49 
51  virtual bool encode(UserDatabase *db, const Selection &selection=Selection(),
52  const ErrorStack &err=ErrorStack()) = 0;
53 };
54 
55 #endif // CALLSIGNDB_HH
Controls the selection of callsigns from the UserDatabase to be encoded into the callsign db.
Definition: callsigndb.hh:20
int64_t _count
Specifies the maximum amount of callsigns to add.
Definition: callsigndb.hh:39
void setCountLimit(size_t n)
Sets the count limit.
Definition: callsigndb.cc:32
Selection(int64_t count=-1)
Constructor.
Definition: callsigndb.cc:7
bool hasCountLimit() const
Returns true if the selection has a limit on the number of callsigns to encode.
Definition: callsigndb.cc:20
void clearCountLimit()
Clears the count limit.
Definition: callsigndb.cc:37
size_t countLimit() const
Returns the limit of callsigns to encode.
Definition: callsigndb.cc:25
Abstract base class of all callsign database implementations.
Definition: callsigndb.hh:14
CallsignDB(QObject *parent=nullptr)
Hidden constructor.
Definition: callsigndb.cc:45
virtual bool encode(UserDatabase *db, const Selection &selection=Selection(), const ErrorStack &err=ErrorStack())=0
Encodes the given user db into the device specific callsign db.
virtual ~CallsignDB()
Destructor.
Definition: callsigndb.cc:51
A collection of images, each consisting of one or more memory sections.
Definition: dfufile.hh:73
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Auto-updating DMR user database.
Definition: userdatabase.hh:23