retdec-cpp
settings.h
Go to the documentation of this file.
1 
8 #ifndef RETDEC_SETTINGS_H
9 #define RETDEC_SETTINGS_H
10 
11 #include <memory>
12 #include <string>
13 
14 namespace retdec {
15 
19 class Settings {
20 public:
23  Settings();
24  Settings(const Settings &other);
25  Settings(Settings &&other);
26  Settings &operator=(const Settings &other);
27  Settings &operator=(Settings &&other);
28  ~Settings();
30 
33  Settings &apiKey(const std::string &apiKey);
34  Settings withApiKey(const std::string &apiKey) const;
35  std::string apiKey() const;
37 
40  Settings &apiUrl(const std::string &apiUrl);
41  Settings withApiUrl(const std::string &apiUrl) const;
42  std::string apiUrl() const;
44 
47  Settings &userAgent(const std::string &userAgent);
48  Settings withUserAgent(const std::string &userAgent) const;
49  std::string userAgent() const;
51 
52 public:
55  static const std::string DefaultApiUrl;
56  static const std::string DefaultApiKey;
57  static const std::string DefaultUserAgent;
59 
60 private:
62  std::string apiUrl_;
63 
65  std::string apiKey_;
66 
68  std::string userAgent_;
69 };
70 
71 } // namespace retdec
72 
73 #endif
static const std::string DefaultApiUrl
Default URL to the API.
Definition: settings.h:55
std::string apiKey() const
Returns the API key.
Definition: settings.cpp:71
The namespace of the library.
Definition: doxygen.h:8
Settings withApiUrl(const std::string &apiUrl) const
Returns a copy of the settings with a new URL to the API.
Definition: settings.cpp:88
Settings()
Constructs a default settings.
Definition: settings.cpp:20
Settings withApiKey(const std::string &apiKey) const
Returns a copy of the settings with a new API key.
Definition: settings.cpp:62
~Settings()
Destructs the settings.
static const std::string DefaultApiKey
Default API key.
Definition: settings.h:56
std::string userAgent() const
Returns the user agent.
Definition: settings.cpp:123
Settings & operator=(const Settings &other)
Copy-assigns the given settings.
Library settings.
Definition: settings.h:19
static const std::string DefaultUserAgent
Default user agent.
Definition: settings.h:57
std::string apiUrl() const
Returns the URL to the API.
Definition: settings.cpp:97
Settings withUserAgent(const std::string &userAgent) const
Returns a copy of the settings with a new user agent.
Definition: settings.cpp:114