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 
18 namespace LicenseSpring
19 {
22  {
23  public:
24  using ptr_t = std::shared_ptr<UserLicense>;
25 
27  UserLicense();
28 
31  bool isActive() const;
32 
35  bool isEnabled() const;
36 
39  bool isTrial() const;
40 
43  bool isUnlimitedActivationsAllowed() const;
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 
122  LicenseType licenseType() const;
123 
126  Customer owner() const;
127 
130  ProductDetails productDetails() const;
131 
134  std::vector<CustomField> customFields() const;
135 
138  std::vector<LicenseFeature> features() const;
139 
142  tm validityPeriod() const;
143 
146  tm maintenancePeriod() const;
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
std::shared_ptr< UserLicense > ptr_t
Definition: UserLicense.h:24
Class used for encapsulating the type of license, comparing types of licenses, and converting them to...
Definition: LicenseType.h:18
Class that encapsulates information about a customer.
Definition: Customer.h:17
Contains information about a user-based license for a given user.
Definition: UserLicense.h:21
#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 product.