libzypp  13.10.6
XmlString.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
13 #include <iostream>
14 
16 
18 namespace zypp
19 {
20  namespace xml
22  {
23 
25  //
26  // METHOD NAME : XmlString::XmlString
27  // METHOD TYPE : Constructor
28  //
29  XmlString::XmlString( const xmlChar *const xmlstr_r,
30  OnDelete ondelete_r )
31  {
32  if ( xmlstr_r )
33  {
34  if ( ondelete_r == FREE )
35  _xmlstr.reset( xmlstr_r, Deleter() );
36  else
37  _xmlstr.reset( xmlstr_r, NullDeleter() );
38  }
39  }
40 
41  /******************************************************************
42  **
43  ** FUNCTION NAME : operator<<
44  ** FUNCTION TYPE : std::ostream &
45  */
46  std::ostream & operator<<( std::ostream & str, const XmlString & obj )
47  {
48  if ( obj )
49  return str << obj.c_str();
50  return str << "NULL";
51  }
52 
54  } // namespace xml
57 } // namespace zypp
shared_ptr custom deleter calling xmlFree.
Definition: XmlString.h:43
xmlChar * wrapper.
Definition: XmlString.h:40
OnDelete
Dtor policy.
Definition: XmlString.h:52
const char * c_str() const
Explicit conversion to const char *.
Definition: XmlString.h:73
shared_ptr custom deleter doing nothing.
Definition: PtrTypes.h:75
std::ostream & operator<<(std::ostream &str, const ReadState &obj)
Definition: libxmlfwd.cc:29
shared_ptr< const xmlChar > _xmlstr
Wraps the xmlChar *.
Definition: XmlString.h:105
XmlString(const xmlChar *const xmlstr_r=NULL, OnDelete ondelete_r=NOFREE)
Ctor from xmlChar.
Definition: XmlString.cc:29