LicenseSpring C++ SDK
Easily add Software Licensing to your application
LicenseFeature.h
Go to the documentation of this file.
1#ifndef LS_LICENSE_FEATURE_H
2#define LS_LICENSE_FEATURE_H
3
4#ifdef _MSC_VER
5#pragma once
6#pragma warning(push)
7#pragma warning(disable : 4251)
8#endif
9
10#include <string>
11#include <ctime>
12#include "PODTypes.h"
13#include "APIDef.h"
14#include "ConsumptionPeriod.h"
15
16namespace LicenseSpring
17{
22{
23public:
26
31 LicenseFeature(const std::string &code, const std::string &name, LSFeatureType type);
32
56 LicenseFeature(const std::string &code, const std::string &name, LSFeatureType type,
57 int32_t maxConsumption, int32_t totalConsumption, int32_t localConsumption,
58 const tm &expiryDate, bool allowOverages, int32_t maxOverages, bool resetConsumption,
59 bool allowUnlimitedConsumptions, ConsumptionPeriod consumptionPeriod,
60 const std::string &metadata, bool isFloating, bool isOfflineFloating,
61 int32_t floatingTimeout, int32_t floatingUsers, int32_t floatingInUseCount,
62 const tm &floatingStartDateTime, const tm &floatingEndDateTime,
63 bool allowNegativeConsumptions = true);
64
67 const std::string &code() const;
68
71 const std::string &name() const;
72
76
80 int32_t maxConsumption() const;
81
86 int32_t totalConsumption() const;
87
92 int32_t localConsumption() const;
93
97 int32_t maxOverages() const;
98
101 bool isOveragesAllowed() const;
102
106
110
114
118
123 tm expiryDate() const;
124
128 tm expiryDateUtc() const;
129
132 const std::string &metadata() const;
133
136 bool isExpired() const;
137
140 bool isFloating() const;
141
144 bool isOfflineFloating() const;
145
149 int32_t floatingTimeout() const;
150
153 int32_t floatingUsers() const;
154
157 int32_t floatingInUseCount() const;
158
165
171
175 bool floatingIsExpired() const;
176
183 static LSFeatureType FeatureTypeFromString(const std::string &value);
184
190 static std::string FeatureTypeToString(LSFeatureType value);
191
195 std::string toString() const;
196
197private:
198 std::string m_code;
199 std::string m_name;
200 LSFeatureType m_featureType;
201 int32_t m_maxConsumption;
202 int32_t m_totalConsumption;
203 int32_t m_localConsumption;
204 int32_t m_maxOverages;
205 bool m_allowOverages;
206 bool m_allowUnlimitedConsumptions;
207 bool m_allowNegativeConsumptions;
208 bool m_resetConsumption;
209 ConsumptionPeriod m_consumptionPeriod;
210 tm m_expiryDate;
211 std::string m_metadata;
212 bool m_isFloating;
213 bool m_isOfflineFloating;
214 int32_t m_floatingTimeout;
215 int32_t m_floatingUsers;
216 int32_t m_floatingInUseCount;
217 tm m_floatingStartDateTime;
218 tm m_floatingEndDateTime;
219};
220} // namespace LicenseSpring
221
222#ifdef _MSC_VER
223#pragma warning(pop)
224#endif
225
226#endif // LS_LICENSE_FEATURE_H
#define LS_API
Definition: APIDef.h:23
LSFeatureType
Product feature type.
Definition: PODTypes.h:18
Class used for encapsulating LSConsumptionPeriod and converting cosumption period to/from string.
Class that encapsulates information about license feature.
static std::string FeatureTypeToString(LSFeatureType value)
Helper method, converts LSFeatureType to string.
bool isUnlimitedConsumptionAllowed() const
Checks if unlimited consumption is allowed for Consumption license feature.
tm floatingEndDateTime() const
Getter method for floating license feature expiry date.
LicenseFeature()
Constructs invalid license feature with no information.
LSFeatureType featureType() const
Getter method for license feature type.
int32_t floatingInUseCount() const
Getter for current number of simultaneous users using this feature.
bool isOfflineFloating() const
Checks if feature is and offline server floating feature.
LicenseFeature(const std::string &code, const std::string &name, LSFeatureType type, int32_t maxConsumption, int32_t totalConsumption, int32_t localConsumption, const tm &expiryDate, bool allowOverages, int32_t maxOverages, bool resetConsumption, bool allowUnlimitedConsumptions, ConsumptionPeriod consumptionPeriod, const std::string &metadata, bool isFloating, bool isOfflineFloating, int32_t floatingTimeout, int32_t floatingUsers, int32_t floatingInUseCount, const tm &floatingStartDateTime, const tm &floatingEndDateTime, bool allowNegativeConsumptions=true)
Constructs license feature with all of provided info.
bool isNegativeConsumptionAllowed() const
Checks if negative consumption is allowed for Consumption license feature.
const std::string & name() const
Getter method for license feature name.
bool isExpired() const
Checks if license feature expired.
int32_t floatingTimeout() const
Getter for floating license timeout.
const std::string & metadata() const
Getter method for license feature metadata.
static LSFeatureType FeatureTypeFromString(const std::string &value)
Helper method, converts string to LSFeatureType.
bool isResetConsumptionEnabled() const
Checks if consumption reset is allowed for Consumption license feature.
bool isOveragesAllowed() const
Checks if overage is allowed for Consumption license feature.
std::string toString() const
Helper method, compose license feature info into string.
int32_t floatingUsers() const
Getter for maximum number of simultaneous users for this feature.
ConsumptionPeriod consumptionPeriod() const
Returns period of time after which consumption is reset.
bool floatingIsExpired() const
Checks if floating license feature expired.
LicenseFeature(const std::string &code, const std::string &name, LSFeatureType type)
Constructs license feature with given code, name and type.
int32_t totalConsumption() const
Getter method for license feature current total consumption.
bool isFloating() const
Checks if feature is a floating feature.
tm floatingEndDateTimeUtc() const
Getter method for license feature expiry date in UTC.
int32_t localConsumption() const
Getter method for license feature local consumption.
tm expiryDateUtc() const
Getter method for license feature expiry date in UTC.
int32_t maxOverages() const
Returns maximum overage allowed for the license feature.
int32_t maxConsumption() const
Getter method for license feature maximum consumption.
tm expiryDate() const
Getter method for license feature expiry date.
const std::string & code() const
Getter method for license feature code.