XMLStorage::XMLDoc Struct Reference

XML document holder. More...

#include <xmlstorage.h>

Inheritance diagram for XMLStorage::XMLDoc:

Inheritance graph
[legend]
Collaboration diagram for XMLStorage::XMLDoc:

Collaboration graph
[legend]

Public Member Functions

 XMLDoc ()
 XMLDoc (LPCTSTR path)
bool read (LPCTSTR path)
bool read (const char *buffer, size_t len, const std::string &system_id=std::string())
bool read (std::istream &in, const std::string &system_id=std::string())
bool read (XMLReaderBase &reader, const std::string &display_path)
std::ostream & write (std::ostream &out, WRITE_MODE mode=FORMAT_SMART) const
 write XML stream preserving previous white space and comments
std::ostream & write_formating (std::ostream &out) const
 write XML stream with formating
bool write (LPCTSTR path, WRITE_MODE mode=FORMAT_SMART) const
bool write_formating (LPCTSTR path) const

Data Fields

XMLFormat _format
XMLErrorList _errors

Detailed Description

XML document holder.

Definition at line 2132 of file xmlstorage.h.


Constructor & Destructor Documentation

XMLStorage::XMLDoc::XMLDoc (  )  [inline]

Definition at line 2134 of file xmlstorage.h.

02135      :  XMLNode("")
02136     {
02137     }

XMLStorage::XMLDoc::XMLDoc ( LPCTSTR  path  )  [inline]

Definition at line 2139 of file xmlstorage.h.

02140      :  XMLNode("")
02141     {
02142         read(path);
02143     }


Member Function Documentation

bool XMLStorage::XMLDoc::read ( LPCTSTR  path  )  [inline]

Definition at line 2166 of file xmlstorage.h.

References XMLStorage::XS_String::XS_String().

02167     {
02168         tifstream in(path);
02169         XMLReader reader(this, in);
02170 
02171 #if defined(_STRING_DEFINED) && !defined(XS_STRING_UTF8)
02172         return read(reader, std::string(ANS(path)));
02173 #else
02174         return read(reader, XS_String(path));
02175 #endif
02176     }

Here is the call graph for this function:

bool XMLStorage::XMLDoc::read ( const char *  buffer,
size_t  len,
const std::string &  system_id = std::string() 
) [inline]

Definition at line 2178 of file xmlstorage.h.

02179     {
02180         std::istringstream in(std::string(buffer, len));
02181 
02182         return read(in, system_id);
02183     }

bool XMLStorage::XMLDoc::read ( std::istream &  in,
const std::string &  system_id = std::string() 
) [inline]

Definition at line 2185 of file xmlstorage.h.

02186     {
02187         XMLReader reader(this, in);
02188 
02189         return read(reader, system_id);
02190     }

bool XMLStorage::XMLDoc::read ( XMLReaderBase reader,
const std::string &  display_path 
) [inline]

Definition at line 2193 of file xmlstorage.h.

References XMLStorage::XMLFormat::_endl, XMLStorage::XMLReaderBase::clear_errors(), XMLStorage::XMLReaderBase::get_endl(), XMLStorage::XMLReaderBase::get_errors(), XMLStorage::XMLReaderBase::get_format(), and XMLStorage::XMLReaderBase::read().

02194     {
02195 #ifdef XMLNODE_LOCATION
02196          // make a string copy to handle temporary string objects
02197         _display_path = display_path;
02198         reader._display_path = _display_path.c_str();
02199 #endif
02200 
02201         reader.clear_errors();
02202         reader.read();
02203 
02204         _format = reader.get_format();
02205         _format._endl = reader.get_endl();
02206 
02207         if (!reader.get_errors().empty()) {
02208             _errors = reader.get_errors();
02209             return false;
02210         }
02211 
02212         return true;
02213     }

Here is the call graph for this function:

std::ostream& XMLStorage::XMLDoc::write ( std::ostream &  out,
WRITE_MODE  mode = FORMAT_SMART 
) const [inline]

write XML stream preserving previous white space and comments

Definition at line 2216 of file xmlstorage.h.

References XMLStorage::FORMAT_PLAIN.

02217     {
02218         _format.print_header(out, mode!=FORMAT_PLAIN);
02219 
02220         if (!_children.empty())
02221             _children.front()->write(out, _format, mode);
02222 
02223         return out;
02224     }

std::ostream& XMLStorage::XMLDoc::write_formating ( std::ostream &  out  )  const [inline]

write XML stream with formating

Definition at line 2227 of file xmlstorage.h.

References XMLStorage::FORMAT_PRETTY.

02228     {
02229         return write(out, FORMAT_PRETTY);
02230     }

bool XMLStorage::XMLDoc::write ( LPCTSTR  path,
WRITE_MODE  mode = FORMAT_SMART 
) const [inline]

Definition at line 2232 of file xmlstorage.h.

02233     {
02234         tofstream out(path);
02235 
02236         return write(out, mode).good();
02237     }

bool XMLStorage::XMLDoc::write_formating ( LPCTSTR  path  )  const [inline]

Definition at line 2239 of file xmlstorage.h.

02240     {
02241         tofstream out(path);
02242 
02243         return write_formating(out).good();
02244     }


Field Documentation

XMLFormat XMLStorage::XMLDoc::_format

Definition at line 2246 of file xmlstorage.h.

XMLErrorList XMLStorage::XMLDoc::_errors

Definition at line 2247 of file xmlstorage.h.


The documentation for this struct was generated from the following file:
IBrowser Source Code Documentation
generated on 18.09.2008 by doxygen

Homepage