LicenseSpring C++ SDK
Easily add Software Licensing to your application
Loading...
Searching...
No Matches
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 {
23 public:
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
84 int32_t transferLimit() const;
85
88 uint32_t maxOverages() const;
89
92 uint32_t floatingTimeout() const;
93
97 uint32_t maxBorrowTime() const;
98
101 uint32_t gracePeriod() const;
102
105 uint64_t serverId() const;
106
109 const std::string& orderStoreId() const;
110
114 const std::string& startDate() const;
115
118 const std::string& metadata() const;
119
123
127
131
134 std::vector<CustomField> customFields() const;
135
138 std::vector<LicenseFeature> features() const;
139
142 tm validityPeriod() const;
143
147
150 static UserLicense fromJsonString( const std::string& jsonString );
151
152 private:
153 bool m_isActive;
154 bool m_isEnabled;
155 bool m_isTrial;
156 bool m_allowUnlimitedActivations;
157 bool m_allowOverages;
158 bool m_isFloating; // cloud
159 bool m_isOfflineFloating;
160 bool m_preventVM;
161 bool m_isHardwareKeyAuth;
162 bool m_isAirGapped;
163 uint32_t m_maxLicenseUsers;
164 int32_t m_maxActivations;
165 uint32_t m_timesActivated;
166 uint32_t m_transferCount;
167 int32_t m_transferLimit;
168 uint32_t m_maxOverages;
169 uint32_t m_floatingTimeout;
170 uint32_t m_maxBorrowTime;
171 uint32_t m_gracePeriod;
172 uint64_t m_serverId;
173 std::string m_orderStoreId;
174 std::string m_startDate;
175 std::string m_metadata;
176 tm m_validityPeriod;
177 tm m_maintenancePeriod;
178
179 LicenseType m_licenseType;
180 Customer m_customer;
181 ProductDetails m_productDetails;
182 std::vector<CustomField> m_customFields;
183 std::vector<LicenseFeature> m_features;
184 };
185}
186
187#ifdef _MSC_VER
188#pragma warning( pop )
189#endif
190
191#endif //LS_USER_LICENSE_H
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition APIDef.h:22
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:19
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.