libzypp: zypp/parser/xml/XmlString.cc Source File

libzypp 17.38.14

XmlString.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include <iostream>
14
15#include <zypp/parser/xml/XmlString.h>
16
18namespace zypp
19{
21 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
XmlString.h
zypp::xml::XmlString
xmlChar * wrapper.
Definition XmlString.h:41
zypp::xml::XmlString::_xmlstr
shared_ptr< const xmlChar > _xmlstr
Wraps the xmlChar *.
Definition XmlString.h:105
zypp::xml::XmlString::OnDelete
OnDelete
Dtor policy.
Definition XmlString.h:52
zypp::xml::XmlString::FREE
@ FREE
Definition XmlString.h:52
zypp::xml::XmlString::c_str
const char * c_str() const
Explicit conversion to const char *.
Definition XmlString.h:73
zypp::xml::XmlString::XmlString
XmlString(const xmlChar *const xmlstr_r=NULL, OnDelete ondelete_r=NOFREE)
Ctor from xmlChar.
Definition XmlString.cc:29
str
String related utilities and Regular expression matching.
zypp::xml
Definition libxmlfwd.cc:22
zypp::xml::operator<<
std::ostream & operator<<(std::ostream &str, const ReadState &obj)
relates: ReadState Stream output.
Definition libxmlfwd.cc:29
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::NullDeleter
shared_ptr custom deleter doing nothing.
Definition PtrTypes.h:84
zypp::xml::XmlString::Deleter
shared_ptr custom deleter calling xmlFree.
Definition XmlString.h:44