libzypp  13.10.6
zypp::xmlout::Node Class Reference

RAII writing a nodes start/end tag. More...

#include <Xml.h>

Classes

struct  OptionalContentType
 Ctor arg type. More...
 

Public Types

typedef NodeAttr Attr
 

Public Member Functions

 NON_COPYABLE_BUT_MOVE (Node)
 
 Node (std::ostream &out_r, std::string name_r, const std::initializer_list< Attr > &attrs_r={})
 Ctor taking nodename and attribute list. More...
 
 Node (std::ostream &out_r, std::string name_r, Attr attr_r)
 Convenience ctor for one attribute pair. More...
 
 Node (std::ostream &out_r, std::string name_r, OptionalContentType, const std::initializer_list< Attr > &attrs_r={})
 Optional content ctor taking nodename and attribute list. More...
 
 Node (std::ostream &out_r, std::string name_r, OptionalContentType, Attr attr_r)
 Optional content Convenience ctor for one attribute pair. More...
 

Public Attributes

std::string _name
 
bool _hasContent
 

Static Public Attributes

static constexpr
OptionalContentType 
optionalContent = OptionalContentType()
 

Related Functions

(Note that these are not member functions.)

std::ostream & node (std::ostream &out_r, const std::string &name_r, const std::initializer_list< Node::Attr > &attrs_r={})
 

Detailed Description

RAII writing a nodes start/end tag.

* {
* Node node( std::cout, "node", { "attr", "val" } ); // <node attr="val">
* *node << "write nodes body...."
* } // </node>
*
Note
If the optionalContent flag is passed to the ctor, the start node is kept open, until the first call to operator*. The start node is closed before returning the stream.
* {
* Node node( std::cout, "node", Node::optionalContent, { "attr", "val" } );
* // <node attr="val"
* } // />
* {
* Node node( std::cout, "node", Node::optionalContent, { "attr", "val" } );
* // <node attr="val"
* *node << "write nodes body...." // />write nodes body...
* } // </node>
*

Definition at line 82 of file Xml.h.

Member Typedef Documentation

Definition at line 85 of file Xml.h.

Constructor & Destructor Documentation

zypp::xmlout::Node::Node ( std::ostream &  out_r,
std::string  name_r,
const std::initializer_list< Attr > &  attrs_r = {} 
)
inline

Ctor taking nodename and attribute list.

Definition at line 91 of file Xml.h.

zypp::xmlout::Node::Node ( std::ostream &  out_r,
std::string  name_r,
Attr  attr_r 
)
inline

Convenience ctor for one attribute pair.

Definition at line 96 of file Xml.h.

zypp::xmlout::Node::Node ( std::ostream &  out_r,
std::string  name_r,
OptionalContentType  ,
const std::initializer_list< Attr > &  attrs_r = {} 
)
inline

Optional content ctor taking nodename and attribute list.

Definition at line 101 of file Xml.h.

zypp::xmlout::Node::Node ( std::ostream &  out_r,
std::string  name_r,
OptionalContentType  ,
Attr  attr_r 
)
inline

Optional content Convenience ctor for one attribute pair.

Definition at line 106 of file Xml.h.

Member Function Documentation

zypp::xmlout::Node::NON_COPYABLE_BUT_MOVE ( Node  )

Friends And Related Function Documentation

std::ostream & node ( std::ostream &  out_r,
const std::string &  name_r,
const std::initializer_list< Node::Attr > &  attrs_r = {} 
)
related

Write a leaf node without PCDATA

* <node attr="val"/>
*

Definition at line 158 of file Xml.h.

Member Data Documentation

constexpr OptionalContentType zypp::xmlout::Node::optionalContent = OptionalContentType()
static

Definition at line 88 of file Xml.h.

std::string zypp::xmlout::Node::_name

Definition at line 108 of file Xml.h.

bool zypp::xmlout::Node::_hasContent

Definition at line 149 of file Xml.h.


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