Flow123d
JS_before_hm-2203-gd2ee21200
|
Go to the documentation of this file.
23 #include "yaml-cpp/yaml.h"
33 nodes_.push_back( YAML::Load( in ) );
53 ASSERT(
head().IsSequence()).error(
"Head node must be of type Array.");
55 if ( index >=
head().size() )
return false;
56 path_.push_back( make_pair( index,
string(
"") ) );
64 ASSERT(
head().IsMap()).error(
"Head node must be of type Record.");
67 std::set<std::string> key_list;
71 path_.push_back( make_pair( index, key) );
81 if (
path_.size() > 1) {
89 return head().IsNull();
94 if (
head().IsScalar()) {
96 return head().as<
bool>();
97 }
catch (YAML::Exception) {
98 THROW( ReaderInternalBase::ExcInputError() );
101 THROW( ReaderInternalBase::ExcInputError() );
108 if (
head().IsScalar()) {
110 return head().as<std::int64_t>();
111 }
catch (YAML::Exception) {
112 THROW( ReaderInternalBase::ExcInputError() );
115 THROW( ReaderInternalBase::ExcInputError() );
122 if (
head().IsScalar()) {
124 return head().as<
double>();
125 }
catch (YAML::Exception) {
126 THROW( ReaderInternalBase::ExcInputError() );
129 THROW( ReaderInternalBase::ExcInputError() );
136 if (
head().IsScalar()) {
138 return head().as<std::string>();
139 }
catch (YAML::Exception) {
140 THROW( ReaderInternalBase::ExcInputError() );
143 THROW( ReaderInternalBase::ExcInputError() );
150 switch (
head().Type()) {
161 if (
head().IsMap() ) {
162 for (YAML::const_iterator
it=
head().begin();
it!=
head().end(); ++
it) {
163 std::string key =
it->first.as<std::string>();
165 bool key_inserted = keys_list.insert( key ).second;
167 THROW( ReaderInternalBase::ExcDuplicitTag()
168 << ReaderInternalBase::EI_Tag(key)
180 if (
head().IsSequence()) {
181 return head().size();
188 return head().IsMap();
193 return head().IsSequence();
210 std::string tag =
head().Tag();
211 if ( (tag ==
"?") || (tag.size() == 0) ) {
214 return tag.erase(0, 1);
221 if (
head().IsNull() ) {
224 }
else if (
head().IsScalar() ) {
227 return (
head().as<std::string>() ==
"");
228 }
catch (YAML::Exception) {
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Global macros to enhance readability and debugging, general constants.