Go to the documentation of this file.
33 #include <yaml-cpp/yaml.h>
44 std::ifstream in(qPrintable(filename));
50 std::stringstream ss(data.toStdString());
59 yaml_node = YAML::Load(in);
64 catch (YAML::ParserException& ex)
73 switch (yaml_node.Type())
75 case YAML::NodeType::Map:
77 for (YAML::const_iterator it = yaml_node.begin(); it != yaml_node.end(); ++it)
80 key = it->first.as<std::string>();
81 Config child =
config.mapMakeChild(QString::fromStdString(key));
86 case YAML::NodeType::Sequence:
88 for (YAML::const_iterator it = yaml_node.begin(); it != yaml_node.end(); ++it)
95 case YAML::NodeType::Scalar:
98 s = yaml_node.as<std::string>();
99 config.setValue(QString::fromStdString(
s));
102 case YAML::NodeType::Null:
bool error()
Return true if the latest readFile() or readString() call had an error.
void readString(Config &config, const QString &data, const QString &filename="data string")
Read config data from a string. This potentially changes the return value sof error(),...
QString errorMessage()
Return an error message if the latest read call had an error, or the empty string if not.
void readStream(Config &config, std::istream &in, const QString &filename="data stream")
Read config data from a std::istream. This potentially changes the return value sof error(),...
void readFile(Config &config, const QString &filename)
Read config data from a file. This potentially changes the return value sof error(),...
YamlConfigReader()
Constructor. Object begins in a no-error state.
void readYamlNode(Config &config, const YAML::Node &yaml_node)
Configuration data storage class.
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:10