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;
90 void startListImpl(
const char* name,
const char* xmlItemName,
bool xmlSuppressScope)
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);
124 DOMElement* _rootNode;
126 DOMElement* _currentNode;
157 void readString(
const char* name, std::string& value)
override;
159 void readData(std::string& value,
const char* name)
override;
162 void startListImpl(
const char* name,
const char* xmlItemName,
bool xmlSuppressScope)
override;
174 void readValues(
const char* name,
size_t expected, std::vector<MLint32>& values)
override;
175 void readValues(
const char* name,
size_t expected, std::vector<MLuint32>& values)
override;
176 void readValues(
const char* name,
size_t expected, std::vector<MLint64>& values)
override;
177 void readValues(
const char* name,
size_t expected, std::vector<MLuint64>& values)
override;
178 void readValues(
const char* name,
size_t expected, std::vector<MLfloat>& values)
override;
179 void readValues(
const char* name,
size_t expected, std::vector<MLdouble>& values)
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);
207 DOMElement* _rootNode;
209 DOMElement* _currentNode;
211 DOMElement* _nextNode;
AbstractPersistenceOutputStream()
virtual void writeToFile(const std::string &fileName)
Writes the complete tree to a file.
XMLPersistenceOutputStream()
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
Writes 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
void startStructImpl(const char *name) override
bool isBinary() const override
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)
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
void setObjectID(int id) override
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
Sets persistence version.
void setObjectType(const char *type) override
Sets base type.
void writeValues(const char *name, const MLuint64 *values, size_t n, bool fixedList) override
std::list< ListStackEntry > _listStack
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)