42 std::string path = file_name;
43 std::ifstream fin(path.c_str());
46 throw ParserException(
"Failed to load '"+ file_name +
"', no such file!");
49 #ifdef HAVE_NEW_YAMLCPP 50 YAML::Node doc = YAML::Load(fin);
52 YAML::Parser parser(fin);
54 parser.GetNextDocument(doc);
58 #ifndef HAVE_NEW_YAMLCPP 59 base_node->
file_row = doc.GetMark().line;
73 if(node.Type() == YAML::NodeType::Scalar)
81 #ifndef HAVE_NEW_YAMLCPP 82 new_node->
file_row = node.GetMark().line;
87 else if(node.Type() == YAML::NodeType::Sequence)
89 for(
unsigned int i = 0 ; i < node.size() ; i++)
94 else if(node.Type() == YAML::NodeType::Map)
97 #ifdef HAVE_NEW_YAMLCPP 98 for(YAML::const_iterator it = node.begin() ; it != node.end() ; it++)
100 for(YAML::Iterator it = node.begin() ; it != node.end() ; it++)
104 #ifdef HAVE_NEW_YAMLCPP 111 #ifndef HAVE_NEW_YAMLCPP 112 new_node->
file_row = node.GetMark().line;
117 std::string file_name;
118 #ifdef HAVE_NEW_YAMLCPP 119 it->second >> file_name;
121 it.second() >> file_name;
124 std::string(
"/resources/") + file_name;
125 std::ifstream fin(path.c_str());
130 std::string(
"/") + file_name;
131 fin.open(path.c_str());
137 #ifdef HAVE_NEW_YAMLCPP 138 YAML::Node doc = YAML::Load(fin);
140 YAML::Parser parser(fin);
142 parser.GetNextDocument(doc);
145 #ifndef HAVE_NEW_YAMLCPP 146 new_node->
file_row = doc.GetMark().line;
153 #ifdef HAVE_NEW_YAMLCPP std::string tag
The node value (if it not a tag node)
The main namespace for STDR GUI XML parser.
std::string value
The node children.
YamlParser(void)
Default constructor.
ROSLIB_DECL std::string getPath(const std::string &package_name)
static void parse(std::string file_name, Node *n)
Private function that initiates the parsing of an xml file.
std::string extractDirname(std::string s)
Extracts the directory from an absolute path. It does the same functionality as libgen's dirname but ...
Implements the main functionalities of the stdr parser tree.
std::string file_origin
Row in the original file.
static void parseLow(const YAML::Node &node, Node *n)
Low-level recursive function for parsing the yaml file.
std::vector< Node * > elements
File it was into.
Provides a parser exception. Publicly inherits from std::runtime_error. Used in robot handler...