LicenseSpring C++ SDK 7.27.0
Easily add Software Licensing to your application
LicenseSpring::LicenseFeature Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ LicenseFeature() [1/3]

LicenseSpring::LicenseFeature::LicenseFeature ( )

Constructs invalid license feature with no information.

◆ LicenseFeature() [2/3]

LicenseSpring::LicenseFeature::LicenseFeature ( const std::string &  code,
const std::string &  name,
LSFeatureType  type 
)

Constructs license feature with given code, name and type.

Parameters
codeThe product feature code
nameThe name of the product feature on this license
typeEither FeatureTypeNone, FeatureTypeActivation, or FeatureTypeConsumption

◆ LicenseFeature() [3/3]

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.

Parameters
codeThe product feature code
nameThe name of the product feature on this license
typeEither FeatureTypeNone, FeatureTypeActivation, or FeatureTypeConsumption
maxConsumptionThe total amount of consumption allowed for this feature
totalConsumptionThe current amount of consumption used for this feature
localConsumptionThe current local consumption specific to this device
expiryDateThe expiration date for the product feature on this license
allowOveragesIs overage allowed for this license feature
maxOveragesMaximum number of overages
resetConsumptionIs consuption reset is enabled for this license feature
allowUnlimitedConsumptionsIs unlimited consumption is enabled for this license feature
consumptionPeriodThe period of consumption reset
metadataThe product feature metadata

Member Function Documentation

◆ code()

const std::string & LicenseSpring::LicenseFeature::code ( ) const

Getter method for license feature code.

Returns
License feature code.

◆ name()

const std::string & LicenseSpring::LicenseFeature::name ( ) const

Getter method for license feature name.

Returns
License feature name.

◆ featureType()

LSFeatureType LicenseSpring::LicenseFeature::featureType ( ) const

Getter method for license feature type.

Returns
License feature name.

◆ maxConsumption()

int32_t LicenseSpring::LicenseFeature::maxConsumption ( ) const

Getter method for license feature maximum consumption.

Meaningful only for consumption feature type.

Returns
License feature maximum consumption.

◆ totalConsumption()

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.

Returns
License feature total consumption + local consumption.

◆ localConsumption()

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.

Returns
License feature local consumption.

◆ maxOverages()

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.

◆ isOveragesAllowed()

bool LicenseSpring::LicenseFeature::isOveragesAllowed ( ) const

Checks if overage is allowed for Consumption license feature.

Meaningful only for Consumption feature type.

◆ consumptionPeriod()

ConsumptionPeriod LicenseSpring::LicenseFeature::consumptionPeriod ( ) const

Returns period of time after which consumption is reset.

Meaningful only for Consumption feature type.

◆ isResetConsumptionEnabled()

bool LicenseSpring::LicenseFeature::isResetConsumptionEnabled ( ) const

Checks if consumption reset is allowed for Consumption license feature.

Meaningful only for Consumption feature type.

◆ isUnlimitedConsumptionAllowed()

bool LicenseSpring::LicenseFeature::isUnlimitedConsumptionAllowed ( ) const

Checks if unlimited consumption is allowed for Consumption license feature.

Meaningful only for Consumption feature type.

◆ expiryDate()

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.

Returns
License feature expiry date.

◆ expiryDateUtc()

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.

Returns
License feature expiry date in UTC.

◆ metadata()

const std::string & LicenseSpring::LicenseFeature::metadata ( ) const

Getter method for license feature metadata.

Returns
License feature metadata.

◆ isExpired()

bool LicenseSpring::LicenseFeature::isExpired ( ) const

Checks if license feature expired.

Returns
True if feature expired and false otherwise.

◆ FeatureTypeFromString()

static LSFeatureType LicenseSpring::LicenseFeature::FeatureTypeFromString ( const std::string &  value)
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.

Parameters
valueString to convert.
Returns
LSFeatureType.

◆ FeatureTypeToString()

static std::string LicenseSpring::LicenseFeature::FeatureTypeToString ( LSFeatureType  value)
static

Helper method, converts LSFeatureType to string.

String-value pairs same as FeatureTypeFromString().
FeatureTypeNone returns an empty string.

Parameters
valueLSFeatureType to convert
Returns
string representation of LSFeatureType.

◆ toString()

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.

Returns
String with info on license feature.

The documentation for this class was generated from the following file: