libzypp  17.8.0
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/APIConfig.h"
18 
20 namespace zypp
21 {
23  namespace xml
24  {
26  namespace detail
27  {
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  inline detail::EscapedString escape( const std::string & in_r )
52  { return detail::EscapedString( in_r ); }
53 
55  ZYPP_API std::string unescape( const std::string & in_r );
56 
57  } // namespace xml
59 } // namespace zypp
61 #endif // ZYPP_PARSER_XML_XMLESCAPE_H
std::ostream & dumpOn(std::ostream &str) const
Definition: XmlEscape.cc:79
String related utilities and Regular expression matching.
const std::string & _in
Definition: XmlEscape.h:37
std::string unescape(const std::string &in_r)
Unescape xml special charaters (& -> &; from IoBind library)
Definition: XmlEscape.cc:113
std::ostream & operator<<(std::ostream &str, const EscapedString &obj)
Definition: XmlEscape.h:41
EscapedString(const std::string &in_r)
Definition: XmlEscape.h:30
Provides API related macros.
std::string asString() const
Definition: XmlEscape.h:32
#define ZYPP_API
Definition: APIConfig.h:47
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Definition: XmlEscape.h:51