![]() |
LicenseSpring C++ SDK 7.31.0
Easily add Software Licensing to your application
|
Class for performing requests to LicenseSpring Floating server. More...
#include <LicenseSpring/FloatingClient.h>
Public Types | |
using | ptr_t = std::shared_ptr< FloatingClient > |
Public Member Functions | |
FloatingClient (Configuration::ptr_t config, LicenseStorage::ptr_t storage) | |
Construct FloatingClient object and initialize it with given configuration. More... | |
~FloatingClient () override | |
Destroy FloatingClient and its configuration if there is no more references to the configuration. More... | |
const License::ptr_t | registerLicense (const std::string &id, const LicenseID &licenseID=LicenseID()) |
Register client with given id. More... | |
const License::ptr_t | borrowLicense (const std::string &id, const std::string &borrowEndDateTime=std::string()) |
Allows to register and borrow license at once. More... | |
bool | unregisterLicense (const std::string &id, const LicenseID &licenseID=LicenseID()) |
Unregister client with given id. More... | |
bool | isOnline (bool throwExceptions=false) const |
Helper method, it checks connection to the Floating server. More... | |
FloatingServerInfo::ptr_t | getServerInfo () |
Get Floating Server information (obsolete). More... | |
![]() | |
BaseManager (Configuration::ptr_t config, LicenseStorage::ptr_t storage=nullptr) | |
Create and intialize license manager with given configuration. More... | |
BaseManager (const BaseManager &)=delete | |
BaseManager & | operator= (const BaseManager &)=delete |
virtual | ~BaseManager () |
Destroy LicenseManger with current configuration. More... | |
Configuration::ptr_t | currentConfig () const |
Returns current configuration. More... | |
void | reconfigure (Configuration::ptr_t config) |
Change current configuration. More... | |
ProductDetails | getProductDetails (bool includeLatestVersion=false) |
Get basic information from the backend on product which corresponds to the current configuration. More... | |
const License::ptr_t | getCurrentLicense () |
Load license from local storage (if not yet loaded). More... | |
const License::ptr_t | reloadLicense () |
Resets current license and loads it again from local storage. More... | |
void | clearLocalStorage () |
Remove local license, other files and folders created by LicenseSpring, usually should be called at app uninstallation. More... | |
const std::wstring & | dataLocation () const |
Absolute folder path where LicenseSpring data is stored. More... | |
void | setDataLocation (const std::wstring &path) |
Set absolute or relative path to folder where LicenseSpring data should be stored. More... | |
std::wstring | licenseFileName () const |
Return license file name with extension, unless filename was explicitly set to be without extension. More... | |
void | setLicenseFileName (const std::wstring &name) |
Set license file name, it can be with or without extension. More... | |
std::wstring | licenseFilePath () const |
Return concatenated dataLocation() and licenseFileName(). More... | |
Static Public Member Functions | |
static FloatingClient::ptr_t | create (Configuration::ptr_t config, LicenseStorage::ptr_t storage=nullptr) |
Creates FloatingClient object and initialize it with given configuration. More... | |
Additional Inherited Members | |
![]() | |
void | reset () |
Reset (delete) members. More... | |
![]() | |
Configuration::ptr_t | m_config |
std::shared_ptr< DataHandler > | m_dataHandler |
LicenseService * | m_pLicenseService |
License::ptr_t | m_currentLicense |
Class for performing requests to LicenseSpring Floating server.
Definition at line 18 of file FloatingClient.h.
using LicenseSpring::FloatingClient::ptr_t = std::shared_ptr<FloatingClient> |
Definition at line 21 of file FloatingClient.h.
LicenseSpring::FloatingClient::FloatingClient | ( | Configuration::ptr_t | config, |
LicenseStorage::ptr_t | storage | ||
) |
Construct FloatingClient object and initialize it with given configuration.
config | Configuration object to use |
storage | Storage for local license, by default local license is saved in a file |
ConfigurationException | If config is null |
|
override |
Destroy FloatingClient and its configuration if there is no more references to the configuration.
|
static |
Creates FloatingClient object and initialize it with given configuration.
config | Configuration object to use |
storage | Storage for local license, by default local license is saved in a file |
ConfigurationException | If config is null |
const License::ptr_t LicenseSpring::FloatingClient::registerLicense | ( | const std::string & | id, |
const LicenseID & | licenseID = LicenseID() |
||
) |
Register client with given id.
Send register license request to the Floating server.
id | User or instance id for license registration, it can be anything - email, host or domain name, handle, etc. |
licenseID | License identifier, optional, if not specified this method tries to register to default license for the product. |
LicenseNotFloatingException | In case provided license is not floating |
ProductNotFoundException | In case configured product does not exist |
LicenseNotFoundException | In case provided license was not found |
LicenseStateException | If license is disabled or experid |
NoInternetException | If cannot reach the server |
NetworkTimeoutException | In case of network timeout |
LicenseServerException | In case of internal server error |
UnknownLicenseSpringException | In rare case if something went wrong, please contact support |
const License::ptr_t LicenseSpring::FloatingClient::borrowLicense | ( | const std::string & | id, |
const std::string & | borrowEndDateTime = std::string() |
||
) |
Allows to register and borrow license at once.
Can throw the same exceptions as on registration and License::borrow, see those functions for more details.
id | User or instance id for license registration, it can be anything - email, host or domain name, handle, etc. |
borrowEndDateTime | Borrow end date time in format "%Y-%m-%dT%H:%M:%SZ", for example "2022-05-28T15:30:00Z" |
bool LicenseSpring::FloatingClient::unregisterLicense | ( | const std::string & | id, |
const LicenseID & | licenseID = LicenseID() |
||
) |
Unregister client with given id.
id | User or instance id, it can be anything - email, host or domain name, handle, etc. |
licenseID | License id, optional, if not specified this method unegister from default configured license for the product. |
NoInternetException | If cannot reach the server |
NetworkTimeoutException | In case of network timeout |
LicenseServerException | In case of internal server error |
UnknownLicenseSpringException | In rare case if something went wrong, please contact support |
bool LicenseSpring::FloatingClient::isOnline | ( | bool | throwExceptions = false | ) | const |
Helper method, it checks connection to the Floating server.
throwExceptions | Indicates whether this method should throw exceptions |
NoInternetException | If cannot reach the server |
NetworkTimeoutException | In case of network timeout |
LicenseServerException | In case of internal server error |
UnknownLicenseSpringException | In rare case if something went wrong, please contact support |
FloatingServerInfo::ptr_t LicenseSpring::FloatingClient::getServerInfo | ( | ) |
Get Floating Server information (obsolete).
This method is obsolete.
NoInternetException | If cannot reach the server |
NetworkTimeoutException | In case of network timeout |
LicenseServerException | In case of internal server error |
UnknownLicenseSpringException | In rare case if something went wrong, please contact support |