| FEAT 3
    Finite Element Analysis Toolbox | 
#include <xml_scanner.hpp>
| Classes | |
| class | MarkupInfo | 
| Markup info class.  More... | |
| Public Member Functions | |
| Scanner (std::istream &stream, int lines_read=0) | |
| Creates a XML scanner for an input stream.  More... | |
| virtual | ~Scanner () | 
| virtual destructor  More... | |
| const std::map< String, String > & | get_cur_attribs () const | 
| int | get_cur_iline () const | 
| const String & | get_cur_name () const | 
| const String & | get_cur_sline () const | 
| bool | is_cur_closed () const | 
| bool | is_cur_markup () const | 
| bool | is_cur_termin () const | 
| void | read_root () | 
| Tries to read the XML root markup.  More... | |
| void | scan () | 
| Scans the stream.  More... | |
| void | scan (std::shared_ptr< MarkupParser > root_parser) | 
| Scans the stream with a given root parser.  More... | |
| void | set_root_parser (std::shared_ptr< MarkupParser > parser) | 
| Sets the root markup parser node.  More... | |
| void | throw_content (const String &msg) const | 
| Throws a ContentError for the current line.  More... | |
| void | throw_grammar (const String &msg) const | 
| Throws a GrammarError for the current line.  More... | |
| void | throw_syntax (const String &msg) const | 
| Throws a SyntaxError for the current line.  More... | |
| Protected Member Functions | |
| void | create_top_parser () | 
| Creates the top parser node.  More... | |
| void | process_content () | 
| Tries to process the current XML content line.  More... | |
| void | process_markup () | 
| Tries to process the current XML markup line.  More... | |
| bool | read_next_line () | 
| Reads the next non-empty line from the stream.  More... | |
| bool | scan_markup () | 
| Tries to interpret the current line as a XML markup line.  More... | |
| Private Attributes | |
| std::map< String, String > | _cur_attribs | 
| specifies the markup attributes of the current line  More... | |
| int | _cur_iline | 
| current line number  More... | |
| bool | _cur_is_closed | 
| specifies whether the markup is closed  More... | |
| bool | _cur_is_markup | 
| specifies whether this line is a markup  More... | |
| bool | _cur_is_termin | 
| specifies whether the markup is a terminator  More... | |
| String | _cur_name | 
| specifies the markup name of the current line  More... | |
| String | _cur_sline | 
| current line string  More... | |
| bool | _have_read_root | 
| specifies whether the root has been read  More... | |
| std::vector< MarkupInfo > | _markups | 
| the markup stack  More... | |
| std::istream & | _stream | 
| the input stream  More... | |
| 
 | inlineexplicit | 
Creates a XML scanner for an input stream.
| [in] | stream | A resident reference to the input stream that is to be read from. | 
| [in] | lines_read | The number of lines already read from the stream. | 
Definition at line 375 of file xml_scanner.hpp.
References _cur_sline, and _markups.
| 
 | inlinevirtual | 
virtual destructor
Definition at line 392 of file xml_scanner.hpp.
| 
 | protected | 
Creates the top parser node.
This function checks whether the attributes match the top parser's requirements and, if so, calls the create() method of the parser.
Definition at line 388 of file xml_scanner.cpp.
References _cur_attribs, _cur_iline, _cur_is_closed, _cur_is_markup, _cur_name, _cur_sline, _markups, throw_grammar(), and XASSERTM.
Referenced by process_markup(), and set_root_parser().
Definition at line 433 of file xml_scanner.hpp.
References _cur_attribs.
Referenced by FEAT::Geometry::MeshFileReader::read_root_markup().
| 
 | inline | 
Definition at line 397 of file xml_scanner.hpp.
References _cur_iline.
| 
 | inline | 
Definition at line 427 of file xml_scanner.hpp.
References _cur_name.
Referenced by FEAT::Geometry::MeshFileReader::read_root_markup().
| 
 | inline | 
Definition at line 403 of file xml_scanner.hpp.
References _cur_sline.
| 
 | inline | 
true, if the current markup line is a closed markup Definition at line 415 of file xml_scanner.hpp.
References _cur_is_closed.
| 
 | inline | 
true, if the current line is a markup line, otherwise false Definition at line 409 of file xml_scanner.hpp.
References _cur_is_markup.
| 
 | inline | 
true, if the current markup line is a terminator Definition at line 421 of file xml_scanner.hpp.
References _cur_is_termin.
| 
 | protected | 
Tries to process the current XML content line.
This function passes the current content line to the top parser.
Definition at line 423 of file xml_scanner.cpp.
References _cur_iline, _cur_sline, _markups, and throw_grammar().
Referenced by scan().
| 
 | protected | 
Tries to process the current XML markup line.
This function passes the current markup line to the top parser and checks whether a new top parser node has to be allocated.
This function throws a Xml::GrammarError if the current markup is not accepted by the parser.
Definition at line 341 of file xml_scanner.cpp.
References _cur_iline, _cur_is_closed, _cur_is_markup, _cur_is_termin, _cur_name, _cur_sline, _markups, create_top_parser(), throw_grammar(), throw_syntax(), and XASSERTM.
Referenced by scan().
| 
 | protected | 
