Public Member Functions | Public Attributes

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]

List of all members.

Public Member Functions

 XMLDoc ()
 XMLDoc (LPCTSTR path)
bool read_file (LPCTSTR path)
bool read_buffer (const char *buffer, size_t len, const std::string &system_id=std::string())
bool read_buffer (const std::string &buffer, const std::string &system_id=std::string())
bool read_stream (std::istream &in, const std::string &system_id=std::string())
bool read (XMLReaderBase &reader, const std::string &display_path)
bool write (std::ostream &out, WRITE_MODE mode=FORMAT_SMART) const
 write XML stream
bool write_formating (std::ostream &out) const
 write XML stream with formating
bool write_file (LPCTSTR path, WRITE_MODE mode=FORMAT_SMART) const
bool write_formating (LPCTSTR path) const

Public Attributes

XMLFormat _format
XMLErrorList _errors

Detailed Description

XML document holder.

Definition at line 2842 of file xmlstorage.h.


Constructor & Destructor Documentation

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

Definition at line 2844 of file xmlstorage.h.

     :  XMLNode("")
    {
    }
XMLStorage::XMLDoc::XMLDoc ( LPCTSTR  path ) [inline]

Definition at line 2849 of file xmlstorage.h.

References read_file().

     :  XMLNode("")
    {
        read_file(path);
    }

Here is the call graph for this function:


Member Function Documentation

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

Definition at line 2916 of file xmlstorage.h.

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

Referenced by read_file(), and read_stream().

    {
#ifdef XS_NATIVE
        reader.setSystemId(display_path.c_str());
#elif defiend(XMLNODE_LOCATION)
         // make a string copy to handle temporary string objects
        _display_path = display_path;
        reader._display_path = _display_path.c_str();
#endif

        reader.clear_errors();
        reader.read();

        _format = reader.get_format();
        _format._endl = reader.get_endl();

        if (!reader.get_errors().empty()) {
            _errors = reader.get_errors();
            return false;
        }

        return true;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2896 of file xmlstorage.h.

Referenced by XMLStorage::XMLMessageFromString::XMLMessageFromString(), and XMLStorage::XMLMessageReader::XMLMessageReader().

    {
        return read_buffer(std::string(buffer, len), system_id);
    }

Here is the caller graph for this function:

bool XMLStorage::XMLDoc::read_buffer ( const std::string &  buffer,
const std::string &  system_id = std::string() 
) [inline]

Definition at line 2901 of file xmlstorage.h.

References read_stream().

    {
        std::istringstream istr(buffer);

        return read_stream(istr, system_id);
    }

Here is the call graph for this function:

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

Definition at line 2881 of file xmlstorage.h.

References ANS, read(), and XMLStorage::XS_String::XS_String().

Referenced by Favorites::read(), ExplorerGlobals::read_persistent(), and XMLDoc().

    {
        tifstream in(path);
        if (!in.good())
            return false;

        XMLReader reader(this, in);

#if defined(_STRING_DEFINED) && !defined(XS_STRING_UTF8)
        return read(reader, std::string(ANS(path)));
#else
        return read(reader, XS_String(path));
#endif
    }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2908 of file xmlstorage.h.

References read().

Referenced by read_buffer().

    {
        XMLReader reader(this, in);

        return read(reader, system_id);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

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

write XML stream

Definition at line 2942 of file xmlstorage.h.

References XMLStorage::XMLNode::_children, _format, XMLStorage::FORMAT_PLAIN, and XMLStorage::XMLFormat::print_header().

Referenced by XMLStorage::XMLMessage::toString(), write_file(), and write_formating().

    {
        _format.print_header(out, mode!=FORMAT_PLAIN);

        if (_children.size() == 1)
            _children.front()->write(out, _format, mode);
        else if (!_children.empty()) {
            //throw Exception("more than one XML root!");
            return false;
        }

        return out.good();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2962 of file xmlstorage.h.

References write().

Referenced by Favorites::write(), and ExplorerGlobals::write_persistent().

    {
        tofstream out(path);

        return write(out, mode);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2969 of file xmlstorage.h.

References write_formating().

    {
        tofstream out(path);

        return write_formating(out);
    }

Here is the call graph for this function:

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

write XML stream with formating

Definition at line 2957 of file xmlstorage.h.

References XMLStorage::FORMAT_PRETTY, and write().

Referenced by write_formating().

    {
        return write(out, FORMAT_PRETTY);
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 2977 of file xmlstorage.h.

Referenced by read(), Favorites::read(), and ExplorerGlobals::read_persistent().

Definition at line 2976 of file xmlstorage.h.

Referenced by read(), write(), and Favorites::write().


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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage