libzypp 17.37.10

XmlEscape.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_PARSER_XML_XMLESCAPE_H
13#define ZYPP_PARSER_XML_XMLESCAPE_H
14
15#include <sstream>
16#include <string>
17#include <zypp-core/Globals.h>
18
20 namespace zypp
21{
23 namespace xml
24 {
26 namespace detail
27 {
28 struct ZYPP_API EscapedString
29 {
30 EscapedString( const std::string & in_r ) : _in( in_r ) {}
31 std::ostream & dumpOn( std::ostream & str ) const;
32 std::string asString() const
33 { std::ostringstream str; dumpOn( str ); return str.str(); }
34 operator std::string() const
35 { return asString(); }
36 private:
37 const std::string & _in;
38 };
39
41 inline std::ostream & operator<<( std::ostream & str, const EscapedString & obj )
42 { return obj.dumpOn( str ); }
43
44 } // detail
46
51 ZYPP_API inline detail::EscapedString escape( const std::string & in_r )
52 { return detail::EscapedString( in_r ); }
53
55 std::string unescape( const std::string & in_r ) ZYPP_API;
56
57 } // namespace xml
59} // namespace zypp
61#endif // ZYPP_PARSER_XML_XMLESCAPE_H
str
String related utilities and Regular expression matching.
zypp::xml::detail
Definition XmlEscape.cc:78
zypp::xml
Definition libxmlfwd.cc:22
zypp::xml::escape
ZYPP_API detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Definition XmlEscape.h:51
zypp::xml::unescape
std::string unescape(const std::string &in_r)
Unescape xml special charaters (& -> &; from IoBind library)
Definition XmlEscape.cc:113
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::dumpOn
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition Capability.cc:580
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::xml::detail::EscapedString
Definition XmlEscape.h:29
zypp::xml::detail::EscapedString::dumpOn
std::ostream & dumpOn(std::ostream &str) const
Definition XmlEscape.cc:79
zypp::xml::detail::EscapedString::asString
std::string asString() const
Definition XmlEscape.h:32
zypp::xml::detail::EscapedString::EscapedString
EscapedString(const std::string &in_r)
Definition XmlEscape.h:30
zypp::xml::detail::EscapedString::operator<<
std::ostream & operator<<(std::ostream &str, const EscapedString &obj)
Stream output.
Definition XmlEscape.h:41
zypp::xml::detail::EscapedString::_in
const std::string & _in
Definition XmlEscape.h:37
Globals.h
Provides API related macros.