winIDEA SDK
Loading...
Searching...
No Matches
isys::CXMLEmitter Class Reference

This class serializes test specification objects to XML format. More...

#include <CXMLEmitter.h>

Inheritance diagram for isys::CXMLEmitter:
isys::IEmitter

Public Types

enum  EObjectType
 This enum defines which type of object will be serialized. More...
enum  EYamlStyle {
  EYAML_ANY_STYLE , EYAML_FLOW_STYLE ,
  EYAML_BLOCK_STYLE
}
 Enumeration of YAML styles. More...

Public Member Functions

 CXMLEmitter (isys::ICStreamSPtr fileStream)
 Creates emitter to write data to the given stream.
 CXMLEmitter (std::ostream &ostr)
void endDocument (bool implicit) override
 see IEmitter.h
void endNode (const std::string &nodeName)
 This method is specific to XML.
void endStream () override
 see IEmitter.h
virtual std::string escapeSpecialChars (const std::string &data) override
 Escapes predefined entities in XML.
void flush () override
virtual std::string getIndent ()
 Returns indentation string added to each line of output.
virtual int getLineNumber ()
 This method provides information about current line being written to the file.
virtual void getRow (iconnect::StrVector &row, int rowIndex)
 This method returns row for the given index.
void mapEnd () override
void mapStart (IEmitter::EYamlStyle style=IEmitter::EYAML_ANY_STYLE, bool isAllowArbitraryKeyString=false) override
void sequenceEnd () override
void sequenceStart (IEmitter::EYamlStyle style=IEmitter::EYAML_ANY_STYLE) override
virtual void setIndent (const std::string &indent)
 Sets indentation string added to each line of output.
virtual void setLineNumber (int lineNumber)
 Can be used to set current line number in cases, where emitter does not start at the beginning of the stream, or to disable line counting by setting 'lineNumber' to LINE_NUM_NOT_SET.
void startDocument (bool implicit) override
 see IEmitter.h
void startNode (const std::string &nodeName)
 This method is specific to XML.
void startNode (const std::string &nodeName, const std::map< std::string, std::string > attributes)
void startStream () override
 see IEmitter.h
void startStream (const std::string &userData) override
 Use this method to add your specific data immediately after the first line.
virtual void writeMapEnd ()
void writeMappingPair (const CYAMLObject &mappingKey, const CYAMLObject &yamlObject) override
void writeMappingPair (const std::string &mappingKey, bool value) override
void writeMappingPair (const std::string &mappingKey, const CYAMLObject &yamlObject) override
void writeMappingPair (const std::string &mappingKey, const std::string &value) override
void writeMappingPair (const std::string &mappingKey, double value) override
void writeMappingPair (const std::string &mappingKey, int64_t value) override
void writeMappingPair (const std::string &mappingKey, uint64_t value) override
virtual void writeSequenceEnd ()
void writeString (const std::string &data) override
void writeText (const std::string &text) override
virtual ~CXMLEmitter ()=default

Detailed Description

This class serializes test specification objects to XML format.

See also
isys::IEmitter

Member Enumeration Documentation

◆ EObjectType

This enum defines which type of object will be serialized.

It is use only by some emitters, because mapping from hierarchical to table structure depends on object being serialized, this enum is used to select the right mapping.

◆ EYamlStyle

Enumeration of YAML styles.

Enumerator
EYAML_ANY_STYLE 

any style is allowed

EYAML_FLOW_STYLE 

uses [] for sequences, {} for maps

EYAML_BLOCK_STYLE 

moves to next line

Constructor & Destructor Documentation

◆ CXMLEmitter() [1/2]

isys::CXMLEmitter::CXMLEmitter ( isys::ICStreamSPtr fileStream)

Creates emitter to write data to the given stream.

Since
9.12.288

◆ CXMLEmitter() [2/2]

isys::CXMLEmitter::CXMLEmitter ( std::ostream & ostr)
Since
9.12.288

◆ ~CXMLEmitter()

virtual isys::CXMLEmitter::~CXMLEmitter ( )
virtualdefault
Since
9.12.288

Member Function Documentation

◆ endDocument()

void isys::CXMLEmitter::endDocument ( bool implicit)
overridevirtual

see IEmitter.h

Since
9.12.288

Implements isys::IEmitter.

◆ endNode()

void isys::CXMLEmitter::endNode ( const std::string & nodeName)

This method is specific to XML.

Custom node can be closed.

Since
9.12.288

◆ endStream()

void isys::CXMLEmitter::endStream ( )
overridevirtual

see IEmitter.h

Since
9.12.288

Implements isys::IEmitter.

◆ escapeSpecialChars()

virtual std::string isys::CXMLEmitter::escapeSpecialChars ( const std::string & data)
overridevirtual

Escapes predefined entities in XML.

See http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

Since
9.12.288

Implements isys::IEmitter.

◆ flush()

void isys::CXMLEmitter::flush ( )
overridevirtual
Since
9.12.288

Implements isys::IEmitter.

◆ getIndent()

virtual std::string isys::IEmitter::getIndent ( )
virtualinherited

