FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Xml::DumpParser Class Reference

Dump XML markup parser class. More...

#include <xml_scanner.hpp>

Inheritance diagram for FEAT::Xml::DumpParser:
FEAT::Xml::MarkupParser

Public Member Functions

 DumpParser (const String &name, bool lines=true, std::size_t indent=0)
 
virtual bool attribs (std::map< String, bool > &) const override
 Specifies the mandatory and optional attributes. More...
 
virtual void close (int iline, const String &) override
 Closes this markup parser node. More...
 
virtual bool content (int iline, const String &sline) override
 Called to process a content line. More...
 
virtual void create (int iline, const String &, const String &, const std::map< String, String > &attrs, bool closed) override
 Creates this markup parser node. More...
 
virtual std::shared_ptr< MarkupParsermarkup (int, const String &, const String &name) override
 Called to process a child markup node. More...
 

Protected Attributes

std::size_t _indent
 indentation for this parser node More...
 
bool _lines
 specifies whether to write line numbers More...
 
String _name
 the name of this markup parser node More...
 

Detailed Description

Dump XML markup parser class.

This class implements the MarkupParser interface and simply 'dumps' the parsed XML data to std::cout. This class may be somewhat useful for debugging purposes.

Author
Peter Zajac

Definition at line 279 of file xml_scanner.hpp.

Constructor & Destructor Documentation

◆ DumpParser()

FEAT::Xml::DumpParser::DumpParser ( const String name,
bool  lines = true,
std::size_t  indent = 0 
)
explicit

Definition at line 46 of file xml_scanner.cpp.

Member Function Documentation

◆ attribs()

bool FEAT::Xml::DumpParser::attribs ( std::map< String, bool > &  attrs) const
overridevirtual

Specifies the mandatory and optional attributes.

Parameters
[out]attrsA transient reference to a map of all supported attribute key names. The second component specifies whether the attribute is mandatory (true) or optional (false).
Returns
true, if the scanner should check for valid arguments, otherwise false.

Implements FEAT::Xml::MarkupParser.

Definition at line 51 of file xml_scanner.cpp.

◆ close()

void FEAT::Xml::DumpParser::close ( int  iline,
const String sline 
)
overridevirtual

Closes this markup parser node.

Parameters
[in]ilineThe line number of the markup terminator in the XML file.
[in]slineThe line string of the markup in the XML file.

Implements FEAT::Xml::MarkupParser.

Definition at line 68 of file xml_scanner.cpp.

References _indent, _lines, and _name.

◆ content()

bool FEAT::Xml::DumpParser::content ( int  iline,
const String sline 
)
overridevirtual

Called to process a content line.

This function is called by the XML scanner when a content line inside this markup parser node is detected.

Parameters
[in]ilineThe line number of the content line in the XML file.
[in]slineThe line string of the content line in the XML file.
Returns
true, if the content line was parsed successfully, otherwise false.
Note
Returning false will cause the scanner to throw a Xml::GammarError.

Implements FEAT::Xml::MarkupParser.

Definition at line 80 of file xml_scanner.cpp.

References _indent, and _lines.

◆ create()

void FEAT::Xml::DumpParser::create ( int  iline,
const String sline,
const String name,
const std::map< String, String > &  attrs,
bool  closed 
)
overridevirtual

Creates this markup parser node.

Parameters
[in]ilineThe line number of the markup in the XML file.
[in]slineThe line string of the markup in the XML file.
[in]nameThe name of the markup.
[in]attrsA transient reference to a map of all attributes of the markup.
[in]closedSpecifies whether the markup is closed.

Implements FEAT::Xml::MarkupParser.

Definition at line 56 of file xml_scanner.cpp.

References _indent, and _lines.

◆ markup()

std::shared_ptr< MarkupParser > FEAT::Xml::DumpParser::markup ( int  iline,
const String sline,
const String name 
)
overridevirtual

Called to process a child markup node.

This function is called by the XML scanner when a child markup inside this markup parser node is detected.

Parameters
[in]ilineThe line number of the child markup in the XML file.
[in]slineThe line string of the child markup in the XML file.
[in]nameThe markup name of the child markup.
Returns
A new MarkupParser object if the markup is a valid child or nullptr if a child markup with this name is not supported.
Note
Returning nullptr will cause the scanner to throw a Xml::GammarError.

Implements FEAT::Xml::MarkupParser.

Definition at line 75 of file xml_scanner.cpp.

References _indent, and _lines.

Member Data Documentation

◆ _indent

std::size_t FEAT::Xml::DumpParser::_indent
protected

indentation for this parser node

Definition at line 288 of file xml_scanner.hpp.

Referenced by close(), content(), create(), and markup().

◆ _lines

bool FEAT::Xml::DumpParser::_lines
protected

specifies whether to write line numbers

Definition at line 286 of file xml_scanner.hpp.

Referenced by close(), content(), create(), and markup().

◆ _name

String FEAT::Xml::DumpParser::_name
protected

the name of this markup parser node

Definition at line 284 of file xml_scanner.hpp.

Referenced by close().


The documentation for this class was generated from the following files: