LicenseSpring C++ SDK  7.31.0
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 
56  void setPassword( const std::string& password );
57 
59  void trim();
60 
67  static LicenseID fromKey( const std::string& licenseKey, bool needTrim = true );
68 
74  static LicenseID fromKey( const char* licenseKey );
75 
83  static LicenseID fromUser( const std::string& user, const std::string& password = std::string(),
84  bool needTrim = true );
85 
92  static LicenseID fromUser( const char* user, const char* password = nullptr );
93 
94  private:
95  std::string m_key;
96  std::string m_user;
97  std::string m_password;
98  };
99 }
100 
101 #ifdef _MSC_VER
102 #pragma warning( pop )
103 #endif
104 
105 #endif // LS_LICENSE_ID_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
Class that represents License identifier.
Definition: LicenseID.h:18