31 std::string
const& path)
33 boost::char_separator<char> sep(
"\t ");
34 boost::tokenizer<boost::char_separator<char>> tokens(line, sep);
35 auto tok_it(tokens.begin());
38 if (*tok_it !=
"PROPERTY")
40 ERR(
"Expected PROPERTY keyword but '{:s}' found.", tok_it->c_str());
41 throw std::runtime_error(
42 "In parseGocadPropertyMetaData() expected PROPERTY keyword not "
52 while (tok_it != tokens.end())
59 auto checkPropertyID =
60 [](boost::tokenizer<boost::char_separator<char>>::iterator
const&
66 throw std::runtime_error(
67 "parseGocadPropertyMetaData(): id mismatch.");
71 while (std::getline(in, line))
77 if (line.back() ==
'\r')
83 tok_it = tokens.begin();
85 if (*tok_it ==
"PROP_FILE")
87 checkPropertyID(++tok_it, prop);
89 std::string tmp(*tok_it);
91 while (tok_it != tokens.end())
97 if (tmp.front() ==
' ')
99 tmp.erase(tmp.begin());
105 if (*tok_it ==
"PROPERTY_CLASS")
107 checkPropertyID(++tok_it, prop);
112 if (*tok_it ==
"PROPERTY_SUBCLASS")
114 checkPropertyID(++tok_it, prop);
116 if (*tok_it !=
"QUANTITY" && *tok_it !=
"ENUM")
118 ERR(
"Expected keywords QUANTITY or ENUM, but found '{:s}'.",
120 throw std::runtime_error(
121 "parseGocadPropertyMetaData(): Expected keywords QUANTITY "
122 "or ENUM, but found '" +
125 if (*tok_it ==
"QUANTITY")
132 if (*tok_it ==
"PROP_UNIT" || *tok_it ==
"PROP_ORIGINAL_UNIT")
134 checkPropertyID(++tok_it, prop);
139 if (*tok_it ==
"PROP_NO_DATA_VALUE")
141 checkPropertyID(++tok_it, prop);