LicenseSpring C++ SDK 7.31.0
Easily add Software Licensing to your application
Loading...
Searching...
No Matches
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.
 
 LicenseFeature (const std::string &code, const std::string &name, LSFeatureType type)
 Constructs license feature with given code, name and type.
 
 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)
 Constructs license feature with all of provided info.
 
const std::string & code () const
 Getter method for license feature code.
 
const std::string & name () const
 Getter method for license feature name.
 
LSFeatureType featureType () const
 Getter method for license feature type.
 
int32_t maxConsumption () const
 Getter method for license feature maximum consumption.
 
int32_t totalConsumption () const
 Getter method for license feature current total consumption.
 
int32_t localConsumption () const
 Getter method for license feature local consumption.
 
int32_t maxOverages () const
 Returns maximum overage allowed for the license feature.
 
bool isOveragesAllowed () const
 Checks if overage is allowed for Consumption license feature.
 
ConsumptionPeriod consumptionPeriod () const
 Returns period of time after which consumption is reset.
 
bool isResetConsumptionEnabled () const
 Checks if consumption reset is allowed for Consumption license feature.
 
bool isUnlimitedConsumptionAllowed () const
 Checks if unlimited consumption is allowed for Consumption license feature.
 
tm expiryDate () const
 Getter method for license feature expiry date.
 
tm expiryDateUtc () const
 Getter method for license feature expiry date in UTC.
 
const std::string & metadata () const
 Getter method for license feature metadata.
 
bool isExpired () const
 Checks if license feature expired.
 
bool isFloating () const
 Checks if feature is a floating feature.
 
bool isOfflineFloating () const
 Checks if feature is and offline server floating feature.
 
int32_t floatingTimeout () const
 Getter for floating license timeout.
 
int32_t floatingUsers () const
 Getter for maximum number of simultaneous users for this feature.
 
int32_t floatingInUseCount () const
 Getter for current number of simultaneous users using this feature.
 
tm floatingEndDateTime () const
 Getter method for floating license feature expiry date.
 
tm floatingEndDateTimeUtc () const
 Getter method for license feature expiry date in UTC.
 
bool floatingIsExpired () const
 Checks if floating license feature expired.
 
std::string toString () const
 Helper method, compose license feature info into string.
 

Static Public Member Functions

static LSFeatureType FeatureTypeFromString (const std::string &value)
 Helper method, converts string to LSFeatureType.
 
static std::string FeatureTypeToString (LSFeatureType value)
 Helper method, converts LSFeatureType to string.
 

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,
bool  isFloating,
bool  isOfflineFloating,
int32_t  floatingTimeout,
int32_t  floatingUsers,
int32_t  floatingInUseCount,
const tm floatingStartDateTime,
const tm floatingEndDateTime 
)

Constructs license feature with all of provided info.

Parameters
codeThe product feature code
nameThe name of the product if feature is a floating feature.eature 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
isFloatingIs license feature a floating feature
isOfflineFloatingIs license feature an offline server floating feature
floatingTimeoutTime in minutes after which the feature will automatically release if it's not registered
floatingUsersMaximum number of simultaneous users for this feature
floatingInUseCountCurrent number of simultaneous users using this feature
floatingStartDateTimeThe date when the floating feature was registered
floatingEndDateTimeThe date when the floating feature is automatically released

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.

◆ isFloating()

bool LicenseSpring::LicenseFeature::isFloating ( ) const

Checks if feature is a floating feature.

Returns
True if feature is a floating feature and false otherwise.

◆ isOfflineFloating()

bool LicenseSpring::LicenseFeature::isOfflineFloating ( ) const

Checks if feature is and offline server floating feature.

Returns
True if feature is a offline server floating feature and false otherwise.

◆ floatingTimeout()

int32_t LicenseSpring::LicenseFeature::floatingTimeout ( ) const

Getter for floating license timeout.

Returns
Time in minutes after which the feature will automatically release if it's not registered

◆ floatingUsers()

int32_t LicenseSpring::LicenseFeature::floatingUsers ( ) const

Getter for maximum number of simultaneous users for this feature.

Returns
Maximum number of simultaneous users for this feature

◆ floatingInUseCount()

int32_t LicenseSpring::LicenseFeature::floatingInUseCount ( ) const

Getter for current number of simultaneous users using this feature.

Returns
Current number of simultaneous users using this feature

◆ floatingEndDateTime()

tm LicenseSpring::LicenseFeature::floatingEndDateTime ( ) const

Getter method for floating license feature expiry date.

If license feature is not registered, returns some previous point in time.
Otherwise, returns the time after which the floating feature is released.
Meaningful only for floating features.

Returns
Floating license feature expiry date.

◆ floatingEndDateTimeUtc()

tm LicenseSpring::LicenseFeature::floatingEndDateTimeUtc ( ) const

Getter method for license feature expiry date in UTC.

Returns the same as floatingExpiryDate, but date time converted to UTC.
Meaningful only for floating features.

Returns
Floating license feature expiry date in UTC.

◆ floatingIsExpired()

bool LicenseSpring::LicenseFeature::floatingIsExpired ( ) const

Checks if floating license feature expired.

Meaningful only for floating features.

Returns
True if floating 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: