4 #include <simo/geom/geometry.hpp> 5 #include <simo/exceptions.hpp> 6 #include <simo/io/wkt_parser.hpp> 7 #include <simo/io/wkt_lexer.hpp> 29 : m_parser(ParseAlloc(malloc))
36 ParseFree(m_parser, free);
53 static char WKT_TRACE_PREFIX[] =
"[shapes] ";
54 ParseTrace(stdout, WKT_TRACE_PREFIX);
58 int token = lexer.
scan();
60 std::cout <<
"--> " << lexer.
get_token() <<
'\n';
62 if (token == WKT_END_OF_INPUT)
67 if (token == WKT_PARSE_ERROR)
74 Parse(m_parser, token, std::stod(lexer.
get_token()), &result);
78 Parse(m_parser, token, 0, &result);
81 if (result.parser_error)
87 Parse(m_parser, 0, 0, &result);
88 if (result.parser_error)
97 void* m_parser =
nullptr;
wkt_result read(const std::string &wkt)
parse the given wkt string
int scan()
scan the next token
A Well-known text (WKT) markup language parser results.
Exception thrown when an error has been found while parsing.
std::string get_token() const
returns the current token string
size_t get_position()
returns the current reading position
wkt_reader()
creates a wkt reader