Licme
Loading...
Searching...
No Matches
configuration.h
1#pragma once
2
3#include <string>
4#include <functional>
5
9#define SERVER_DEFAULT_URL "https://licensehub.digitalwerk.net"
10
11namespace licme
12{
13namespace manager
14{
15
37{
38public:
55 Configuration(const std::string& productNameLowerCase);
56
61
63 Configuration& operator=(const Configuration&);
65 Configuration& operator=(Configuration&&) noexcept;
66
73
86 std::string_view ProductName(bool upcase = true) const;
87
93 std::string_view UserName() const;
94
100 std::string_view UserHomeDirectory() const;
101
107 std::string_view HostName() const;
108
116 std::string_view LicenseKey() const;
117
123 std::string_view LicenseFile() const;
124
130 std::string_view LicenseServer() const;
131
137 std::function<void(std::string& host, int& port)> ProxyHook() const;
138
144 std::function<void(std::string& user, std::string& password)> ProxyAuthHook() const;
145
154 Configuration& UserName(std::string_view value);
155
165 Configuration& UserHomeDirectory(std::string_view value);
166
175 Configuration& HostName(std::string_view value);
176
186 Configuration& LicenseKey(std::string_view value);
187
196 Configuration& LicenseFile(std::string_view value);
197
206 Configuration& LicenseServer(std::string_view value);
207
221 Configuration& ProxyHook(std::function<void(std::string& host, int& port)> hook);
222
236 Configuration& ProxyAuthHook(std::function<void(std::string& user, std::string& password)> hook);
237
244 Configuration& RedirectDebugLog(std::function<void(const std::string&)> callback);
245
252 Configuration& RedirectInfoLog(std::function<void(const std::string&)> callback);
253
260 Configuration& RedirectErrorLog(std::function<void(const std::string&)> callback);
261
262private:
263 std::string m_product, m_product_upcase, m_user, m_home, m_host, m_lickey, m_file, m_server;
264 std::function<void(std::string& host, int& port)> m_proxySetupHook;
265 std::function<void(std::string& user, std::string& password)> m_proxyAuthHook;
266};
267
268} // namespace manager
269} // namespace licme
std::string_view ProductName(bool upcase=true) const
Get the Product's Name.
Configuration(const std::string &productNameLowerCase)
Create a new object containing licensee environment information.
std::function< void(std::string &user, std::string &password)> ProxyAuthHook() const
Returns proxy authentication hook.
std::string_view UserName() const
Get the User's Name.
std::string_view LicenseServer() const
Get the License Server URL.
std::function< void(std::string &host, int &port)> ProxyHook() const
Returns proxy setup hook.
Configuration(Configuration &&) noexcept
Configuration(const Configuration &)
std::string_view LicenseKey() const
Get the License Key.
Configuration & RedirectErrorLog(std::function< void(const std::string &)> callback)
configure callbacks for logging error messages
Configuration & RedirectInfoLog(std::function< void(const std::string &)> callback)
configure callbacks for logging info messages
std::string_view LicenseFile() const
Get the License File path.
std::string_view UserHomeDirectory() const
Get the User's Home Directory object.
Configuration & RedirectDebugLog(std::function< void(const std::string &)> callback)
configure callbacks for logging info messages
std::string_view HostName() const
Get the Host's Name.