Scopira 20080306

scopira::tool::xml_doc Class Reference

#include <xml.h>

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

List of all members.

Public Member Functions

 xml_doc (void)
 ctor, creates a NULL doc, you should parse or init one
 ~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

Detailed Description

An XML document. Not copyable.

Author:
Aleksander Demko

Constructor & Destructor Documentation

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

Member Function Documentation

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
void scopira::tool::xml_doc::clear ( void  )

Clear and free any internal data

Author:
Aleksander Demko

Referenced by ~xml_doc().

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
std::string scopira::tool::xml_doc::get_name ( void  ) const [inline]

Gets the name of this document

Author:
Aleksander Demko
xml_node scopira::tool::xml_doc::get_root ( void  ) const

Gets the root node.

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

Constructs a new blank documement with the given root node name

Author:
Aleksander Demko
bool scopira::tool::xml_doc::is_null ( void  ) const [inline]

Is this an empty doc?

Author:
Aleksander Demko
bool scopira::tool::xml_doc::is_valid ( void  ) const [inline]

Is this doc not-empty (valid)?

Author:
Aleksander Demko
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
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
void scopira::tool::xml_doc::load_prop ( property p)

Loads from a property tree

Parameters:
pthe property tree to use
Author:
Aleksander Demko
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
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
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
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
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

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