#include <ctype.h>
#include "tinyxml.h"
Go to the source code of this file.
Functions | |
FILE * | TiXmlFOpen (const char *filename, const char *mode) |
std::istream & | operator>> (std::istream &in, TiXmlNode &base) |
std::ostream & | operator<< (std::ostream &out, const TiXmlNode &base) |
std::string & | operator<< (std::string &out, const TiXmlNode &base) |
std::ostream& operator<< | ( | std::ostream & | out, |
const TiXmlNode & | base | ||
) |
An output stream operator, for every class. Note that this outputs without any newlines or formatting, as opposed to Print(), which includes tabs and new lines.
The operator<< and operator>> are not completely symmetric. Writing a node to a stream is very well defined. You'll get a nice stream of output, without any extra whitespace or newlines.
But reading is not as well defined. (As it always is.) If you create a TiXmlElement (for example) and read that from an input stream, the text needs to define an element or junk will result. This is true of all input streams, but it's worth keeping in mind.
A TiXmlDocument will read nodes until it reads a root element, and all the children of that root element.
Definition at line 1562 of file tinyxml.cpp.
References TiXmlNode::Accept(), TiXmlPrinter::SetStreamPrinting(), and TiXmlPrinter::Str().
{ TiXmlPrinter printer; printer.SetStreamPrinting(); base.Accept( &printer ); out << printer.Str(); return out; }
std::string& operator<< | ( | std::string & | out, |
const TiXmlNode & | base | ||
) |
Definition at line 1573 of file tinyxml.cpp.
References TiXmlNode::Accept(), TiXmlPrinter::SetStreamPrinting(), and TiXmlPrinter::Str().
{ TiXmlPrinter printer; printer.SetStreamPrinting(); base.Accept( &printer ); out.append( printer.Str() ); return out; }
std::istream& operator>> | ( | std::istream & | in, |
TiXmlNode & | base | ||
) |
An input stream operator, for every class. Tolerant of newlines and formatting, but doesn't expect them.
Definition at line 1549 of file tinyxml.cpp.
References TiXmlBase::Parse(), TiXmlNode::StreamIn(), TIXML_DEFAULT_ENCODING, and TIXML_STRING.
{ TIXML_STRING tag; tag.reserve( 8 * 1000 ); base.StreamIn( &in, &tag ); base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); return in; }
FILE * TiXmlFOpen | ( | const char * | filename, |
const char * | mode | ||
) |
Definition at line 39 of file tinyxml.cpp.
Referenced by TiXmlDocument::LoadFile(), and TiXmlDocument::SaveFile().
{ #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) FILE* fp = 0; errno_t err = fopen_s( &fp, filename, mode ); if ( !err && fp ) return fp; return 0; #else return fopen( filename, mode ); #endif }