| 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::LicenseFileStorageEx Class Reference

Class that saves license in a file, derived from `LicenseFileStorageBase` class. More...

`#include <LicenseSpring/LicenseFileStorage.h>`

Inheritance diagram for LicenseSpring::LicenseFileStorageEx:

## Public Types
using | ptr_t = std::shared_ptr< LicenseFileStorageEx >
Public Types inherited from LicenseSpring::LicenseFileStorageBase
using | ptr_t = std::shared_ptr< LicenseFileStorageBase >
Public Types inherited from LicenseSpring::LicenseStorage
using | ptr_t = std::shared_ptr< LicenseStorage >

## Public Member Functions
| LicenseFileStorageEx (const std::string &appName, const std::wstring &licensePath=std::wstring())
| LicenseFileStorageEx constructor.
| ~LicenseFileStorageEx () override
| Destructor for LicenseFileStorageEx object.
void | saveLicense (const std::string &data) override
| Saves given license data string to the file.
std::string | loadLicense () override
| Load license from file.
void | clear () override
| Removes local license file.
void | setPermissionsUnix (int permissions)
| Set platform dependent permission (Unix like systems).
void | setPermissionsWin (void *permissions)
| Set platform dependent permission (Windows).
void | setPermissionsUnrestricted ()
| Sets permissions to unrestricted access: null DACL for windows or 0666 for UNIX.
void | setPermissionsDefault ()
| Sets permissions to default values: null security attributes pointer for Windows or 0644 for UNIX.
uint32_t | lockTimeout () const
| Get trylock timeout in milliseconds.
void | setLockTimeout (uint32_t timeout)
| Set timeout in milliseconds for trylock.
Public Member Functions inherited from LicenseSpring::LicenseFileStorageBase
| LicenseFileStorageBase (const std::wstring &licensePath=std::wstring())
| Constructor for LicenseFileStorageBase object.
void | setLicenseFileName (const std::wstring &name)
| Setter for license filename with extension (optional). Default filename is License.key.
void | setLicenseFolderPath (const std::wstring &path)
| Setter for folder path where License file is being stored.
const std::wstring & | licenseFileName () const
| Getter for license filename with extension (optional).
const std::wstring & | licenseFolderPath () const
| Getter for folder path where License file is being stored.
std::wstring | licenseFilePath () const
| Getter for path to the license file.
Public Member Functions inherited from LicenseSpring::LicenseStorage
virtual | ~LicenseStorage ()
| Destructor for LicenseStorage object.

## Static Public Member Functions
static ptr_t | create (const std::string &appName, const std::wstring &licensePath=std::wstring())
| Allocates and constructs a LicenseFileStorageEx object and passes args to LicenseFileStorageEx().
Static Public Member Functions inherited from LicenseSpring::LicenseFileStorageBase
static ptr_t | create (const std::wstring &licensePath=std::wstring())
| Allocates and constructs a LicenseFileStorageBase object and passes args to LicenseFileStorageBase().

## Additional Inherited Members
Protected Member Functions inherited from LicenseSpring::LicenseFileStorageBase
std::wstring | prepareRead () const
| Prepare to read license file.
std::wstring | prepareWrite () const
| Prepare to write license file.
std::string | readLicense (const std::wstring &filePath) const
| Reads license from file.
void | writeLicense (const std::wstring &filePath, const std::string &data) const
| Writes given license data string to the file.
Protected Attributes inherited from LicenseSpring::LicenseFileStorageBase
std::wstring | m_folderPath
std::wstring | m_fileName

## Detailed Description

Class that saves license in a file, derived from `LicenseFileStorageBase` class.

Enhanced license file storage type for interprocess use. It uses boost named mutex for synchronization. File operations of this class is thread and process safe.

Definition at line 126 of file LicenseFileStorage.h.

## Member Typedef Documentation

## ◆ ptr_t

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

Definition at line 129 of file LicenseFileStorage.h.

## Constructor & Destructor Documentation

## ◆ LicenseFileStorageEx()

LicenseSpring::LicenseFileStorageEx::LicenseFileStorageEx | ( | const std::string & | appName,
|  | const std::wstring & | licensePath = `std::wstring()`
| ) |  |

LicenseFileStorageEx constructor.

Parameters

  appName | Application name to be used for mutex name.
  licensePath | The path that license folder path will be set to

## ◆ ~LicenseFileStorageEx()

LicenseSpring::LicenseFileStorageEx::~LicenseFileStorageEx | ( |  | ) |
| override

Destructor for LicenseFileStorageEx object.

## Member Function Documentation

## ◆ create()

static ptr_t LicenseSpring::LicenseFileStorageEx::create | ( | const std::string & | appName,
|  | const std::wstring & | licensePath = `std::wstring()`
| ) |  |
| static

Allocates and constructs a LicenseFileStorageEx object and passes args to LicenseFileStorageEx().

Parameters

  appName | Application name to be used for mutex name.
  licensePath | The path that license folder path will be set to

Returns
  A shared_ptr object that owns and stores a pointer to a newly allocated LicenseFileStorageEx object.

## ◆ saveLicense()

void LicenseSpring::LicenseFileStorageEx::saveLicense | ( | const std::string & | data | ) |
| override virtual

Saves given license data string to the file.

Parameters

  data | License data string

Reimplemented from LicenseSpring::LicenseFileStorageBase.

## ◆ loadLicense()

std::string LicenseSpring::LicenseFileStorageEx::loadLicense | ( |  | ) |
| override virtual

Load license from file.

Returns
  Encrypted license data.

Reimplemented from LicenseSpring::LicenseFileStorageBase.

## ◆ clear()

void LicenseSpring::LicenseFileStorageEx::clear | ( |  | ) |
| override virtual

Removes local license file.

Reimplemented from LicenseSpring::LicenseFileStorageBase.

## ◆ setPermissionsUnix()

void LicenseSpring::LicenseFileStorageEx::setPermissionsUnix | ( | int | permissions | ) |

Set platform dependent permission (Unix like systems).

Parameters

  permissions | Permissions to be set

## ◆ setPermissionsWin()

void LicenseSpring::LicenseFileStorageEx::setPermissionsWin | ( | void * | permissions | ) |

Set platform dependent permission (Windows).

Parameters

  permissions | Permissions to be set

see https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createmutexexa.

## ◆ setPermissionsUnrestricted()

void LicenseSpring::LicenseFileStorageEx::setPermissionsUnrestricted | ( |  | ) |

Sets permissions to unrestricted access: null DACL for windows or 0666 for UNIX.

## ◆ setPermissionsDefault()

void LicenseSpring::LicenseFileStorageEx::setPermissionsDefault | ( |  | ) |

Sets permissions to default values: null security attributes pointer for Windows or 0644 for UNIX.

This is the default value of the mutex permission.

## ◆ lockTimeout()

uint32_t LicenseSpring::LicenseFileStorageEx::lockTimeout | ( |  | ) | const

Get trylock timeout in milliseconds.

Default value is 1500ms, min is 50ms.
After timeout the SDK will try to remove mutex from the system and lock it again.

Returns
  Timeout in milliseconds.

## ◆ setLockTimeout()

void LicenseSpring::LicenseFileStorageEx::setLockTimeout | ( | uint32_t | timeout | ) |

Set timeout in milliseconds for trylock.

Parameters

  timeout | Timeout in milliseconds

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

- LicenseSpring/LicenseFileStorage.h