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 
62  ProductDetails getProductDetails(bool includeLatestVersion = false);
63 
83  ProductDetails getProductDetails(
84  bool includeLatestVersion, bool includeCustomFields, const std::string &env);
85 
90  bool isLicenseFileCorrupted();
91 
99  const License::ptr_t getCurrentLicense();
100 
106  const License::ptr_t reloadLicense();
107 
111  void clearLocalStorage();
112 
120  const std::wstring &dataLocation() const;
121 
129  void setDataLocation(const std::wstring &path);
130 
136  std::wstring licenseFileName() const;
137 
143  void setLicenseFileName(const std::wstring &name);
144 
149  std::wstring licenseFilePath() const;
150 
151 protected:
153  std::shared_ptr<DataHandler> m_dataHandler;
154  std::shared_ptr<LicenseService> m_pLicenseService;
156 
158  void reset();
159 };
160 } // namespace LicenseSpring
161 
162 #ifdef _MSC_VER
163 #pragma warning(pop)
164 #endif
165 
166 #endif // LS_BASE_MANAGER_H
LicenseSpring::Configuration::ptr_t
std::shared_ptr< Configuration > ptr_t
Definition: Configuration.h:21
LicenseSpring::LicenseStorage::ptr_t
std::shared_ptr< LicenseStorage > ptr_t
Definition: LicenseStorage.h:20
ProductDetails.h
LicenseSpring::BaseManager::m_pLicenseService
std::shared_ptr< LicenseService > m_pLicenseService
Definition: BaseManager.h:154
LicenseSpring
Definition: BaseManager.h:16
UserLicensesData.h
LicenseSpring::BaseManager::m_config
Configuration::ptr_t m_config
Definition: BaseManager.h:152
LicenseSpring::License::ptr_t
std::shared_ptr< License > ptr_t
Definition: License.h:37
Configuration.h
LS_API
#define LS_API
Definition: APIDef.h:23
LicenseStorage.h
LicenseSpring::BaseManager
Base class for license management.
Definition: BaseManager.h:24
LicenseSpring::BaseManager::m_currentLicense
License::ptr_t m_currentLicense
Definition: BaseManager.h:155
LicenseSpring::ProductDetails
Class that encapsulates information about a product.
Definition: ProductDetails.h:22
LicenseSpring::BaseManager::m_dataHandler
std::shared_ptr< DataHandler > m_dataHandler
Definition: BaseManager.h:153
License.h