| 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 | Protected Member Functions | Protected Attributes | List of all members
LicenseSpring::LicenseFileStorageBase Class Reference

Base class that saves license in a file, implements `ILicenseStorage` interface. More...

`#include <LicenseSpring/LicenseFileStorage.h>`

Inheritance diagram for LicenseSpring::LicenseFileStorageBase:

## Public Types
using | ptr_t = std::shared_ptr< LicenseFileStorageBase >
Public Types inherited from LicenseSpring::LicenseStorage
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.
Public Member Functions inherited from LicenseSpring::LicenseStorage
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

## Detailed Description

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.

## Member Typedef Documentation

## ◆ ptr_t

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

Definition at line 23 of file LicenseFileStorage.h.

## Constructor & Destructor Documentation

## ◆ LicenseFileStorageBase()

LicenseSpring::LicenseFileStorageBase::LicenseFileStorageBase | ( | const std::wstring & | licensePath = `std::wstring()` | ) |

Constructor for LicenseFileStorageBase object.

Parameters

  licensePath | The path that license folder path will be set to

## Member Function Documentation

## ◆ create()

static ptr_t LicenseSpring::LicenseFileStorageBase::create | ( | const std::wstring & | licensePath = `std::wstring()` | ) |
| static

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

Parameters

  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 LicenseFileStorageBase object.

## ◆ saveLicense()

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

Saves given license data string to the file.

Parameters

  data | License data string

Implements LicenseSpring::LicenseStorage.

Reimplemented in LicenseSpring::LicenseFileStorageEx.

## ◆ loadLicense()

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

Load license from file.

Returns
  Encrypted license data.

Implements LicenseSpring::LicenseStorage.

Reimplemented in LicenseSpring::LicenseFileStorageEx.

## ◆ clear()

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

Removes local license file.

Implements LicenseSpring::LicenseStorage.

Reimplemented in LicenseSpring::LicenseFileStorageEx.

## ◆ setLicenseFileName()

void LicenseSpring::LicenseFileStorageBase::setLicenseFileName | ( | const std::wstring & | name | ) |

Setter for license filename with extension (optional). Default filename is License.key.

Parameters

  name | New license filename

## ◆ setLicenseFolderPath()

void LicenseSpring::LicenseFileStorageBase::setLicenseFolderPath | ( | const std::wstring & | path | ) |

Setter for folder path where License file is being stored.

Parameters

  path | New license folder path

## ◆ licenseFileName()

const std::wstring & LicenseSpring::LicenseFileStorageBase::licenseFileName | ( |  | ) | const

Getter for license filename with extension (optional).

Default filename is License.key.

Returns
  License filename with extension.

## ◆ licenseFolderPath()

const std::wstring & LicenseSpring::LicenseFileStorageBase::licenseFolderPath | ( |  | ) | const

Getter for folder path where License file is being stored.

Returns
  License folder path.

## ◆ licenseFilePath()

std::wstring LicenseSpring::LicenseFileStorageBase::licenseFilePath | ( |  | ) | const

Getter for path to the license file.

Returns
  Absolute path to the license file.

## ◆ prepareRead()

std::wstring LicenseSpring::LicenseFileStorageBase::prepareRead | ( |  | ) | const
| protected

Prepare to read license file.

Returns
  Absolute path to the license file or empty string if file does not exist.

## ◆ prepareWrite()

std::wstring LicenseSpring::LicenseFileStorageBase::prepareWrite | ( |  | ) | const
| protected

Prepare to write license file.

Also creates corresponding folders if they do not exist.

Returns
  Absolute path to the license file.

## ◆ readLicense()

std::string LicenseSpring::LicenseFileStorageBase::readLicense | ( | const std::wstring & | filePath | ) | const
| protected

Reads license from file.

Parameters

  filePath | Absolute path to the license file

Returns
  Encrypted license data.

## ◆ writeLicense()

void LicenseSpring::LicenseFileStorageBase::writeLicense | ( | const std::wstring & | filePath,
|  | const std::string & | data
| ) |  | const
| protected

Writes given license data string to the file.

Parameters

  filePath | Absolute path to the license file
  data | License data string

## Member Data Documentation

## ◆ m_folderPath

std::wstring LicenseSpring::LicenseFileStorageBase::m_folderPath
| protected

Definition at line 67 of file LicenseFileStorage.h.

## ◆ m_fileName

std::wstring LicenseSpring::LicenseFileStorageBase::m_fileName
| protected

Definition at line 68 of file LicenseFileStorage.h.

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

- LicenseSpring/LicenseFileStorage.h