12 #include <boost/algorithm/string/trim.hpp>
13 #include <boost/tokenizer.hpp>
25 std::size_t
const start = str.find_first_of(
'\"');
26 if (start != std::string::npos)
28 std::size_t
const end = str.find_last_of(
'\"');
29 name = str.substr(start + 1, end - start - 1);
33 name = str.substr(str.find_first_of(
' '), str.length());
42 boost::char_separator<char> sep(
"-;| \"");
44 std::getline(in, line);
45 boost::tokenizer<boost::char_separator<char>> tok(line, sep);
55 while (std::getline(in, line))
59 if (*it ==
"AXIS_NAME")
68 else if (*it ==
"AXIS_UNIT")
77 else if (*it ==
"ZPOSITIVE")
89 else if (*it ==
"PROJECTION")
93 else if (*it ==
"DATUM")
97 else if (*it ==
"END_ORIGINAL_COORDINATE_SYSTEM")
103 WARN(
"CoordinateSystem::parse() - Unknown keyword found: {:s}",
107 ERR(
"Error: Unexpected end of file.");
113 os <<
"Gocad CoordinateSystem " <<
c.name
114 <<
"\nAxis names: " <<
c.axis_name_u <<
", " <<
c.axis_name_v <<
", "
115 <<
c.axis_name_w <<
"\nAxis units: " <<
c.axis_unit_u <<
", "
116 <<
c.axis_unit_v <<
", " <<
c.axis_unit_w <<
"\nZ-orientation: ";
void ERR(char const *fmt, Args const &... args)
void WARN(char const *fmt, Args const &... args)
bool parse(std::istream &in)
void trim(std::string &str, char ch)
std::ostream & operator<<(std::ostream &os, CoordinateSystem const &c)
std::string parseName(std::string const &str)