Scopira  20080306
scopira::tool::xml_doc Class Reference

#include <xml.h>

Inheritance diagram for scopira::tool::xml_doc:
scopira::tool::object

Public Member Functions

 xml_doc (void)
 ctor, creates a NULL doc, you should parse or init one More...
 
 ~xml_doc ()
 Destructor.
 
xmlDocPtr get_ptr (void) const
 returns the internal pointer – use with care
 
bool is_null (void) const
 
bool is_valid (void) const
 
const char * get_c_name (void) const
 
std::string get_name (void) const
 
void clear (void)
 
void init (const std::string &rootnodename)
 
void add_pi (const std::string &name, const std::string &content="")
 
void load_ptr (xmlDocPtr newdoc)
 
bool load_file (const std::string &filename)
 
bool load_string (const std::string &data)
 
bool load_c_str (const char *str)
 
void load_prop (property *p)
 
xml_node get_root (void) const
 
bool save_file (const std::string &filename, bool compress=false) const
 
bool save_string (std::string &out) const
 
void save_prop (property *p) const
 
- Public Member Functions inherited from scopira::tool::object
virtual ~object ()
 
int add_ref (void) const
 
bool sub_ref (void) const
 
void auto_ref (void) const
 
int current_ref (void) const
 
virtual scopira::tool::oflow_iprint (scopira::tool::oflow_i &o) const
 
virtual bool load (scopira::tool::iobjflow_i &in)
 
virtual void save (scopira::tool::oobjflow_i &out) const
 
bool is_alive_object (void) const
 
bool is_dead_object (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from scopira::tool::object
 object (void)
 
 object (bool neverusecounter)
 

Detailed Description

An XML document. Not copyable.

Author
Aleksander Demko

Constructor & Destructor Documentation

◆ xml_doc()

scopira::tool::xml_doc::xml_doc ( void  )
inline

ctor, creates a NULL doc, you should parse or init one

Constructs an empty document. You must then call one of the init or load routines.

Author
Aleksander Demko

Referenced by get_name().

Member Function Documentation

◆ add_pi()

void scopira::tool::xml_doc::add_pi ( const std::string &  name,
const std::string &  content = "" 
)

Adds a new processing instruction (PI) to the doc.

Author
Aleksander Demko

Referenced by get_name().

◆ clear()

void scopira::tool::xml_doc::clear ( void  )

Clear and free any internal data

Author
Aleksander Demko

Referenced by get_name(), and ~xml_doc().

◆ get_c_name()

const char* scopira::tool::xml_doc::get_c_name ( void  ) const
inline

Gets the name of this document as a C string

Author
Aleksander Demko

◆ get_name()

std::string scopira::tool::xml_doc::get_name ( void  ) const
inline

Gets the name of this document

Author
Aleksander Demko

References add_pi(), clear(), get_root(), init(), load_c_str(), load_file(), load_prop(), load_ptr(), load_string(), save_file(), save_prop(), save_string(), and xml_doc().

◆ get_root()

xml_node scopira::tool::xml_doc::get_root ( void  ) const

Gets the root node.

Author
Aleksander Demko

Referenced by get_name().

◆ init()

void scopira::tool::xml_doc::init ( const std::string &  rootnodename)

Constructs a new blank documement with the given root node name

Author
Aleksander Demko

Referenced by get_name().

◆ is_null()

bool scopira::tool::xml_doc::is_null ( void  ) const
inline

Is this an empty doc?

Author
Aleksander Demko

◆ is_valid()

bool scopira::tool::xml_doc::is_valid ( void  ) const
inline

Is this doc not-empty (valid)?

Author
Aleksander Demko

◆ load_c_str()

bool scopira::tool::xml_doc::load_c_str ( const char *  str)

Loads/parses a document from an in memory (C) string

Parameters
datathe input string
Returns
true on success
Author
Aleksander Demko

Referenced by get_name().

◆ load_file()

bool scopira::tool::xml_doc::load_file ( const std::string &  filename)

Load a document from the given file. Will be decompressed if need be.

Parameters
filenamethe file to load from.
Returns
true on success
Author
Aleksander Demko

Referenced by get_name().

◆ load_prop()

void scopira::tool::xml_doc::load_prop ( property p)

Loads from a property tree

Parameters
pthe property tree to use
Author
Aleksander Demko

Referenced by get_name().

◆ load_ptr()

void scopira::tool::xml_doc::load_ptr ( xmlDocPtr  newdoc)

Replacements the current doc with the supplied one – use with care. The current doc, if any, will be released. The new doc may be null.

Parameters
newdocthe new doc
Author
Aleksander Demko

Referenced by get_name().

◆ load_string()

bool scopira::tool::xml_doc::load_string ( const std::string &  data)

Loads/parses a document from an in memory string

Parameters
datathe input string
Returns
true on success
Author
Aleksander Demko

Referenced by get_name().

◆ save_file()

bool scopira::tool::xml_doc::save_file ( const std::string &  filename,
bool  compress = false 
) const

Save the current document to file

Parameters
filenamethe file to write out to
compressshould the output file be compressed (default = false)
Returns
true on success
Author
Aleksander Demko

Referenced by get_name().

◆ save_prop()

void scopira::tool::xml_doc::save_prop ( property p) const

Saves this document to a property structure

Parameters
pthe structure to write out to
Author
Aleksander Demko

Referenced by get_name().

◆ save_string()

bool scopira::tool::xml_doc::save_string ( std::string &  out) const

Saves the current document to the given output string

Parameters
outthe string to write to
Returns
true on success
Author
Aleksander Demko

Referenced by get_name().


The documentation for this class was generated from the following file: