1 #ifndef LS_LICENSE_FILE_STORAGE_H
2 #define LS_LICENSE_FILE_STORAGE_H
6 #pragma warning( push )
7 #pragma warning( disable : 4251 )
14 namespace boost {
namespace interprocess {
class permissions; } }
16 namespace LicenseSpring
23 using ptr_t = std::shared_ptr<LicenseFileStorageBase>;
28 static ptr_t create(
const std::wstring& licensePath = std::wstring() );
36 void saveLicense(
const std::string& data )
override;
40 std::string loadLicense()
override;
43 void clear()
override;
47 void setLicenseFileName(
const std::wstring& name );
51 void setLicenseFolderPath(
const std::wstring& path );
56 const std::wstring& licenseFileName()
const;
60 const std::wstring& licenseFolderPath()
const;
64 std::wstring licenseFilePath()
const;
72 std::wstring prepareRead()
const;
77 std::wstring prepareWrite()
const;
82 std::string readLicense(
const std::wstring& filePath )
const;
87 void writeLicense(
const std::wstring& filePath,
const std::string& data )
const;
96 using ptr_t = std::shared_ptr<LicenseFileStorage>;
101 static ptr_t create(
const std::wstring& licensePath = std::wstring() );
109 void saveLicense(
const std::string& data )
override;
113 std::string loadLicense()
override;
116 void clear()
override;
129 using ptr_t = std::shared_ptr<LicenseFileStorageEx>;
135 static ptr_t create(
const std::string& appName,
const std::wstring& licensePath = std::wstring() );
140 LicenseFileStorageEx(
const std::string& appName,
const std::wstring& licensePath = std::wstring() );
147 void saveLicense(
const std::string& data )
override;
151 std::string loadLicense()
override;
154 void clear()
override;
160 void setPermissionsUnix(
int permissions );
165 void setPermissionsWin(
void* permissions );
168 void setPermissionsUnrestricted();
172 void setPermissionsDefault();
178 uint32_t lockTimeout()
const;
182 void setLockTimeout( uint32_t timeout );
186 uint32_t m_lockTimeout;
187 boost::interprocess::permissions* m_perm;
197 using ptr_t = std::shared_ptr<FileStorageWithLock>;
202 static ptr_t create(
const std::wstring& licensePath = std::wstring() );
210 void saveLicense(
const std::string& data )
override;
214 std::string loadLicense()
override;
217 void clear()
override;
222 uint32_t attemptsCount()
const;
226 void setAttemptsCount( uint32_t count );
231 uint32_t waitTimeout()
const;
235 void setWaitTimeout( uint32_t timeout );
238 uint32_t m_attemptsCount;
239 uint32_t m_waitTimeout;
244 #pragma warning( pop )
247 #endif // LS_LICENSE_FILE_STORAGE_H
Class that saves license in a file, derived from LicenseFileStorageBase class.
Base class that saves license in a file, implements ILicenseStorage interface.
Class that saves license in a file, derived from LicenseFileStorageBase class.
LicenseStorage interface.
std::wstring m_folderPath
Class that saves license in a file, derived from LicenseFileStorageBase class.
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
std::shared_ptr< LicenseFileStorageBase > ptr_t