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

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
LicenseSpring::FloatingClient Class Reference

Class for performing requests to LicenseSpring Floating server. More...

`#include <LicenseSpring/FloatingClient.h>`

Inheritance diagram for LicenseSpring::FloatingClient:

## 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.
| ~FloatingClient () override
| Destroy FloatingClient and its configuration if there is no more references to the configuration.
const License::ptr_t | registerLicense (const std::string &id, const LicenseID &licenseID=LicenseID())
| Register client with given id.
const License::ptr_t | borrowLicense (const std::string &id, const std::string &borrowEndDateTime=std::string())
| Allows to register and borrow license at once.
bool | unregisterLicense (const std::string &id, const LicenseID &licenseID=LicenseID())
| Unregister client with given id.
bool | isOnline (bool throwExceptions=false) const
| Helper method, it checks connection to the Floating server.
FloatingServerInfo::ptr_t | getServerInfo ()
| Get Floating Server information (obsolete).
Public Member Functions inherited from LicenseSpring::BaseManager
| BaseManager (Configuration::ptr_t config, LicenseStorage::ptr_t storage=nullptr)
| Create and intialize license manager with given configuration.
| BaseManager (const BaseManager &)=delete
BaseManager & | operator= (const BaseManager &)=delete
virtual | ~BaseManager ()
| Destroy LicenseManger with current configuration.
Configuration::ptr_t | currentConfig () const
| Returns current configuration.
void | reconfigure (Configuration::ptr_t config)
| Change current configuration.
ProductDetails | getProductDetails (bool includeLatestVersion=false)
| Get basic information from the backend on product which corresponds to the current configuration.
const License::ptr_t | getCurrentLicense ()
| Load license from local storage (if not yet loaded).
const License::ptr_t | reloadLicense ()
| Resets current license and loads it again from local storage.
void | clearLocalStorage ()
| Remove local license, other files and folders created by LicenseSpring, usually should be called at app uninstallation.
const std::wstring & | dataLocation () const
| Absolute folder path where LicenseSpring data is stored.
void | setDataLocation (const std::wstring &path)
| Set absolute or relative path to folder where LicenseSpring data should be stored.
std::wstring | licenseFileName () const
| Return license file name with extension, unless filename was explicitly set to be without extension.
void | setLicenseFileName (const std::wstring &name)
| Set license file name, it can be with or without extension.
std::wstring | licenseFilePath () const
| Return concatenated dataLocation() and licenseFileName().

## 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.

## Additional Inherited Members
Protected Member Functions inherited from LicenseSpring::BaseManager
void | reset ()
| Reset (delete) members.
Protected Attributes inherited from LicenseSpring::BaseManager
Configuration::ptr_t | m_config
std::shared_ptr< DataHandler > | m_dataHandler
std::shared_ptr< LicenseService > | m_pLicenseService
License::ptr_t | m_currentLicense

## Detailed Description

Class for performing requests to LicenseSpring Floating server.

See also
  https://docs.licensespring.com/docs/floating-server

Definition at line 18 of file FloatingClient.h.

## Member Typedef Documentation

## ◆ ptr_t

using LicenseSpring::FloatingClient::ptr_t = std::shared_ptr<FloatingClient>

Definition at line 21 of file FloatingClient.h.

## Constructor & Destructor Documentation

## ◆ FloatingClient()

LicenseSpring::FloatingClient::FloatingClient | ( | Configuration::ptr_t | config,
|  | LicenseStorage::ptr_t | storage )

Construct FloatingClient object and initialize it with given configuration.

Parameters

  config | Configuration object to use
  storage | Storage for local license, by default local license is saved in a file

Exceptions

  ConfigurationException | If config is null

## ◆ ~FloatingClient()

LicenseSpring::FloatingClient::~FloatingClient | ( |  | ) |
| override

Destroy FloatingClient and its configuration if there is no more references to the configuration.

## Member Function Documentation

## ◆ create()

static FloatingClient::ptr_t LicenseSpring::FloatingClient::create | ( | Configuration::ptr_t | config,
|  | LicenseStorage::ptr_t | storage = nullptr )
| static

Creates FloatingClient object and initialize it with given configuration.

Parameters

  config | Configuration object to use
  storage | Storage for local license, by default local license is saved in a file

Exceptions

  ConfigurationException | If config is null

Returns
  Shared pointer to FloatingClient object.

## ◆ registerLicense()

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.

Parameters

  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.

Returns
  Shared pointer to License if registration succeeded, throws exceptions in case of errors.

Exceptions

  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

## ◆ borrowLicense()

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.

Parameters

  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"

Returns
  Shared pointer to License if registration and borrowing succeeded, throws exceptions in case of errors.

## ◆ unregisterLicense()

bool LicenseSpring::FloatingClient::unregisterLicense | ( | const std::string & | id,
|  | const LicenseID & | licenseID = LicenseID() )

Unregister client with given id.

Parameters

  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.

Returns
  True if license unregistered successfully.

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

## ◆ isOnline()

bool LicenseSpring::FloatingClient::isOnline | ( | bool | throwExceptions = false | ) | const

Helper method, it checks connection to the Floating server.

Parameters

  throwExceptions | Indicates whether this method should throw exceptions

Returns
  True if SDK is able to connect to the Floating server and false otherwise.

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

## ◆ getServerInfo()

FloatingServerInfo::ptr_t LicenseSpring::FloatingClient::getServerInfo | ( |  | ) |

Get Floating Server information (obsolete).

This method is obsolete.

Returns
  Shared pointer to FloatingServerInfo if succeeded, throws exceptions in case of errors.

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

The documentation for this class was generated from the following file:

- LicenseSpring/FloatingClient.h