LicenseSpring C++ SDK
Easily add Software Licensing to your application
UserLicense.h
Go to the documentation of this file.
1#ifndef LS_USER_LICENSE_H
2#define LS_USER_LICENSE_H
3
4#ifdef _MSC_VER
5#pragma once
6#pragma warning(push)
7#pragma warning(disable : 4251)
8#endif
9
10#include <memory>
11#include "CustomField.h"
12#include "Customer.h"
13#include "LicenseType.h"
14#include "ProductDetails.h"
15#include "LicenseFeature.h"
16#include "APIDef.h"
17
18namespace LicenseSpring
19{
22{
23public:
24 using ptr_t = std::shared_ptr<UserLicense>;
25
28
31 bool isActive() const;
32
35 bool isEnabled() const;
36
39 bool isTrial() const;
40
44
47 bool isOveragesAllowed() const;
48
51 bool isFloating() const;
52
56 bool isVMAllowed() const;
57
60 bool isHardwareKeyAuth() const;
61
64 bool isAirGapped() const;
65
68 uint32_t maxLicenseUsers() const;
69
72 int32_t maxActivations() const;
73
76 uint32_t timesActivated() const;
77
80 uint32_t transferCount() const;
81
85 int32_t transferLimit() const;
86
90 uint32_t maxOverages() const;
91
94 uint32_t floatingTimeout() const;
95
99 uint32_t maxBorrowTime() const;
100
103 uint32_t gracePeriod() const;
104
108 uint64_t serverId() const;
109
112 const std::string &orderStoreId() const;
113
118 const std::string &startDate() const;
119
122 const std::string &metadata() const;
123
127
132
136
139 std::vector<CustomField> customFields() const;
140
143 std::vector<LicenseFeature> features() const;
144
147 tm validityPeriod() const;
148
152
155 static UserLicense fromJsonString(const std::string &jsonString);
156
157private:
158 bool m_isActive;
159 bool m_isEnabled;
160 bool m_isTrial;
161 bool m_allowUnlimitedActivations;
162 bool m_allowOverages;
163 bool m_isFloating; // cloud
164 bool m_isOfflineFloating;
165 bool m_preventVM;
166 bool m_isHardwareKeyAuth;
167 bool m_isAirGapped;
168 uint32_t m_maxLicenseUsers;
169 int32_t m_maxActivations;
170 uint32_t m_timesActivated;
171 uint32_t m_transferCount;
172 int32_t m_transferLimit;
173 uint32_t m_maxOverages;
174 uint32_t m_floatingTimeout;
175 uint32_t m_maxBorrowTime;
176 uint32_t m_gracePeriod;
177 uint64_t m_serverId;
178 std::string m_orderStoreId;
179 std::string m_startDate;
180 std::string m_metadata;
181 tm m_validityPeriod;
182 tm m_maintenancePeriod;
183
184 LicenseType m_licenseType;
185 Customer m_customer;
186 ProductDetails m_productDetails;
187 std::vector<CustomField> m_customFields;
188 std::vector<LicenseFeature> m_features;
189};
190} // namespace LicenseSpring
191
192#ifdef _MSC_VER
193#pragma warning(pop)
194#endif
195
196#endif // LS_USER_LICENSE_H
#define LS_API
Definition: APIDef.h:23
Class that encapsulates information about a customer.
Definition: Customer.h:18
Class used for encapsulating the type of license, comparing types of licenses, and converting them to...
Definition: LicenseType.h:20
Class that encapsulates information about a product.
Contains information about a user-based license for a given user.
Definition: UserLicense.h:22
Customer owner() const
License owner.
bool isHardwareKeyAuth() const
Checker for whether the license works only with a hardware key dongle.
uint32_t gracePeriod() const
Grace period in hours.
uint32_t maxOverages() const
Maximum overage allowed for the license.
uint64_t serverId() const
Server-side license id, used for distinguishing user-based licenses of the same product.
int32_t maxActivations() const
How many times license can be activated.
bool isActive() const
Checker for if the license is active.
bool isFloating() const
Checker for whether the license is floating or not.
tm validityPeriod() const
License validity period in UTC.
uint32_t transferCount() const
How many times license has been transferred between devices.
tm maintenancePeriod() const
Maintenance period in UTC.
LicenseType licenseType() const
License type.
bool isUnlimitedActivationsAllowed() const
Checker if license allows unlimited activations.
bool isTrial() const
Checker for if the license is a trial.
std::shared_ptr< UserLicense > ptr_t
Definition: UserLicense.h:24
ProductDetails productDetails() const
Product details.
std::vector< LicenseFeature > features() const
List of license features associated with the license.
bool isVMAllowed() const
Checker for whether the license is allowed to work under virtual machine or not.
uint32_t maxBorrowTime() const
Maximum borrowing period in hours.
static UserLicense fromJsonString(const std::string &jsonString)
Helper method, creates UserLicense object from JSON string.
bool isOveragesAllowed() const
Checker if overage is allowed for Consumption license.
const std::string & orderStoreId() const
order store id of the license.
const std::string & metadata() const
License metadata.
int32_t transferLimit() const
Maximum number of allowed license transfers between devices.
bool isAirGapped() const
Checker for if the license is air gapped.
bool isEnabled() const
Checker for if the license is enabled.
const std::string & startDate() const
License start date.
std::vector< CustomField > customFields() const
List of custom fields associated with the license.
UserLicense()
Default constructor, creates empty user license object.
uint32_t maxLicenseUsers() const
Maximum number of users that can be assigned to a license.
uint32_t timesActivated() const
How many times license already been activated.
uint32_t floatingTimeout() const
Timeout of the floating license in minutes.