Class that represents License identifier.
More...
#include <LicenseSpring/LicenseID.h>
|
| LicenseID ()=default |
| Default constructor, constructs invalid (empty) LicenseID.
|
|
| LicenseID (const LicenseID &)=default |
| Default copy constructor.
|
|
bool | isEmpty () const |
| Checks if LicenseID is empty.
|
|
bool | isValid () const |
| Checks if LicenseID is valid.
|
|
const std::string & | id () const |
| Returns license key or user identifier, depending of what is present.
|
|
const std::string & | key () const |
| Returns license key or empty string, if key is not set (for example in case of user-based product).
|
|
const std::string & | user () const |
| Returns user identifier or empty string, if user is not set (for example in case of key-based product).
|
|
const std::string & | password () const |
| Returns user password or empty string, if password is not set.
|
|
uint64_t | serverId () const |
| Returns server-side license id, or 0 if license is key-based.
|
|
void | setPassword (const std::string &password) |
| Sets user password accordingly to provided string.
|
|
void | trim () |
| Remove trailing whitespaces from the end and beginning of ID (key or user and password).
|
|
Class that represents License identifier.
For key-based products it is license key, for user-based products it is user credentials - user identifier (typically email) and password.
Please note: password only required for license activation, other API does not require password. This class does not throw exceptions.
Definition at line 20 of file LicenseID.h.
◆ LicenseID() [1/2]
LicenseSpring::LicenseID::LicenseID |
( |
| ) |
|
|
default |
Default constructor, constructs invalid (empty) LicenseID.
◆ LicenseID() [2/2]
LicenseSpring::LicenseID::LicenseID |
( |
const LicenseID & | | ) |
|
|
default |
Default copy constructor.
◆ isEmpty()
bool LicenseSpring::LicenseID::isEmpty |
( |
| ) |
const |
Checks if LicenseID is empty.
LicenseID considered empty if both license key and user are empty strings.
- Returns
- True if empty and false otherwise.
◆ isValid()
bool LicenseSpring::LicenseID::isValid |
( |
| ) |
const |
Checks if LicenseID is valid.
LicenseID considered valid if one of the members (key or user) is not empty. Equivalent of !isEmpty().
- Returns
- True if valid and false otherwise.
◆ id()
const std::string & LicenseSpring::LicenseID::id |
( |
| ) |
const |
Returns license key or user identifier, depending of what is present.
- Returns
- License key or user identifier string.
◆ key()
const std::string & LicenseSpring::LicenseID::key |
( |
| ) |
const |
Returns license key or empty string, if key is not set (for example in case of user-based product).
- Returns
- License key or empty string.
◆ user()
const std::string & LicenseSpring::LicenseID::user |
( |
| ) |
const |
Returns user identifier or empty string, if user is not set (for example in case of key-based product).
- Returns
- User identifier or empty string.
◆ password()
const std::string & LicenseSpring::LicenseID::password |
( |
| ) |
const |
Returns user password or empty string, if password is not set.
SDK does not store password on disk or anywhere else.
- Returns
- Password or empty string.
◆ serverId()
uint64_t LicenseSpring::LicenseID::serverId |
( |
| ) |
const |
Returns server-side license id, or 0 if license is key-based.
The server-side license id exists only in case of multiple user-based licenses assigned to the same user.
- Returns
- Integer server-side id.
◆ setPassword()
void LicenseSpring::LicenseID::setPassword |
( |
const std::string & | password | ) |
|
Sets user password accordingly to provided string.
- Parameters
-
◆ trim()
void LicenseSpring::LicenseID::trim |
( |
| ) |
|
Remove trailing whitespaces from the end and beginning of ID (key or user and password).
◆ fromKey() [1/2]
static LicenseID LicenseSpring::LicenseID::fromKey |
( |
const std::string & | licenseKey, |
|
|
bool | needTrim = true ) |
|
static |
Constructs LicenseID with given license key.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
- Parameters
-
licenseKey | The license key used to activate your license |
needTrim | Trims whitespaces from beginning and end of ID, if true. True by default. |
- Returns
- LicenseID object.
- Note
- There are multiple methods with the same name and different parameters.
◆ fromKey() [2/2]
static LicenseID LicenseSpring::LicenseID::fromKey |
( |
const char * | licenseKey | ) |
|
|
static |
Constructs LicenseID with given license key.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
- Parameters
-
licenseKey | The license key used to activate your license |
- Returns
- LicenseID object.
- Note
- There are multiple methods with the same name and different parameters.
◆ fromUser() [1/4]
static LicenseID LicenseSpring::LicenseID::fromUser |
( |
const std::string & | user, |
|
|
const std::string & | password = std::string(), |
|
|
bool | needTrim = true ) |
|
static |
Constructs LicenseID with given user credentials.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
- Parameters
-
user | The username for the license |
password | The corresponding password for the username, empty by default |
needTrim | Trims whitespaces from beginning and end of ID, if true. True by default. |
- Returns
- LicenseID object.
- Note
- There are multiple methods with the same name and different parameters.
◆ fromUser() [2/4]
static LicenseID LicenseSpring::LicenseID::fromUser |
( |
const char * | user, |
|
|
const char * | password = nullptr ) |
|
static |
Constructs LicenseID with given user credentials.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
- Parameters
-
user | The username for the license |
password | The corresponding password for the username, empty by default |
- Returns
- LicenseID object.
- Note
- There are multiple methods with the same name and different parameters.
◆ fromUser() [3/4]
static LicenseID LicenseSpring::LicenseID::fromUser |
( |
const std::string & | user, |
|
|
uint64_t | serverId, |
|
|
const std::string & | password = std::string(), |
|
|
bool | needTrim = true ) |
|
static |
Constructs LicenseID with given user credentials.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
- Parameters
-
user | The username for the license |
serverId | Server side ID of the license |
password | The corresponding password for the username, empty by default |
needTrim | Trims whitespaces from beginning and end of ID, if true. True by default. |
- Returns
- LicenseID object.
- Note
- There are multiple methods with the same name and different parameters.
◆ fromUser() [4/4]
static LicenseID LicenseSpring::LicenseID::fromUser |
( |
const char * | user, |
|
|
uint64_t | serverId, |
|
|
const char * | password = nullptr ) |
|
static |
Constructs LicenseID with given user credentials.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
- Parameters
-
user | The username for the license |
serverId | Server side ID of the license |
password | The corresponding password for the username, empty by default |
- Returns
- LicenseID object.
- Note
- There are multiple methods with the same name and different parameters.
The documentation for this class was generated from the following file: