![]() |
LicenseSpring C++ SDK 7.31.0
Easily add Software Licensing to your application
|
Class that saves license in a file, derived from LicenseFileStorageBase
class.
More...
#include <LicenseSpring/LicenseFileStorage.h>
Public Types | |
using | ptr_t = std::shared_ptr< LicenseFileStorageEx > |
![]() | |
using | ptr_t = std::shared_ptr< LicenseFileStorageBase > |
![]() | |
using | ptr_t = std::shared_ptr< LicenseStorage > |
Public Member Functions | |
LicenseFileStorageEx (const std::string &appName, const std::wstring &licensePath=std::wstring()) | |
LicenseFileStorageEx constructor. More... | |
~LicenseFileStorageEx () override | |
Destructor for LicenseFileStorageEx object. More... | |
void | saveLicense (const std::string &data) override |
Saves given license data string to the file. More... | |
std::string | loadLicense () override |
Load license from file. More... | |
void | clear () override |
Removes local license file. More... | |
void | setPermissionsUnix (int permissions) |
Set platform dependent permission (Unix like systems). More... | |
void | setPermissionsWin (void *permissions) |
Set platform dependent permission (Windows). More... | |
void | setPermissionsUnrestricted () |
Sets permissions to unrestricted access: null DACL for windows or 0666 for UNIX. More... | |
void | setPermissionsDefault () |
Sets permissions to default values: null security attributes pointer for Windows or 0644 for UNIX. More... | |
uint32_t | lockTimeout () const |
Get trylock timeout in milliseconds. More... | |
void | setLockTimeout (uint32_t timeout) |
Set timeout in milliseconds for trylock. More... | |
![]() | |
LicenseFileStorageBase (const std::wstring &licensePath=std::wstring()) | |
Constructor for LicenseFileStorageBase object. More... | |
void | setLicenseFileName (const std::wstring &name) |
Setter for license filename with extension (optional). Default filename is License.key. More... | |
void | setLicenseFolderPath (const std::wstring &path) |
Setter for folder path where License file is being stored. More... | |
const std::wstring & | licenseFileName () const |
Getter for license filename with extension (optional). More... | |
const std::wstring & | licenseFolderPath () const |
Getter for folder path where License file is being stored. More... | |
std::wstring | licenseFilePath () const |
Getter for path to the license file. More... | |
![]() | |
virtual | ~LicenseStorage () |
Destructor for LicenseStorage object. More... | |
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(). More... | |
![]() | |
static ptr_t | create (const std::wstring &licensePath=std::wstring()) |
Allocates and constructs a LicenseFileStorageBase object and passes args to LicenseFileStorageBase(). More... | |
Additional Inherited Members | |
![]() | |
std::wstring | prepareRead () const |
Prepare to read license file. More... | |
std::wstring | prepareWrite () const |
Prepare to write license file. More... | |
std::string | readLicense (const std::wstring &filePath) const |
Reads license from file. More... | |
void | writeLicense (const std::wstring &filePath, const std::string &data) const |
Writes given license data string to the file. More... | |
![]() | |
std::wstring | m_folderPath |
std::wstring | m_fileName |
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.
using LicenseSpring::LicenseFileStorageEx::ptr_t = std::shared_ptr<LicenseFileStorageEx> |
Definition at line 129 of file LicenseFileStorage.h.
LicenseSpring::LicenseFileStorageEx::LicenseFileStorageEx | ( | const std::string & | appName, |
const std::wstring & | licensePath = std::wstring() |
||
) |
LicenseFileStorageEx constructor.
appName | Application name to be used for mutex name. |
licensePath | The path that license folder path will be set to |
|
override |
Destructor for LicenseFileStorageEx object.
|
static |
Allocates and constructs a LicenseFileStorageEx object and passes args to LicenseFileStorageEx().
appName | Application name to be used for mutex name. |
licensePath | The path that license folder path will be set to |
|
overridevirtual |
Saves given license data string to the file.
data | License data string |
Reimplemented from LicenseSpring::LicenseFileStorageBase.
|
overridevirtual |
Load license from file.
Reimplemented from LicenseSpring::LicenseFileStorageBase.
|
overridevirtual |
Removes local license file.
Reimplemented from LicenseSpring::LicenseFileStorageBase.
void LicenseSpring::LicenseFileStorageEx::setPermissionsUnix | ( | int | permissions | ) |
Set platform dependent permission (Unix like systems).
permissions | Permissions to be set |
void LicenseSpring::LicenseFileStorageEx::setPermissionsWin | ( | void * | permissions | ) |
Set platform dependent permission (Windows).
permissions | Permissions to be set |
see https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createmutexexa.
void LicenseSpring::LicenseFileStorageEx::setPermissionsUnrestricted | ( | ) |
Sets permissions to unrestricted access: null DACL for windows or 0666 for UNIX.
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.
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.
void LicenseSpring::LicenseFileStorageEx::setLockTimeout | ( | uint32_t | timeout | ) |
Set timeout in milliseconds for trylock.
timeout | Timeout in milliseconds |