Gazebo Fuel_tools

API Reference

8.1.0
gz/fuel_tools/ClientConfig.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_FUEL_TOOLS_CLIENTCONFIG_HH_
19 #define GZ_FUEL_TOOLS_CLIENTCONFIG_HH_
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/common/URI.hh>
26 
27 #include "gz/fuel_tools/Export.hh"
28 
29 #ifdef _WIN32
30 // Disable warning C4251 which is triggered by
31 // std::unique_ptr
32 #pragma warning(push)
33 #pragma warning(disable: 4251)
34 #endif
35 
36 namespace gz
37 {
38  namespace fuel_tools
39  {
41  class ServerConfigPrivate;
42 
44  class ClientConfigPrivate;
45 
47  class GZ_FUEL_TOOLS_VISIBLE ServerConfig
48  {
50  public: ServerConfig();
51 
54  public: ServerConfig(const ServerConfig &_orig);
55 
58  public: ServerConfig &operator=(const ServerConfig &_orig);
59 
61  public: ~ServerConfig();
62 
66  public: void Clear();
67 
70  public: common::URI Url() const;
71 
74  public: void SetUrl(const common::URI &_url);
75 
78  public: std::string ApiKey() const;
79 
82  public: void SetApiKey(const std::string &_key);
83 
86  public: std::string Version() const;
87 
90  public: void SetVersion(const std::string &_version);
91 
95  public: std::string AsString(const std::string &_prefix = "") const;
96 
101  public: std::string AsPrettyString(const std::string &_prefix = "") const;
102 
104  private: std::unique_ptr<ServerConfigPrivate> dataPtr;
105  };
106 
109  class GZ_FUEL_TOOLS_VISIBLE ClientConfig
110  {
112  public: ClientConfig();
113 
116  public: ClientConfig(const ClientConfig &_copy);
117 
120  public: ClientConfig &operator=(const ClientConfig &_copy);
121 
123  public: ~ClientConfig();
124 
128  public: void Clear();
129 
132  public: void SetUserAgent(const std::string &_agent);
133 
136  public: const std::string &UserAgent() const;
137 
142  public: bool LoadConfig(const std::string &_file);
143 
148  public: std::string ConfigPath() const;
149 
152  public: std::vector<ServerConfig> Servers() const;
153 
156  public: std::vector<ServerConfig> & MutableServers() const;
157 
160  public: void AddServer(const ServerConfig &_srv);
161 
164  public: std::string CacheLocation() const;
165 
168  public: void SetCacheLocation(const std::string &_path);
169 
173  public: std::string AsString(const std::string &_prefix = "") const;
174 
176  private: std::unique_ptr<ClientConfigPrivate> dataPtr;
177  };
178  }
179 }
180 
181 #ifdef _MSC_VER
182 #pragma warning(pop)
183 #endif
184 
185 #endif