![]() |
LicenseSpring C++ SDK 7.31.0
Easily add Software Licensing to your application
|
Class that represents License identifier. More...
#include <LicenseSpring/LicenseID.h>
Public Member Functions | |
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. | |
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). | |
Static Public Member Functions | |
static LicenseID | fromKey (const std::string &licenseKey, bool needTrim=true) |
Constructs LicenseID with given license key. | |
static LicenseID | fromKey (const char *licenseKey) |
Constructs LicenseID with given license key. | |
static LicenseID | fromUser (const std::string &user, const std::string &password=std::string(), bool needTrim=true) |
Constructs LicenseID with given user credentials. | |
static LicenseID | fromUser (const char *user, const char *password=nullptr) |
Constructs LicenseID with given user credentials. | |
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 18 of file LicenseID.h.
|
default |
Default constructor, constructs invalid (empty) LicenseID.
bool LicenseSpring::LicenseID::isEmpty | ( | ) | const |
bool LicenseSpring::LicenseID::isValid | ( | ) | const |
const std::string & LicenseSpring::LicenseID::id | ( | ) | const |
Returns license key or user identifier, depending of what is present.
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).
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).
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.
Sets user password accordingly to provided string.
password | Password string. |
void LicenseSpring::LicenseID::trim | ( | ) |
Remove trailing whitespaces from the end and beginning of ID (key or user and password).
|
static |
Constructs LicenseID with given license key.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
licenseKey | The license key used to activate your license |
needTrim | Trims whitespaces from beginning and end of ID, if true. True by default. |
Constructs LicenseID with given license key.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
licenseKey | The license key used to activate your license |
|
static |
Constructs LicenseID with given user credentials.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
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. |
|
static |
Constructs LicenseID with given user credentials.
The ID will be automatically trimmed, no need to call trim manually if you use this function.
user | The username for the license |
password | The corresponding password for the username, empty by default |