xml_utils.h
Go to the documentation of this file.
00001 /*+-------------------------------------------------------------------------+
00002   |                       MultiVehicle simulator (libmvsim)                 |
00003   |                                                                         |
00004   | Copyright (C) 2014  Jose Luis Blanco Claraco (University of Almeria)    |
00005   | Copyright (C) 2017  Borys Tymchenko (Odessa Polytechnic University)     |
00006   | Distributed under GNU General Public License version 3                  |
00007   |   See <http://www.gnu.org/licenses/>                                    |
00008   +-------------------------------------------------------------------------+ */
00009 #pragma once
00010 
00011 #include <rapidxml.hpp>
00012 
00013 #include <map>
00014 #include <string>
00015 
00016 // Fwd decl:
00017 namespace mrpt
00018 {
00019 namespace math
00020 {
00021 class TPolygon2D;
00022 }
00023 }
00024 
00025 namespace mvsim
00026 {
00042 struct TParamEntry
00043 {
00044         const char* frmt;
00045         void* val;
00046 
00047         TParamEntry() : frmt(NULL), val(NULL) {}
00048         TParamEntry(const char* frmt_, void* val_) : frmt(frmt_), val(val_) {}
00053         void parse(
00054                 const std::string& str, const std::string& varName,
00055                 const char* function_name_context = "") const;
00056 };
00057 
00058 void parse_xmlnode_attribs(
00059         const rapidxml::xml_node<char>& xml_node,
00060         const std::map<std::string, TParamEntry>& params,
00061         const char* function_name_context = "");
00062 
00067 bool parse_xmlnode_as_param(
00068         const rapidxml::xml_node<char>& xml_node,
00069         const std::map<std::string, TParamEntry>& params,
00070         const char* function_name_context = "");
00071 
00074 void parse_xmlnode_children_as_param(
00075         const rapidxml::xml_node<char>& xml_node,
00076         const std::map<std::string, TParamEntry>& params,
00077         const char* function_name_context = "");
00078 
00079 template <class NODE_LIST>
00080 void parse_xmlnodelist_children_as_param(
00081         NODE_LIST& lst_nodes, const std::map<std::string, TParamEntry>& params,
00082         const char* function_name_context = "")
00083 {
00084         for (typename NODE_LIST::iterator it = lst_nodes.begin();
00085                  it != lst_nodes.end(); ++it)
00086                 parse_xmlnode_children_as_param(**it, params, function_name_context);
00087 }
00088 
00089 // Bits:
00090 
00096 vec3 parseXYPHI(
00097         const std::string& s, bool allow_missing_angle = false,
00098         double default_angle_radians = 0.0);
00099 
00104 void parse_xmlnode_shape(
00105         const rapidxml::xml_node<char>& xml_node, mrpt::math::TPolygon2D& out_poly,
00106         const char* function_name_context = "");
00107 }


mvsim
Author(s):
autogenerated on Thu Jun 6 2019 22:08:35