All Classes Namespaces Files Functions Variables Typedefs Friends Macros Modules
parser.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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 #ifndef _SDF_PARSER_HH_
18 #define _SDF_PARSER_HH_
19 
20 #include <tinyxml.h>
21 #include <string>
22 
23 #include "sdf/SDFImpl.hh"
24 #include "sdf/system_util.hh"
25 
28 namespace sdf
29 {
32  bool init(SDFPtr _sdf);
33 
34  // \brief Initialize the SDF interface using a file
36  bool initFile(const std::string &_filename, SDFPtr _sdf);
37 
38  // \brief Initialize and SDFElement interface using a file
40  bool initFile(const std::string &_filename, ElementPtr _sdf);
41 
42  // \brief Initialize the SDF interface using a string
44  bool initString(const std::string &_xmlString, SDFPtr _sdf);
45 
46  // \brief Initialize the SDF interface using a TinyXML document
48  bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf);
49 
50  // \brief Initialize and SDF Element using a TinyXML document
52  bool initDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf);
53 
54  // \brief For internal use only. Do not use this function.
56  bool initXml(TiXmlElement *_xml, ElementPtr _sdf);
57 
60  bool readFile(const std::string &_filename, SDFPtr _sdf);
61 
64  bool readString(const std::string &_xmlString, SDFPtr _sdf);
65 
67  bool readString(const std::string &_xmlString, ElementPtr _sdf);
68 
71  bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, const std::string &_source);
72 
74  bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf,
75  const std::string &_source);
76 
77  // \brief For internal use only. Do not use this function.
79  bool readXml(TiXmlElement *_xml, ElementPtr _sdf);
80 
82  void copyChildren(ElementPtr _sdf, TiXmlElement *_xml);
83 
85  void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF);
86 }
87 #endif
SDFORMAT_VISIBLE bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, const std::string &_source)
Populate the SDF values from a TinyXML document.
Element * ElementPtr
Definition: SDFImpl.hh:42
SDFORMAT_VISIBLE bool readFile(const std::string &_filename, SDFPtr _sdf)
Populate the SDF values from a file.
SDFORMAT_VISIBLE bool init(SDFPtr _sdf)
Init based on the installed sdf_format.xml file.
SDF * SDFPtr
Definition: SDFImpl.hh:38
SDFORMAT_VISIBLE bool initString(const std::string &_xmlString, SDFPtr _sdf)
SDFORMAT_VISIBLE bool initFile(const std::string &_filename, SDFPtr _sdf)
SDFORMAT_VISIBLE bool readString(const std::string &_xmlString, SDFPtr _sdf)
Populate the SDF values from a string.
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
SDFORMAT_VISIBLE void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF)
namespace for Simulation Description Format parser
Definition: Console.hh:29
SDFORMAT_VISIBLE void copyChildren(ElementPtr _sdf, TiXmlElement *_xml)
SDFORMAT_VISIBLE bool readXml(TiXmlElement *_xml, ElementPtr _sdf)
SDFORMAT_VISIBLE bool initXml(TiXmlElement *_xml, ElementPtr _sdf)
SDFORMAT_VISIBLE bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf)