![]() |
LicenseSpring C++ SDK 7.31.0
Easily add Software Licensing to your application
|
Base class that saves license in a file, implements ILicenseStorage
interface.
More...
#include <LicenseSpring/LicenseFileStorage.h>
Public Types | |
using | ptr_t = std::shared_ptr< LicenseFileStorageBase > |
![]() | |
using | ptr_t = std::shared_ptr< LicenseStorage > |
Public Member Functions | |
LicenseFileStorageBase (const std::wstring &licensePath=std::wstring()) | |
Constructor for LicenseFileStorageBase 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 | 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. | |
![]() | |
virtual | ~LicenseStorage () |
Destructor for LicenseStorage object. | |
Static Public Member Functions | |
static ptr_t | create (const std::wstring &licensePath=std::wstring()) |
Allocates and constructs a LicenseFileStorageBase object and passes args to LicenseFileStorageBase(). | |
Protected Member Functions | |
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 | |
std::wstring | m_folderPath |
std::wstring | m_fileName |
Base class that saves license in a file, implements ILicenseStorage
interface.
This class does not use any techniques for file access synchronization so it is not thread safe.
Definition at line 20 of file LicenseFileStorage.h.
using LicenseSpring::LicenseFileStorageBase::ptr_t = std::shared_ptr<LicenseFileStorageBase> |
Definition at line 23 of file LicenseFileStorage.h.
LicenseSpring::LicenseFileStorageBase::LicenseFileStorageBase | ( | const std::wstring & | licensePath = std::wstring() | ) |
Constructor for LicenseFileStorageBase object.
licensePath | The path that license folder path will be set to |
|
static |
Allocates and constructs a LicenseFileStorageBase object and passes args to LicenseFileStorageBase().
licensePath | The path that license folder path will be set to |
Saves given license data string to the file.
data | License data string |
Implements LicenseSpring::LicenseStorage.
Reimplemented in LicenseSpring::LicenseFileStorageEx.
|
overridevirtual |
Load license from file.
Implements LicenseSpring::LicenseStorage.
Reimplemented in LicenseSpring::LicenseFileStorageEx.
|
overridevirtual |
Removes local license file.
Implements LicenseSpring::LicenseStorage.
Reimplemented in LicenseSpring::LicenseFileStorageEx.
Setter for license filename with extension (optional). Default filename is License.key.
name | New license filename |
Setter for folder path where License file is being stored.
path | New license folder path |
const std::wstring & LicenseSpring::LicenseFileStorageBase::licenseFileName | ( | ) | const |
Getter for license filename with extension (optional).
Default filename is License.key.
const std::wstring & LicenseSpring::LicenseFileStorageBase::licenseFolderPath | ( | ) | const |
std::wstring LicenseSpring::LicenseFileStorageBase::licenseFilePath | ( | ) | const |
Getter for path to the license file.
|
protected |
Prepare to read license file.
|
protected |
Prepare to write license file.
Also creates corresponding folders if they do not exist.
|
protected |
Reads license from file.
filePath | Absolute path to the license file |
|
protected |
Writes given license data string to the file.
filePath | Absolute path to the license file |
data | License data string |
|
protected |
Definition at line 67 of file LicenseFileStorage.h.
|
protected |
Definition at line 68 of file LicenseFileStorage.h.