LicenseSpring C++ SDK  7.27.0
Easily add Software Licensing to your application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
LicenseFeature.h
Go to the documentation of this file.
1 #ifndef LS_LICENSE_FEATURE_H
2 #define LS_LICENSE_FEATURE_H
3 
4 #ifdef _MSC_VER
5 #pragma once
6 #pragma warning( push )
7 #pragma warning( disable : 4251 )
8 #endif
9 
10 #include <string>
11 #include <ctime>
12 #include "PODTypes.h"
13 #include "APIDef.h"
14 #include "ConsumptionPeriod.h"
15 
16 namespace LicenseSpring
17 {
21  {
22  public:
25 
30  LicenseFeature( const std::string& code, const std::string& name, LSFeatureType type );
31 
46  LicenseFeature( const std::string& code, const std::string& name, LSFeatureType type,
47  int32_t maxConsumption, int32_t totalConsumption, int32_t localConsumption,
48  const tm& expiryDate, bool allowOverages, int32_t maxOverages,
49  bool resetConsumption, bool allowUnlimitedConsumptions, ConsumptionPeriod consumptionPeriod, const std::string& metadata );
50 
53  const std::string& code() const;
54 
57  const std::string& name() const;
58 
61  LSFeatureType featureType() const;
62 
66  int32_t maxConsumption() const;
67 
71  int32_t totalConsumption() const;
72 
77  int32_t localConsumption() const;
78 
81  int32_t maxOverages() const;
82 
85  bool isOveragesAllowed() const;
86 
89  ConsumptionPeriod consumptionPeriod() const;
90 
93  bool isResetConsumptionEnabled() const;
94 
97  bool isUnlimitedConsumptionAllowed() const;
98 
103  tm expiryDate() const;
104 
108  tm expiryDateUtc() const;
109 
112  const std::string& metadata() const;
113 
116  bool isExpired() const;
117 
124  static LSFeatureType FeatureTypeFromString( const std::string& value );
125 
131  static std::string FeatureTypeToString( LSFeatureType value );
132 
136  std::string toString() const;
137 
138  private:
139  std::string m_code;
140  std::string m_name;
141  LSFeatureType m_featureType;
142  int32_t m_maxConsumption;
143  int32_t m_totalConsumption;
144  int32_t m_localConsumption;
145  int32_t m_maxOverages;
146  bool m_allowOverages;
147  bool m_allowUnlimitedConsumptions;
148  bool m_resetConsumption;
149  ConsumptionPeriod m_consumptionPeriod;
150  tm m_expiryDate;
151  std::string m_metadata;
152  };
153 }
154 
155 #ifdef _MSC_VER
156 #pragma warning( pop )
157 #endif
158 
159 #endif // LS_LICENSE_FEATURE_H
Class used for encapsulating LSConsumptionPeriod and converting cosumption period to/from string...
Class that encapsulates information about license feature.
LSFeatureType
Product feature type.
Definition: PODTypes.h:18
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition: APIDef.h:22