BPS C++ API  2.24.4
bpslicensetoken.h
Go to the documentation of this file.
1 
4 #ifndef BPSLICENSETOKEN_H
5 #define BPSLICENSETOKEN_H
6 
7 #include "bpscore_global.h"
8 #include <QDate>
9 #include <QObject>
10 #include <QMetaType>
11 
12 class BpsDatastore;
13 
25 {
26  Q_OBJECT
28 
29 public:
30 
42  BpsDatastore* aDatastore,
43  const QString& aLicenser,
44  const QString& aLicenseGroup,
45  const QString& aProgram,
46  const QVariant& aInfo,
47  QObject *aParent = nullptr);
48 
52  virtual ~BpsLicenseToken();
53 
57  bool isValid() const;
58 
67 
73  void update();
74 
78  void clear();
79 
83  QString licenser() const;
84 
89 
93  QString program() const;
94 
98  QVariant info() const;
99 
104 
111  virtual int checkLicense(QDate* aExpires = nullptr);
112 
113 protected:
114 
119  void setLicenseGroup(const QString& aLicenseGroup);
120 };
121 
122 Q_DECLARE_METATYPE(BpsLicenseToken*)
123 
124 #endif // BPSLICENSETOKEN_H
Public include file for BPS CORE library macros.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
BPS datastore class.
Definition: bpsdatastore.h:61
The license token is used to check permission of software usage, and maintains the list in table t_li...
Definition: bpslicensetoken.h:25
void clear()
Clears the token and releases the license for re-use.
BpsDatastore * datastore() const
void update()
Makes sure the token is still present and unmodified in table t_licensetokens, and updates the timest...
QString program() const
QVariant info() const
QString licenser() const
QString licenseGroup() const
BpsLicenseToken(BpsDatastore *aDatastore, const QString &aLicenser, const QString &aLicenseGroup, const QString &aProgram, const QVariant &aInfo, QObject *aParent=nullptr)
Create a new license token.
virtual int checkLicense(QDate *aExpires=nullptr)
This method can be overloaded to implement a check for license validity.
QDate validate()
Checks the license token.
bool isValid() const
void setLicenseGroup(const QString &aLicenseGroup)
Set a new license group.
virtual ~BpsLicenseToken()
The destructor clears the token and releases the license for re-use.