LicenseSpring C++ SDK  7.27.0
Easily add Software Licensing to your application
LicenseMemoryStorage.h
Go to the documentation of this file.
1 #ifndef LS_LICENSE_MEMORY_STORAGE_H
2 #define LS_LICENSE_MEMORY_STORAGE_H
3 
4 #ifdef _MSC_VER
5 #pragma once
6 #pragma warning( push )
7 #pragma warning( disable : 4251 )
8 #endif
9 
10 #include <mutex>
11 #include <string>
12 #include "LicenseStorage.h"
13 
14 namespace LicenseSpring
15 {
19  {
20  public:
21  using ptr_t = std::shared_ptr<LicenseMemoryStorage>;
22 
25  static ptr_t create();
26 
28  LicenseMemoryStorage() = default;
29 
32  void saveLicense( const std::string& licenseData );
33 
36  std::string loadLicense();
37 
39  void clear();
40 
41  private:
42  std::string m_licenseData;
43  std::mutex m_mutex;
44  };
45 } // namespace LicenseSpirng
46 
47 #ifdef _MSC_VER
48 #pragma warning( pop )
49 #endif
50 
51 #endif // LS_LICENSE_MEMORY_STORAGE_H
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition: APIDef.h:22
Simple class that saves license in a variable, implements LicenseStorage interface.
std::shared_ptr< LicenseMemoryStorage > ptr_t
std::string loadLicense()
Load license data from memory (variable).
void saveLicense(const std::string &licenseData)
Saves license data in a variable.
void clear()
Purge license data.
LicenseMemoryStorage()=default
Constructor for LicenseMemoryStorage object.
static ptr_t create()
Allocates and constructs a LicenseMemoryStorage object and passes args to LicenseMemoryStorage().
LicenseStorage interface.