![]() |
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. 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 | 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::wstring &licensePath=std::wstring()) |
Allocates and constructs a LicenseFileStorageBase object and passes args to LicenseFileStorageBase(). More... | |
Protected Member Functions | |
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... | |
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 |
|
overridevirtual |
Saves given license data string to the file.
data | License data string |
Implements LicenseSpring::LicenseStorage.
Reimplemented in LicenseSpring::FileStorageWithLock, LicenseSpring::LicenseFileStorageEx, and LicenseSpring::LicenseFileStorage.
|
overridevirtual |
Load license from file.
Implements LicenseSpring::LicenseStorage.
Reimplemented in LicenseSpring::FileStorageWithLock, LicenseSpring::LicenseFileStorageEx, and LicenseSpring::LicenseFileStorage.
|
overridevirtual |
Removes local license file.
Implements LicenseSpring::LicenseStorage.
Reimplemented in LicenseSpring::FileStorageWithLock, LicenseSpring::LicenseFileStorageEx, and LicenseSpring::LicenseFileStorage.
void LicenseSpring::LicenseFileStorageBase::setLicenseFileName | ( | const std::wstring & | name | ) |
Setter for license filename with extension (optional). Default filename is License.key.
name | New license filename |
void LicenseSpring::LicenseFileStorageBase::setLicenseFolderPath | ( | const std::wstring & | path | ) |
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.