#include <XMLBinaryFile.hpp>
Inheritance diagram for XMLBinaryFile:
Public Member Functions | |
XMLBinaryFile (const string &_fileName="", const string &mode="", bool _exceptionOnFail=false) | |
void | OpenRead (const string &_fileName) |
void | OpenWrite (const string &_fileName) |
void | Close () |
xmlpp::Element * | AddBinaryNode (xmlpp::Element *parent, int size=-1) |
template<class T, class iterator> | |
void | BinaryWrite (iterator begin, iterator end) |
endian preserving write of a value range. meant only for simple types | |
template<class T, class iterator> | |
void | BinaryRead (iterator begin, iterator end) |
endian preserving write of a value range. meant only for simple types | |
void | BinaryWrite (void *data, size_t size) |
Write some binary data. Use this only after AddBinaryNode. | |
void | BinaryWrite (xmlpp::Element *binNode, void *data, size_t size) |
Add "size" bytes of data to binary node (use this!). | |
void | ReadBinaryNode (xmlpp::Element *parent) |
void | EndBinaryWrite (xmlpp::Element *binNode) |
void | BinaryRead (void *data, size_t size) |
bool | CheckBinaryReadComplete () |
Convenience functions xmlpp::Element * | AddChild (xmlpp::Element *parent, const string &name, const string &a1="", const string &a2="", const string &a3="", const string &a4="") |
xmlpp::Element * | GetChild (xmlpp::Element *parent, const string &name) |
bool | HasChild (xmlpp::Element *parent, const string &name) |
int | GetIntAttribute (xmlpp::Element *node, const string &name) |
double | GetDoubleAttribute (xmlpp::Element *node, const string &name) |
string | GetAttribute (xmlpp::Element *node, const string &name) |
bool | HasAttribute (xmlpp::Element *node, const string &name) |
xmlpp::Element * | GetRoot (const string &rootName="") |
xmlpp::Element * | SetRoot (const string &rootName) |
void | ShowXML (xmlpp::Element *node=NULL, int depth=0) |
Print an XML tree (for debuging). | |
void | ExceptionOnFail () |
Static Public Member Functions | |
static string | Quote (const string &src) |
remove any chars that confuse xml | |
static string | UnQuote (const string &src) |
restore any chars that confuse xml, that where removed by "Quote" | |
Public Attributes | |
int | debug |
Protected Member Functions | |
int | AllocInBinary (size_t size) |
Allocate space for a new binary block (for ex.image data). | |
name Accesors string | GetBinFileName () |
string | GetFileName () |
int | GetBinaryBegining () |
string | ReadXMLHeader () |
Read xml header from fileName. | |
void | Error (const char *fmt,...) |
Protected Attributes | |
string | fileName |
The real file name. | |
string | binFileName |
The temporary binary file name. | |
FILE * | binaryFile |
The temporary binary file. | |
xmlpp::DomParser * | parser |
xmlpp::Document * | document |
size_t | binaryCurrentAllocPos |
Current allocation position within the binary file. | |
size_t | posInsideCurrentAllocBlock |
size_t | currentAllocBlockSize |
size_t | binaryBegining |
Size of xml header, or equivalently, pos of begining of bin data. | |
bool | isWrite |
bool | isOpen |
bool | exceptionOnFail |
File structure is:<xml header=""><binary data="">. The <binary data=""> may contain several blocks : <binary data="">=<bin1><bin2><bin3> For example an image using a mask would contain: <binary data="">=<mask data=""><image data=""> The xml header is read-to/written-from an XML tree using xml++ (that uses libxml)
Definition at line 44 of file XMLBinaryFile.hpp.
|
Allocate space for a new binary block (for ex.image data). if size==0 block is extensible, must call EndBinaryNode Definition at line 240 of file XMLBinaryFile.cpp. References binaryCurrentAllocPos, and binaryFile. |
|
Read xml header from fileName. Finds the end of the xml header and reads it Definition at line 253 of file XMLBinaryFile.cpp. References binaryBegining, and fileName. |
|
Size of xml header, or equivalently, pos of begining of bin data. Only used when reading Definition at line 126 of file XMLBinaryFile.hpp. Referenced by ReadXMLHeader(). |