Returns indentation string added to each line of output.

Since
9.12.288

◆ getLineNumber()

virtual int isys::IEmitter::getLineNumber ( )
virtualinherited

This method provides information about current line being written to the file.

Not all emitters may provide this information. If emitter does not keep track of line numbers, this method should return LINE_NUM_NOT_SET. Emitter may return the number of all lines (for example CCSVEmitter).

Since
9.12.288

◆ getRow()

virtual void isys::IEmitter::getRow ( iconnect::StrVector & row,
int rowIndex )
virtualinherited

This method returns row for the given index.

Not all emitters may implement this method - an exception is throw in such case.

Since
9.12.288

◆ mapEnd()

void isys::CXMLEmitter::mapEnd ( )
overridevirtual
Since
9.12.288

Implements isys::IEmitter.

◆ mapStart()

void isys::CXMLEmitter::mapStart ( IEmitter::EYamlStyle style = IEmitter::EYAML_ANY_STYLE,
bool isAllowArbitraryKeyString = false )
overridevirtual
Since
9.12.288

Implements isys::IEmitter.

◆ sequenceEnd()

void isys::CXMLEmitter::sequenceEnd ( )
overridevirtual
Since
9.12.288

Implements isys::IEmitter.

◆ sequenceStart()

void isys::CXMLEmitter::sequenceStart ( IEmitter::EYamlStyle style = IEmitter::EYAML_ANY_STYLE)
overridevirtual
Since
9.12.288

Implements isys::IEmitter.

◆ setIndent()

virtual void isys::IEmitter::setIndent ( const std::string & indent)
virtualinherited

Sets indentation string added to each line of output.

Since
9.12.288

◆ setLineNumber()

virtual void isys::IEmitter::setLineNumber ( int lineNumber)
virtualinherited

Can be used to set current line number in cases, where emitter does not start at the beginning of the stream, or to disable line counting by setting 'lineNumber' to LINE_NUM_NOT_SET.

This is also the default value, so to enable line counting, call this method with value >= 0.

Since
9.12.288

◆ startDocument()

void isys::CXMLEmitter::startDocument ( bool implicit)
overridevirtual

see IEmitter.h

Since
9.12.288

Implements isys::IEmitter.

◆ startNode() [1/2]

void isys::CXMLEmitter::startNode ( const std::string & nodeName)

This method is specific to XML.

Custom node can be added.

Since
9.12.288

◆ startNode() [2/2]

void isys::CXMLEmitter::startNode ( const std::string & nodeName,
const std::map< std::string, std::string > attributes )
Since
9.12.288

◆ startStream() [1/2]

void isys::CXMLEmitter::startStream ( )
overridevirtual

see IEmitter.h

Since
9.12.288

Implements isys::IEmitter.

◆ startStream() [2/2]

void isys::CXMLEmitter::startStream ( const std::string & userData)
overridevirtual

Use this method to add your specific data immediately after the first line.

It is mainly intended for processing instructions, for example XSLT processing:

    startStream("'<?xml-stylesheet type="text/xsl" href="itestResult.xslt"?>\\n")
Since
9.12.288

Implements isys::IEmitter.

◆ writeMapEnd()

virtual void isys::IEmitter::writeMapEnd ( )
virtualinherited
Since
9.12.288

Reimplemented in isys::CYAMLEmitter.

◆ writeMappingPair() [1/7]

void isys::CXMLEmitter::writeMappingPair ( const CYAMLObject & mappingKey,
const CYAMLObject & yamlObject )
override
Since
9.12.288

◆ writeMappingPair() [2/7]

void isys::CXMLEmitter::writeMappingPair ( const std::string & mappingKey,
bool value )
override
Since
9.12.288

◆ writeMappingPair() [3/7]

void isys::CXMLEmitter::writeMappingPair ( const std::string & mappingKey,
const CYAMLObject & yamlObject )
override
Since
9.12.288

◆ writeMappingPair() [4/7]

void isys::CXMLEmitter::writeMappingPair ( const std::string & mappingKey,
const std::string & value )
override
Since
9.12.288

◆ writeMappingPair() [5/7]

void isys::CXMLEmitter::writeMappingPair ( const std::string & mappingKey,
double value )
override
Since
9.12.288

◆ writeMappingPair() [6/7]

void isys::CXMLEmitter::writeMappingPair ( const std::string & mappingKey,
int64_t value )
override
Since
9.12.288

◆ writeMappingPair() [7/7]

void isys::CXMLEmitter::writeMappingPair ( const std::string & mappingKey,
uint64_t value )
override
Since
9.12.288

◆ writeSequenceEnd()

virtual void isys::IEmitter::writeSequenceEnd ( )
virtualinherited
Since
9.12.288

Reimplemented in isys::CYAMLEmitter.

◆ writeString()

void isys::CXMLEmitter::writeString ( const std::string & data)
overridevirtual
Since
9.12.288

Implements isys::IEmitter.

◆ writeText()

void isys::CXMLEmitter::writeText ( const std::string & text)
overridevirtual
Since
9.12.288

Implements isys::IEmitter.