LicenseSpring C++ SDK
Easily add Software Licensing to your application
LicenseID.h
Go to the documentation of this file.
1 #ifndef LS_LICENSE_ID_H
2 #define LS_LICENSE_ID_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 "APIDef.h"
12 
13 namespace LicenseSpring
14 {
19  {
20  public:
22  LicenseID() = default;
23 
25  LicenseID( const LicenseID& ) = default;
26 
30  bool isEmpty() const;
31 
35  bool isValid() const;
36 
39  const std::string& id() const;
40 
43  const std::string& key() const;
44 
47  const std::string& user() const;
48 
52  const std::string& password() const;
53 
57  uint64_t serverId() const;
58 
61  void setPassword( const std::string& password );
62 
64  void trim();
65 
72  static LicenseID fromKey( const std::string& licenseKey, bool needTrim = true );
73 
79  static LicenseID fromKey( const char* licenseKey );
80 
88  static LicenseID fromUser( const std::string& user, const std::string& password = std::string(),
89  bool needTrim = true);
90 
97  static LicenseID fromUser( const char* user, const char* password = nullptr );
98 
107  static LicenseID fromUser( const std::string& user, uint64_t serverId,
108  const std::string& password = std::string(), bool needTrim = true);
109 
117  static LicenseID fromUser( const char* user, uint64_t serverId, const char* password = nullptr );
118 
119  private:
120  std::string m_key;
121  std::string m_user;
122  std::string m_password;
123  uint64_t m_serverId;
124  };
125 }
126 
127 #ifdef _MSC_VER
128 #pragma warning( pop )
129 #endif
130 
131 #endif // LS_LICENSE_ID_H
LicenseSpring::LicenseID
Class that represents License identifier.
Definition: LicenseID.h:18
LicenseSpring
Definition: BaseManager.h:16
APIDef.h
LS_API
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition: APIDef.h:22