LicenseSpring C++ SDK
Easily add Software Licensing to your application
BaseManager.h
Go to the documentation of this file.
1 #ifndef LS_BASE_MANAGER_H
2 #define LS_BASE_MANAGER_H
3 
4 #ifdef _MSC_VER
5 #pragma once
6 #pragma warning(push)
7 #pragma warning(disable : 4251)
8 #endif
9 
10 #include "Configuration.h"
11 #include "ProductDetails.h"
12 #include "UserLicensesData.h"
13 #include "License.h"
14 #include "LicenseStorage.h"
15 
16 namespace LicenseSpring
17 {
18 class LicenseService;
19 class DataHandler;
20 
25 {
26 public:
31  BaseManager(Configuration::ptr_t config, LicenseStorage::ptr_t storage = nullptr);
32  BaseManager(const BaseManager &) = delete;
33  BaseManager &operator=(const BaseManager &) = delete;
35  virtual ~BaseManager();
36 
39  Configuration::ptr_t currentConfig() const;
40 
44  void reconfigure(Configuration::ptr_t config);
45 
63  ProductDetails getProductDetails(bool includeLatestVersion = false);
64 
85  ProductDetails getProductDetails(
86  bool includeLatestVersion, bool includeCustomFields, const std::string &env);
87 
92  bool isLicenseFileCorrupted();
93 
101  const License::ptr_t getCurrentLicense();
102 
108  const License::ptr_t reloadLicense();
109 
113  void clearLocalStorage();
114 
122  const std::wstring &dataLocation() const;
123 
131  void setDataLocation(const std::wstring &path);
132 
138  std::wstring licenseFileName() const;
139 
145  void setLicenseFileName(const std::wstring &name);
146 
151  std::wstring licenseFilePath() const;
152 
153 protected:
155  std::shared_ptr<DataHandler> m_dataHandler;
156  std::shared_ptr<LicenseService> m_pLicenseService;
158 
160  void reset();
161 };
162 } // namespace LicenseSpring
163 
164 #ifdef _MSC_VER
165 #pragma warning(pop)
166 #endif
167 
168 #endif // LS_BASE_MANAGER_H
std::shared_ptr< Configuration > ptr_t
Definition: Configuration.h:21
std::shared_ptr< LicenseStorage > ptr_t
Base class for license management.
Definition: BaseManager.h:24
std::shared_ptr< License > ptr_t
Definition: License.h:37
std::shared_ptr< LicenseService > m_pLicenseService
Definition: BaseManager.h:156
Configuration::ptr_t m_config
Definition: BaseManager.h:154
License::ptr_t m_currentLicense
Definition: BaseManager.h:157
std::shared_ptr< DataHandler > m_dataHandler
Definition: BaseManager.h:155
#define LS_API
Definition: APIDef.h:23
Class that encapsulates information about a product.