library of assembled shared sources

http://lass.cocamware.com

lass::io::XmlOFile Class Reference

Output stream for writing a selection of geometric primitives to XML files. More...

#include <xml_o_file.h>

Inheritance diagram for lass::io::XmlOFile:

Inheritance graph
[legend]
Collaboration diagram for lass::io::XmlOFile:

Collaboration graph
[legend]

Public Member Functions

 XmlOFile ()
 XmlOFile (const char *iFilename, std::ios::openmode iOpenMode=std::ios::out|std::ios::trunc)
 XmlOFile (const char *iFilename, const char *iRoot)
 XmlOFile (const std::string &iFilename, std::ios::openmode iOpenMode=std::ios::out|std::ios::trunc)
 XmlOFile (const std::string &iFilename, const std::string &iRoot)
virtual ~XmlOFile ()
void open (const char *iFilename, std::ios::openmode iOpenMode=std::ios::out|std::ios::trunc)
void open (const char *iFilename, const char *iRoot)
void open (const std::string &iFilename, std::ios::openmode iOpenMode=std::ios::out|std::ios::trunc)
void open (const std::string &iFilename, const std::string &iRoot)
void close ()
bool is_open ()
virtual XmlOFileoperator<< (char iIn)
virtual XmlOFileoperator<< (signed char iIn)
virtual XmlOFileoperator<< (unsigned char iIn)
virtual XmlOFileoperator<< (signed short iIn)
virtual XmlOFileoperator<< (unsigned short iIn)
virtual XmlOFileoperator<< (signed int iIn)
virtual XmlOFileoperator<< (unsigned int iIn)
virtual XmlOFileoperator<< (signed long iIn)
virtual XmlOFileoperator<< (unsigned long iIn)
virtual XmlOFileoperator<< (float iIn)
virtual XmlOFileoperator<< (double iIn)
virtual XmlOFileoperator<< (long double iIn)
virtual XmlOFileoperator<< (bool iIn)
virtual XmlOFileoperator<< (const void *iIn)
virtual XmlOFileoperator<< (const char *iIn)
virtual XmlOFileoperator<< (const std::string &iIn)
virtual XmlOFileoperator<< (std::ostream &(*iIn)(std::ostream &))
const bool good () const
const bool eof () const
const bool fail () const
const bool bad () const
std::ios_base::iostate rdstate () const
void clear (std::ios_base::iostate iState=std::ios_base::goodbit)
void setstate (std::ios_base::iostate iState)
 operator num::SafeBool () const
const bool operator! () const

Protected Member Functions

void swap (NonCopyable &)

Private Attributes

std::ofstream file_
std::string root_

Detailed Description

Output stream for writing a selection of geometric primitives to XML files.

if you open a XmlOFile with iOpenMode (or without a second argument), the file is opened and that's it. Not automatic content is written to it:

  {
      XmlOFile a("foo.xml");
      a << "spam\n"
  }

  // foo.xml:
  // spam

  {
      XmlOFile b("bar.xml, std::ios::trunc);
      b << "eggs\n"
  }

  // bar.xml:
  // eggs

However, if your second argument is the name of your root element, then a standard XML declaration will be written to it and the root element will be opened. When the file is closed, this root element will be closed automatically as well.

  {
      XmlOFile c("fun.xml", "root");
      c << "ham\n"
  }

  // fun.xml:
  // <?xml version="1.0"?>
  // <root>
  // ham
  // </root>

Definition at line 104 of file xml_o_file.h.


Constructor & Destructor Documentation

lass::io::XmlOFile::XmlOFile (  ) 

Definition at line 54 of file xml_o_file.cpp.

lass::io::XmlOFile::XmlOFile ( const char *  iFilename,
std::ios::openmode  iOpenMode = std::ios::out | std::ios::trunc 
)

Definition at line 63 of file xml_o_file.cpp.

References open().

lass::io::XmlOFile::XmlOFile ( const char *  iFilename,
const char *  iRoot 
)

Definition at line 71 of file xml_o_file.cpp.

References open().

lass::io::XmlOFile::XmlOFile ( const std::string &  iFilename,
std::ios::openmode  iOpenMode = std::ios::out | std::ios::trunc 
)

Definition at line 79 of file xml_o_file.cpp.

References open().

lass::io::XmlOFile::XmlOFile ( const std::string &  iFilename,
const std::string &  iRoot 
)

Definition at line 87 of file xml_o_file.cpp.

References open().

lass::io::XmlOFile::~XmlOFile (  )  [virtual]

Definition at line 95 of file xml_o_file.cpp.

References close().


Member Function Documentation

void lass::io::XmlOFile::open ( const char *  iFilename,
std::ios::openmode  iOpenMode = std::ios::out | std::ios::trunc 
)

Definition at line 102 of file xml_o_file.cpp.

References lass::io::StreamBase::clear(), file_, and root_.

Referenced by open(), and XmlOFile().

void lass::io::XmlOFile::open ( const char *  iFilename,
const char *  iRoot 
)

Definition at line 111 of file xml_o_file.cpp.

References lass::io::StreamBase::clear(), file_, lass::prim::out(), and root_.

void lass::io::XmlOFile::open ( const std::string &  iFilename,
std::ios::openmode  iOpenMode = std::ios::out | std::ios::trunc 
)

Definition at line 122 of file xml_o_file.cpp.

References open().

void lass::io::XmlOFile::open ( const std::string &  iFilename,
const std::string &  iRoot 
)

Definition at line 129 of file xml_o_file.cpp.

References open().

void lass::io::XmlOFile::close (  ) 

Definition at line 136 of file xml_o_file.cpp.

References lass::io::StreamBase::clear(), file_, and root_.

Referenced by ~XmlOFile().

bool lass::io::XmlOFile::is_open (  ) 

Definition at line 148 of file xml_o_file.cpp.

References file_.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( char  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( signed char  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( unsigned char  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( signed short  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( unsigned short  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( signed int  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( unsigned int  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( signed long  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( unsigned long  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( float  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( double  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( long double  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( bool  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( const void *  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( const char *  iIn  )  [virtual]

Implements lass::io::XmlOStream.

virtual XmlOFile& lass::io::XmlOFile::operator<< ( const std::string &  iIn  )  [virtual]

Implements lass::io::XmlOStream.

XmlOFile & lass::io::XmlOFile::operator<< ( std::ostream &(*)(std::ostream &)  iIn  )  [virtual]

Implements lass::io::XmlOStream.

Definition at line 180 of file xml_o_file.cpp.

const bool lass::io::StreamBase::good (  )  const [inline, inherited]

const bool lass::io::StreamBase::eof (  )  const [inline, inherited]

Definition at line 77 of file stream_base.h.

Referenced by lass::io::Image::open(), and lass::io::Image::save().

const bool lass::io::StreamBase::fail (  )  const [inline, inherited]

Definition at line 78 of file stream_base.h.

Referenced by lass::io::StreamBase::operator num::SafeBool().

const bool lass::io::StreamBase::bad (  )  const [inline, inherited]

Definition at line 79 of file stream_base.h.

std::ios_base::iostate lass::io::StreamBase::rdstate (  )  const [inline, inherited]

Definition at line 80 of file stream_base.h.

Referenced by lass::io::XmlOElement::XmlOElement().

void lass::io::StreamBase::clear ( std::ios_base::iostate  iState = std::ios_base::goodbit  )  [inline, inherited]

Definition at line 81 of file stream_base.h.

Referenced by close(), open(), and lass::io::XmlOElement::XmlOElement().

void lass::io::StreamBase::setstate ( std::ios_base::iostate  iState  )  [inline, inherited]

lass::io::StreamBase::operator num::SafeBool (  )  const [inline, inherited]

const bool lass::io::StreamBase::operator! (  )  const [inline, inherited]

Definition at line 84 of file stream_base.h.

void lass::util::NonCopyable::swap ( NonCopyable  )  [inline, protected, inherited]

Definition at line 60 of file non_copyable.h.

Referenced by lass::io::Image::readLine().


Field Documentation

std::ofstream lass::io::XmlOFile::file_ [private]

Definition at line 142 of file xml_o_file.h.

Referenced by close(), is_open(), and open().

std::string lass::io::XmlOFile::root_ [private]

Definition at line 143 of file xml_o_file.h.

Referenced by close(), and open().


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

Generated on Mon Nov 10 14:22:09 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo