Gazebo Fuel_tools

API Reference

7.3.1
gz/fuel_tools/JSONParser.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_JSONPARSER_HH_
19 #define GZ_FUEL_TOOLS_JSONPARSER_HH_
20 
21 #include <map>
22 #include <string>
23 #include <utility>
24 #include <vector>
25 
30 
31 namespace Json
32 {
33  class Value;
34 }
35 
36 namespace ignition
37 {
38  namespace fuel_tools
39  {
40  class ServerConfig;
41 
43  class IGNITION_FUEL_TOOLS_VISIBLE JSONParser
44  {
50  public: static ModelIdentifier ParseModel(
51  const std::string &_json,
52  const ServerConfig &_server);
53 
59  public: static WorldIdentifier ParseWorld(
60  const std::string &_json,
61  const ServerConfig &_server);
62 
68  public: static std::vector<ModelIdentifier> ParseModels(
69  const std::string &_json,
70  const ServerConfig &_server);
71 
77  public: static std::vector<WorldIdentifier> ParseWorlds(
78  const std::string &_json,
79  const ServerConfig &_server);
80 
84  public: static std::string BuildModel(ModelIter _modelIt);
85 
89  public: static std::string BuildWorld(WorldIter _worldIt);
90 
97  public: static bool ParseLicenses(const std::string &_json,
99 
104  private: static bool ParseModelImpl(
105  const Json::Value &_json, ModelIdentifier &_model);
106 
111  private: static bool ParseWorldImpl(
112  const Json::Value &_json, WorldIdentifier &_world);
113 
117  private: static std::vector<std::string> ParseTags(
118  const Json::Value &_json);
119  };
120  }
121 }
122 
123 #endif
static bool ParseLicenses(const std::string &_json, std::map< std::string, unsigned int > &_licenses)
Parse a license array JSON string and return a map of licenses.
class for iterating through models
Definition: gz/fuel_tools/ModelIter.hh:43
STL class.
static std::vector< WorldIdentifier > ParseWorlds(const std::string &_json, const ServerConfig &_server)
Parse a world array JSON string and return a world iterator.
STL class.
static std::string BuildWorld(WorldIter _worldIt)
Build a world iterator from a JSON string.
Defines how to identify a model.
Definition: gz/fuel_tools/ModelIdentifier.hh:45
A helper class for making REST requests.
Definition: gz/fuel_tools/JSONParser.hh:43
Definition: gz/fuel_tools/JSONParser.hh:31
class for iterating through worlds
Definition: gz/fuel_tools/WorldIter.hh:42
STL class.
Describes options needed for a server.
Definition: gz/fuel_tools/ClientConfig.hh:47
static std::vector< ModelIdentifier > ParseModels(const std::string &_json, const ServerConfig &_server)
Parse a model array JSON string and return a model iterator.
Defines how to identify a world.
Definition: gz/fuel_tools/WorldIdentifier.hh:42
static std::string BuildModel(ModelIter _modelIt)
Build a model iterator from a JSON string.
static WorldIdentifier ParseWorld(const std::string &_json, const ServerConfig &_server)
Parse a world JSON string and return a world identifier.
static ModelIdentifier ParseModel(const std::string &_json, const ServerConfig &_server)
Parse a model JSON string and return a model identifier.