XMLClassesRegistry.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 namespace mvsim
00017 {
00020 class XmlClassesRegistry
00021 {
00022    private:
00023         const std::string m_tagname;  
00024         struct TXMLData
00025         {
00026                 rapidxml::xml_document<>* xml_doc;
00027                 std::string* xml_data;  // Must be kept alloc'ed during the entire life
00028                                                                 // of xml_doc!!
00029 
00030                 TXMLData() : xml_doc(NULL), xml_data(NULL) {}
00031                 ~TXMLData()
00032                 {
00033                         if (xml_doc) delete xml_doc;
00034                         if (xml_data) delete xml_data;
00035                 }
00036         };
00037         std::map<std::string, TXMLData> m_classes;
00038 
00039    public:
00042         XmlClassesRegistry(const std::string& xml_class_tag)
00043                 : m_tagname(xml_class_tag)
00044         {
00045         }
00046 
00048         const rapidxml::xml_node<char>* get(
00049                 const std::string& xml_node_class) const;
00050 
00052         void add(const std::string& input_xml_node_class);
00053 
00054 };  // end class
00055 }


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