This class serializes test specification objects to YAML format.
More...
#include <CYAMLEmitter.h>
|
| | CYAMLEmitter (isys::ICStreamSPtr fileStream) |
| | This ctor may be called from SWIG wrappers, because it keeps reference to fileStream, so it can not happen for fileStream to be destroyed before this object is destroyed.
|
| void | endDocument (bool implicit) override |
| | Ends the document.
|
| void | endStream () override |
| | Ends output stream.
|
| std::string | escapeSpecialChars (const std::string &data) override |
| | This method modifies the input string so that it is in proper YAML syntax for scalars.
|
| void | flush () override |
| | Flush the accumulated characters to the output.
|
| 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 | init (bool implicit) |
| | Starts YAML document and stream.
|
| 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 |
| | Starts the document.
|
| void | startStream () override |
| | Initializes the output stream object.
|
| void | startStream (const std::string &userData) override |
| | Initializes the output stream object.
|
| void | writeText (const std::string &text) override |
| | Writes unmodified text to output.
|
This class serializes test specification objects to YAML format.
- See also
- isys::IEmitter
◆ 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
|
◆ CYAMLEmitter()
This ctor may be called from SWIG wrappers, because it keeps reference to fileStream, so it can not happen for fileStream to be destroyed before this object is destroyed.
- Since
- 9.12.288
◆ endDocument()
| void isys::CYAMLEmitter::endDocument |
( |
bool | implicit | ) |
|
|
overridevirtual |
Ends the document.
- Parameters
-
| implicit | if 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: '...' |
- Since
- 9.12.288
Implements isys::IEmitter.
◆ endStream()
| void isys::CYAMLEmitter::endStream |
( |
| ) |
|
|
overridevirtual |
Ends output stream.
The output stream is NOT closed. Call this method after emitting is done.
- Since
- 9.12.288
Implements isys::IEmitter.
◆ escapeSpecialChars()
| std::string isys::CYAMLEmitter::escapeSpecialChars |
( |
const std::string & | data | ) |
|
|
overridevirtual |
This method modifies the input string so that it is in proper YAML syntax for scalars.
The string is surrounded with single quotes, all existing single quotes are escaped with a single quote, except the starting and ending one.
- Since
- 9.12.288
Implements isys::IEmitter.
◆ flush()
| void isys::CYAMLEmitter::flush |
( |
| ) |
|
|
overridevirtual |
Flush the accumulated characters to the output.
- 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()
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
◆ init()
| void isys::CYAMLEmitter::init |
( |
bool | implicit | ) |
|
◆ 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::CYAMLEmitter::startDocument |
( |
bool | implicit | ) |
|
|
overridevirtual |
Starts the document.
This method should be called after startStream().
- Parameters
-
| implicit | currently used by YAML emitter only. When true, the document is emitted without the leading '—'. |
- Since
- 9.12.288
Implements isys::IEmitter.
◆ startStream() [1/2]
| void isys::CYAMLEmitter::startStream |
( |
| ) |
|
|
overridevirtual |
Initializes the output stream object.
- Since
- 9.12.288
Implements isys::IEmitter.
◆ startStream() [2/2]
| void isys::CYAMLEmitter::startStream |
( |
const std::string & | userData | ) |
|
|
overridevirtual |
Initializes the output stream object.
- Parameters
-
| userData | text written directly to output stream, bypassing the underlying emitter. This can be used for writing comments or preprocessing instructions. |
- Since
- 9.12.288
Implements isys::IEmitter.
◆ writeText()
| void isys::CYAMLEmitter::writeText |
( |
const std::string & | text | ) |
|
|
overridevirtual |
Writes unmodified text to output.
- Since
- 9.12.288
Implements isys::IEmitter.