![]() |
LicenseSpring C++ SDK 7.27.0
Easily add Software Licensing to your application
|
Class that encapsulates information about license feature. More...
#include <LicenseSpring/LicenseFeature.h>
Public Member Functions | |
LicenseFeature () | |
Constructs invalid license feature with no information. More... | |
LicenseFeature (const std::string &code, const std::string &name, LSFeatureType type) | |
Constructs license feature with given code, name and type. More... | |
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) | |
Constructs license feature with all of provided info. More... | |
const std::string & | code () const |
Getter method for license feature code. More... | |
const std::string & | name () const |
Getter method for license feature name. More... | |
LSFeatureType | featureType () const |
Getter method for license feature type. More... | |
int32_t | maxConsumption () const |
Getter method for license feature maximum consumption. More... | |
int32_t | totalConsumption () const |
Getter method for license feature current total consumption. More... | |
int32_t | localConsumption () const |
Getter method for license feature local consumption. More... | |
int32_t | maxOverages () const |
Returns maximum overage allowed for the license feature. More... | |
bool | isOveragesAllowed () const |
Checks if overage is allowed for Consumption license feature. More... | |
ConsumptionPeriod | consumptionPeriod () const |
Returns period of time after which consumption is reset. More... | |
bool | isResetConsumptionEnabled () const |
Checks if consumption reset is allowed for Consumption license feature. More... | |
bool | isUnlimitedConsumptionAllowed () const |
Checks if unlimited consumption is allowed for Consumption license feature. More... | |
tm | expiryDate () const |
Getter method for license feature expiry date. More... | |
tm | expiryDateUtc () const |
Getter method for license feature expiry date in UTC. More... | |
const std::string & | metadata () const |
Getter method for license feature metadata. More... | |
bool | isExpired () const |
Checks if license feature expired. More... | |
std::string | toString () const |
Helper method, compose license feature info into string. More... | |
Static Public Member Functions | |
static LSFeatureType | FeatureTypeFromString (const std::string &value) |
Helper method, converts string to LSFeatureType. More... | |
static std::string | FeatureTypeToString (LSFeatureType value) |
Helper method, converts LSFeatureType to string. More... | |
Class that encapsulates information about license feature.
Includes information for a license feature's typing, code, name, consumption values, and expiry dates.
Definition at line 20 of file LicenseFeature.h.
LicenseSpring::LicenseFeature::LicenseFeature | ( | ) |
Constructs invalid license feature with no information.
LicenseSpring::LicenseFeature::LicenseFeature | ( | const std::string & | code, |
const std::string & | name, | ||
LSFeatureType | type | ||
) |
Constructs license feature with given code, name and type.
code | The product feature code |
name | The name of the product feature on this license |
type | Either FeatureTypeNone, FeatureTypeActivation, or FeatureTypeConsumption |
LicenseSpring::LicenseFeature::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 | ||
) |
Constructs license feature with all of provided info.
code | The product feature code |
name | The name of the product feature on this license |
type | Either FeatureTypeNone, FeatureTypeActivation, or FeatureTypeConsumption |
maxConsumption | The total amount of consumption allowed for this feature |
totalConsumption | The current amount of consumption used for this feature |
localConsumption | The current local consumption specific to this device |
expiryDate | The expiration date for the product feature on this license |
allowOverages | Is overage allowed for this license feature |
maxOverages | Maximum number of overages |
resetConsumption | Is consuption reset is enabled for this license feature |
allowUnlimitedConsumptions | Is unlimited consumption is enabled for this license feature |
consumptionPeriod | The period of consumption reset |
metadata | The product feature metadata |
const std::string & LicenseSpring::LicenseFeature::code | ( | ) | const |
Getter method for license feature code.
const std::string & LicenseSpring::LicenseFeature::name | ( | ) | const |
Getter method for license feature name.
LSFeatureType LicenseSpring::LicenseFeature::featureType | ( | ) | const |
Getter method for license feature type.
int32_t LicenseSpring::LicenseFeature::maxConsumption | ( | ) | const |
Getter method for license feature maximum consumption.
Meaningful only for consumption feature type.
int32_t LicenseSpring::LicenseFeature::totalConsumption | ( | ) | const |
Getter method for license feature current total consumption.
Please note, it includes localConsumption. Meaningful only for consumption feature type.
int32_t LicenseSpring::LicenseFeature::localConsumption | ( | ) | const |
Getter method for license feature local consumption.
This is consumption that has not been synchronized with the backend yet.
Meaningful only for consumption feature type.
int32_t LicenseSpring::LicenseFeature::maxOverages | ( | ) | const |
Returns maximum overage allowed for the license feature.
Meaningful only for Consumption feature type, returns 0 in case of unlimited overages.
bool LicenseSpring::LicenseFeature::isOveragesAllowed | ( | ) | const |
Checks if overage is allowed for Consumption license feature.
Meaningful only for Consumption feature type.
ConsumptionPeriod LicenseSpring::LicenseFeature::consumptionPeriod | ( | ) | const |
Returns period of time after which consumption is reset.
Meaningful only for Consumption feature type.
bool LicenseSpring::LicenseFeature::isResetConsumptionEnabled | ( | ) | const |
Checks if consumption reset is allowed for Consumption license feature.
Meaningful only for Consumption feature type.
bool LicenseSpring::LicenseFeature::isUnlimitedConsumptionAllowed | ( | ) | const |
Checks if unlimited consumption is allowed for Consumption license feature.
Meaningful only for Consumption feature type.
tm LicenseSpring::LicenseFeature::expiryDate | ( | ) | const |
Getter method for license feature expiry date.
If expiry date has not been set this method returns maximum date (31.12.9999).
In this case it means that feature is perpetual and cannot expire.
tm LicenseSpring::LicenseFeature::expiryDateUtc | ( | ) | const |
Getter method for license feature expiry date in UTC.
Returns the same as expiryDate, but date time converted to UTC.
const std::string & LicenseSpring::LicenseFeature::metadata | ( | ) | const |
Getter method for license feature metadata.
bool LicenseSpring::LicenseFeature::isExpired | ( | ) | const |
Checks if license feature expired.
|
static |
Helper method, converts string to LSFeatureType.
If value == 'activation', returns FeatureTypeActivation.
If value == 'consumption', returns FeatureTypeConsumption, otherwise returns FeatureTypeNone.
Must be written as above, i.e. all lowercase.
value | String to convert. |
|
static |
Helper method, converts LSFeatureType to string.
String-value pairs same as FeatureTypeFromString().
FeatureTypeNone returns an empty string.
value | LSFeatureType to convert |
std::string LicenseSpring::LicenseFeature::toString | ( | ) | const |
Helper method, compose license feature info into string.
This is helper method, you should not rely on its output.