| LicenseSpring C++ SDK 7.32.0 Easily add Software Licensing to your application

Public Member Functions | Static Public Member Functions | List of all members
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, 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. 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...
bool | isFloating () const
| Checks if feature is a floating feature. More...
bool | isOfflineFloating () const
| Checks if feature is and offline server floating feature. More...
int32_t | floatingTimeout () const
| Getter for floating license timeout. More...
int32_t | floatingUsers () const
| Getter for maximum number of simultaneous users for this feature. More...
int32_t | floatingInUseCount () const
| Getter for current number of simultaneous users using this feature. More...
tm | floatingEndDateTime () const
| Getter method for floating license feature expiry date. More...
tm | floatingEndDateTimeUtc () const
| Getter method for license feature expiry date in UTC. More...
bool | floatingIsExpired () const
| Checks if floating 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

  code | The product feature code
  name | The name of the product feature on this license
  type | Either 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

  code | The product feature code
  name | The name of the product if feature is a floating feature.eature 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
  isFloating | Is license feature a floating feature
  isOfflineFloating | Is license feature an offline server floating feature
  floatingTimeout | Time in minutes after which the feature will automatically release if it's not registered
  floatingUsers | Maximum number of simultaneous users for this feature
  floatingInUseCount | Current number of simultaneous users using this feature
  floatingStartDateTime | The date when the floating feature was registered
  floatingEndDateTime | The 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

  value | String 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

  value | LSFeatureType 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:

- LicenseSpring/LicenseFeature.h