parser.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 #ifndef SDF_PARSER_HH
00018 #define SDF_PARSER_HH
00019 
00020 #include <string>
00021 #include <tinyxml.h>
00022 
00023 #include "sdf/interface/SDF.hh"
00024 
00025 namespace sdf
00026 {
00028   bool init( SDFPtr _sdf );
00029 
00030   // \brief Initialize the SDF interface using a file
00031   bool initFile(const std::string &_filename, SDFPtr _sdf);
00032 
00033   // \brief Initialize and SDFElement interface using a file
00034   bool initFile(const std::string &_filename, ElementPtr &_sdf);
00035 
00036   // \brief Initialize the SDF interface using a string
00037   bool initString(const std::string &_xmlString, SDFPtr &_sdf);
00038 
00039   // \brief Initialize the SDF interface using a TinyXML document
00040   bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr &_sdf);
00041 
00042   // \brief Initialize and SDF Element using a TinyXML document
00043   bool initDoc(TiXmlDocument *_xmlDoc, ElementPtr &_sdf);
00044 
00045   // \brief For internal use only. Do not use this function.
00046   bool initXml(TiXmlElement *_xml, ElementPtr &_sdf);
00047 
00049   bool readFile(const std::string &_filename, SDFPtr &_sdf);
00050 
00052   bool readString(const std::string &_xmlString, SDFPtr &_sdf);
00053 
00054   bool readString(const std::string &_xmlString, ElementPtr &_sdf);
00055 
00057   bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr &_sdf);
00058 
00059   bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr &_sdf);
00060 
00061   // \brief For internal use only. Do not use this function.
00062   bool readXml(TiXmlElement *_xml, ElementPtr &_sdf);
00063 
00064   void copyChildren( ElementPtr &_sdf, TiXmlElement *_xml);
00065 }
00066 
00067 #endif