Reads the next non-empty line from the stream.
true, if another non-empty line was read or false, if the end of the stream was reached Definition at line 180 of file xml_scanner.cpp.
References _cur_iline, _cur_sline, _stream, and FEAT::String::trim_me().
Referenced by read_root(), and scan().
| void FEAT::Xml::Scanner::read_root | ( | ) | 
Tries to read the XML root markup.
This function reads the first non-empty line from the input stream and tries to interpret it as a XML markup representing the root markup.
If this function returns without throwing an Xml::SyntaxError, the information about the XML root markup can be read from this object by using the getter functions.
Definition at line 92 of file xml_scanner.cpp.
References _cur_is_closed, _cur_is_termin, _have_read_root, _markups, read_next_line(), scan_markup(), throw_syntax(), and XASSERTM.
Referenced by FEAT::Geometry::MeshFileReader::read_root_markup(), and scan().
| void FEAT::Xml::Scanner::scan | ( | ) | 
Scans the stream.
This function scans the streams and processes all lines until the root markup terminator is found.
Definition at line 137 of file xml_scanner.cpp.
References _cur_iline, _cur_sline, _markups, FEAT::String::ends_with(), process_content(), process_markup(), read_next_line(), scan_markup(), FEAT::String::starts_with(), throw_syntax(), and XASSERTM.
Referenced by scan().
| void FEAT::Xml::Scanner::scan | ( | std::shared_ptr< MarkupParser > | root_parser | ) | 
Scans the stream with a given root parser.
This function effectively just calls the three functions
Definition at line 173 of file xml_scanner.cpp.
References read_root(), scan(), and set_root_parser().
| 
 | protected | 
Tries to interpret the current line as a XML markup line.
This function checks whether the current line seems to be a XML markup line and, if so, tries to decompose it into its parts.
true, if the current line is a valid XML markup line or false, if the current line seems to be a content lineDefinition at line 198 of file xml_scanner.cpp.
References _cur_attribs, _cur_is_closed, _cur_is_markup, _cur_is_termin, _cur_name, _cur_sline, FEAT::String::ends_with(), FEAT::String::pop_back(), FEAT::String::pop_front(), FEAT::String::starts_with(), throw_syntax(), FEAT::String::trim(), and FEAT::String::whitespaces().
Referenced by read_root(), and scan().
| void FEAT::Xml::Scanner::set_root_parser | ( | std::shared_ptr< MarkupParser > | parser | ) | 
Sets the root markup parser node.
This function sets the parser for the root markup.
| [in] | parser | The MarkupParser object responsible for parsing the root node. | 
Definition at line 118 of file xml_scanner.cpp.
References _cur_iline, _cur_name, _have_read_root, _markups, create_top_parser(), and XASSERTM.
Referenced by scan().
| 
 | inline | 
Throws a ContentError for the current line.
| [in] | msg | The error message. | 
Definition at line 515 of file xml_scanner.hpp.
References _cur_iline, and _cur_sline.
Referenced by FEAT::Geometry::MeshFileReader::read_root_markup().
| 
 | inline | 
Throws a GrammarError for the current line.
| [in] | msg | The error message. | 
Definition at line 504 of file xml_scanner.hpp.
References _cur_iline, and _cur_sline.
Referenced by create_top_parser(), process_content(), process_markup(), and FEAT::Geometry::MeshFileReader::read_root_markup().
| 
 | inline | 
Throws a SyntaxError for the current line.
| [in] | msg | The error message. | 
Definition at line 493 of file xml_scanner.hpp.
References _cur_iline, and _cur_sline.
Referenced by process_markup(), read_root(), scan(), and scan_markup().
specifies the markup attributes of the current line
Definition at line 363 of file xml_scanner.hpp.
Referenced by create_top_parser(), get_cur_attribs(), and scan_markup().
| 
 | private | 
current line number
Definition at line 351 of file xml_scanner.hpp.
Referenced by create_top_parser(), get_cur_iline(), process_content(), process_markup(), read_next_line(), scan(), set_root_parser(), throw_content(), throw_grammar(), and throw_syntax().
| 
 | private | 
specifies whether the markup is closed
Definition at line 357 of file xml_scanner.hpp.
Referenced by create_top_parser(), is_cur_closed(), process_markup(), read_root(), and scan_markup().
| 
 | private | 
specifies whether this line is a markup
Definition at line 355 of file xml_scanner.hpp.
Referenced by create_top_parser(), is_cur_markup(), process_markup(), and scan_markup().
| 
 | private | 
specifies whether the markup is a terminator
Definition at line 359 of file xml_scanner.hpp.
Referenced by is_cur_termin(), process_markup(), read_root(), and scan_markup().
| 
 | private | 
specifies the markup name of the current line
Definition at line 361 of file xml_scanner.hpp.
Referenced by create_top_parser(), get_cur_name(), process_markup(), scan_markup(), and set_root_parser().
| 
 | private | 
current line string
Definition at line 353 of file xml_scanner.hpp.
Referenced by Scanner(), create_top_parser(), get_cur_sline(), process_content(), process_markup(), read_next_line(), scan(), scan_markup(), throw_content(), throw_grammar(), and throw_syntax().
| 
 | private | 
specifies whether the root has been read
Definition at line 349 of file xml_scanner.hpp.
Referenced by read_root(), and set_root_parser().
| 
 | private | 
the markup stack
Definition at line 347 of file xml_scanner.hpp.
Referenced by Scanner(), create_top_parser(), process_content(), process_markup(), read_root(), scan(), and set_root_parser().
| 
 | private |