Skip to content

scram::xml::Stream

XML Stream document. More...

#include <xml_stream.h>

Public Functions

Name
Stream(std::FILE * out, bool indent =true)<br>Constructs a document with XML header.
~Stream()
StreamElementroot(const char * name)<br>Creates a root element for the document.

Detailed Description

cpp
class scram::xml::Stream;

XML Stream document.

Note: The document elements are indented up to 10 levels for readability. The XML tree depth beyond 10 elements is printed at level 10.

Precondition: Only this stream and its elements write to the output destination. No other writes happen while this stream is alive.

Public Functions Documentation

function Stream

cpp
inline explicit Stream(
    std::FILE * out,
    bool indent =true
)

Constructs a document with XML header.

Parameters:

  • out The stream destination.
  • indent Option to indent output for readability.

Note: This output file has clean error state.

function ~Stream

cpp
inline ~Stream()

Exceptions:

  • IOError The file write operation has failed.

Postcondition: The exception is thrown only if no other exception is on flight.

function root

cpp
inline StreamElement root(
    const char * name
)

Creates a root element for the document.

Parameters:

  • name The name for the root element.

Exceptions:

  • StreamError The document already has a root element, or root element construction has failed.

Return: XML stream element representing the document root.

Precondition: The document is alive at least as long as the created root.


Updated on 2025-11-11 at 16:51:08 +0000