winIDEA SDK
isys::CXMLEmitter Class Reference

Description

This class serializes test specification objects to XML format.

See also
isys::IEmitter

#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.
 
void startStream () override
 Initializes the output stream object.
 
void startStream (const std::string &userData) override
 Use this method to add your specific data immediately after the first line. More...
 
void endStream () override
 Ends output stream. More...
 
void startDocument (bool implicit) override
 Starts the document. More...
 
void endDocument (bool implicit) override
 Ends the document. More...
 
void flush () override
 Flush the accumulated characters to the output.
 
virtual std::string escapeSpecialChars (const std::string &data) override
 Escapes predefined entities in XML. More...
 
void writeText (const std::string &text) override
 Writes unmodified text to output.
 
virtual std::string getIndent ()
 Returns indentation string added to each line of output.
 
virtual void setIndent (const std::string &indent)
 Sets indentation string added to each line of output.
 
virtual int getLineNumber ()
 This method provides information about current line being written to the file. More...
 
virtual void getRow (iconnect::StrVector &row, int rowIndex)
 This method returns row for the given index. More...
 
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. More...
 

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

Member Function Documentation

◆ endDocument()

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

Ends the document.

Parameters
implicitif the document end indicator is implicit. It is considered as a stylistic parameter and may be ignored by the emitter. If true, YAML emitter adds terminating doc sequence: '...'

Implements isys::IEmitter.

◆ endStream()

void isys::CXMLEmitter::endStream ( )
overridevirtual

Ends output stream.

The output stream is NOT closed. Call this method after emitting is done.

Implements isys::IEmitter.

◆ escapeSpecialChars()

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

◆ 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).

◆ 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.

◆ 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.

◆ startDocument()

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

Starts the document.

This method should be called after startStream().

Parameters
implicitcurrently used by YAML emitter only. When true, the document is emitted without the leading '—'.

Implements isys::IEmitter.

◆ startStream()

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")

Implements isys::IEmitter.