13#ifndef ML_XMLPERSISTENCE_STREAM_H
14#define ML_XMLPERSISTENCE_STREAM_H
83 bool isBinary()
const override {
return false; }
85 void writeString(
const char* name,
const std::string& value)
override;
87 void writeData(
const void* data,
size_t len,
const char* name)
override;
110 void _writeValuesT(
const char* name,
const T* values,
size_t n,
bool fixedList);
113 void _setAttribute(
const char*
attrName,
const char* value);
114 void _setAttribute(
const char*
attrName,
int value);
118 void _createScope(
const char* tagName);
157 void readString(
const char* name, std::string& value)
override;
159 void readData(std::string& value,
const char* name)
override;
188 void _readValuesT(
const char* name,
size_t expected, std::vector<T>& values);
191 bool _getAttribute(
const char*
attrName, std::string& value);
192 bool _getAttribute(
const char*
attrName,
int& value);
195 bool _checkElement(
const char* name,
bool throwError =
true);
198 void _toNextElement(
bool reset =
false);
201 void _enterScope(
const char* tagName);
Class for writing object data to a stream.
Implementation for AbstractPersistenceOutputStream using Xerces DOM Parser.
virtual void writeToFile(const std::string &fileName)
Writes the complete tree to a file.
XMLPersistenceOutputStream()
this constructor creates a new XML document that can be written afterwards with writeToFile or writeT...
void writeValues(const char *name, const MLuint32 *values, size_t n, bool fixedList) override
void writeData(const void *data, size_t len, const char *name) override
Write binary data to stream.
void writeValues(const char *name, const MLdouble *values, size_t n, bool fixedList) override
void endStructImpl() override
void writeValues(const char *name, const MLint32 *values, size_t n, bool fixedList) override
Abstract writing methods that need to be implemented by derived classes.
void startStructImpl(const char *name) override
bool isBinary() const override
overridden methods
virtual void writeToString(std::string &str)
Writes the subtree rooted by this node to a string.
void writeString(const char *name, const std::string &value) override
Abstract writing method that needs to be implemented by derived classes.
XMLPersistenceOutputStream(DOMElement *container)
this constructor takes an existing XML element - everything will be written relative to this element
virtual ~XMLPersistenceOutputStream()
this will free the XML document if the first constructor was used
void startListImpl(const char *name, const char *xmlItemName, bool xmlSuppressScope) override
Abstract methods called by above methods, need to be implemented in derived classes.
void setObjectID(int id) override
Implementation of Base object persistence, set attribute on currently open struct (implementation hin...
void writeValues(const char *name, const MLfloat *values, size_t n, bool fixedList) override
void writeValues(const char *name, const MLint64 *values, size_t n, bool fixedList) override
void endListImpl() override
void setObjectVersion(int version) override
persistence version
void setObjectType(const char *type) override
base type name
void writeValues(const char *name, const MLuint64 *values, size_t n, bool fixedList) override
mix-in class that manages a stack of names for list elements and if the parent scope of the list is s...
std::list< ListStackEntry > _listStack
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
UINT64 MLuint64
Introduce platform independent 64 bit unsigned integer type.
INT64 MLint64
Include 64 bit integer support for Windows or Unix.
Implement the AbstractPersistence(Input/Output)Stream classes with XML backend.
ListStackEntry(const char *anItemName, bool aSuppressScope)