| LicenseSpring C++ SDK 7.32.0 Easily add Software Licensing to your application

Loading...
Searching...
No Matches
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{
18 class LS_API LicenseID
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
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
LicenseSpring::LicenseID
Class that represents License identifier.
Definition LicenseID.h:19
LicenseSpring::LicenseID::isEmpty
bool isEmpty() const
Checks if LicenseID is empty.
LicenseSpring::LicenseID::fromUser
static LicenseID fromUser(const std::string &user, const std::string &password=std::string(), bool needTrim=true)
Constructs LicenseID with given user credentials.
LicenseSpring::LicenseID::trim
void trim()
Remove trailing whitespaces from the end and beginning of ID (key or user and password).
LicenseSpring::LicenseID::password
const std::string & password() const
Returns user password or empty string, if password is not set.
LicenseSpring::LicenseID::user
const std::string & user() const
Returns user identifier or empty string, if user is not set (for example in case of key-based product...
LicenseSpring::LicenseID::id
const std::string & id() const
Returns license key or user identifier, depending of what is present.
LicenseSpring::LicenseID::key
const std::string & key() const
Returns license key or empty string, if key is not set (for example in case of user-based product).
LicenseSpring::LicenseID::LicenseID
LicenseID()=default
Default constructor, constructs invalid (empty) LicenseID.
LicenseSpring::LicenseID::fromUser
static LicenseID fromUser(const char *user, const char *password=nullptr)
Constructs LicenseID with given user credentials.
LicenseSpring::LicenseID::isValid
bool isValid() const
Checks if LicenseID is valid.
LicenseSpring::LicenseID::fromKey
static LicenseID fromKey(const char *licenseKey)
Constructs LicenseID with given license key.
LicenseSpring::LicenseID::LicenseID
LicenseID(const LicenseID &)=default
Default copy constructor.
LicenseSpring::LicenseID::setPassword
void setPassword(const std::string &password)
Sets user password accordingly to provided string.
LicenseSpring::LicenseID::fromKey
static LicenseID fromKey(const std::string &licenseKey, bool needTrim=true)
Constructs LicenseID with given license key.
LicenseSpring
Definition BaseManager.h:16