12#ifndef ZYPP_BASE_XML_H
13#define ZYPP_BASE_XML_H
43 struct NodeAttr :
public std::pair<std::string,std::string>
45 using Pair = std::pair<std::string, std::string>;
47 template <
typename Tp>
135 throw HasContentException();
178 for (
const auto & pair :
attrs_r )
179 _out.get() <<
" " << pair.first <<
"=\"" <<
xml::escape( pair.second ) <<
"\"";
183 {
return _name.empty(); }
187 std::reference_wrapper<std::ostream>
_out;
198 inline std::ostream &
node( std::ostream &
out_r,
const std::string &
name_r,
const std::initializer_list<Node::Attr> &
attrs_r = {} )
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
String related utilities and Regular expression matching.
std::string unescape(const std::string &in_r)
Unescape xml special charaters (& -> &; from IoBind library)
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
std::ostream & node(std::ostream &out_r, const std::string &name_r, Node::Attr attr_r)
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & dumpAsXmlOn(std::ostream &str, const Repository &obj)
std::string asString(const Patch::Category &obj)
(Key, Value) string pair of XML node attributes
std::pair< std::string, std::string > Pair
NodeAttr(std::string key_r, const Tp &val_r)
std::string asXmlNodeAttr(const Tp &val_r)
NODE ATTRIBUTE representation of types [asString].
NodeAttr(std::string key_r, std::string val_r)
Exception type thrown if attributes are added to a closed start node.
RAII writing a nodes start/end tag.
void printStart(const std::initializer_list< Attr > &attrs_r)
Node(std::ostream &out_r, std::string name_r, Attr attr_r)
Convenience ctor for one attribute pair.
std::ostream & operator*()
Return the output stream.
Node & addAttr(const Attr &attr_r)
void printAttr(const std::initializer_list< Attr > &attrs_r)
Node & addAttr(const std::initializer_list< Attr > &attrs_r={})
Add additional attributes (requires OptionalContentType)
std::reference_wrapper< std::ostream > _out
Node(std::ostream &out_r, std::string name_r, OptionalContentType, Attr attr_r)
Optional content Convenience ctor for one attribute pair.
NON_COPYABLE_BUT_MOVE(Node)
~Node()
Dtor wrting end tag.
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.
std::ostream & node(std::ostream &out_r, const std::string &name_r, const std::initializer_list< Node::Attr > &attrs_r={})
Write a leaf node without PCDATA.
static constexpr OptionalContentType optionalContent
Node(std::ostream &out_r, std::string name_r, const std::initializer_list< Attr > &attrs_r={})
Ctor taking nodename and attribute list.