|
|
SerialTree is a simple Serializer and Deserializer which currently can be saved to & loaded from XML if your Qt has XML support. It should also have saveToTextFile and loadFromTextFile methods, but at the moment, it doesn't.
I would probably be using STL if I had a larger brain.
friend std::ostream & operator << (std::ostream&, SerialTree &)
| operator << |
SerialTree ()
| SerialTree |
Creates an empty SerialTree node.
~SerialTree ()
| ~SerialTree |
[virtual]
void get (const QString &key, QString &rv, const QString &defaultVal = QString())
| get |
[const]
Searches the given node for a child element with the given key, and places its contents in rv. If no child with the given key is found, the given default value is used.
Reimplemented from Deserializer.
void get (const QString &key, Serializable *&rv, const QString &dfltClassName, Serializable *dflt = NULL)
| get |
[const]
This is just like the other getSerializable() method, except that it also takes a default class name to be used if the child element doesn't specify a class. This is just so that files which have dozens of objects all of the same class don't need to specify the class in every element.
Reimplemented from Deserializer.
void get (const QString &key, std::vector | get |
[const]
See Deserializer::get(const QString &, std::vector
Reimplemented from Deserializer.
void get (const QString &key, QStringList &list)
| get |
[const]
Reimplemented from Deserializer.
void put (const QString &key, const QString &val)
| put |
Creates and appends a new child node containing the given string value.
Reimplemented from Serializer.
void put (const QString &key, const Serializable *val)
| put |
This causes the given Serializable to store itself into a new node, which is appended as a child to the given node.
Reimplemented from Serializer.
void put (const QString &key, int val)
| put |
Reimplemented from Serializer.
void put (const QString &key, unsigned val)
| put |
Reimplemented from Serializer.
void put (const QString &key, bool val)
| put |
Reimplemented from Serializer.
void put (const QString &key, float val)
| put |
Reimplemented from Serializer.
void put (const QString &key, double val)
| put |
Reimplemented from Serializer.
void get (const QString &key, int &rv, int defaultVal = 0)
| get |
[const]
Reimplemented from Deserializer.
void get (const QString &key, unsigned &rv, unsigned defaultVal = 0)
| get |
[const]
Reimplemented from Deserializer.
void get (const QString &key, bool &rv, bool defaultVal = false)
| get |
[const]
Reimplemented from Deserializer.
void get (const QString &key, float &rv, float defaultVal = 0.0)
| get |
[const]
Reimplemented from Deserializer.
void get (const QString &key, double &rv, double defaultVal = 0.0)
| get |
[const]
Reimplemented from Deserializer.
template | get |
[const]
Just a wrapper around the version inherited from Deserializer. See test/why.cpp for a lengthier complaint.
Reimplemented from Deserializer.
template | get |
[const]
Just a wrapper around the version inherited from Deserializer. See test/why.cpp for a lengthier complaint.
Reimplemented from Deserializer.
template | get |
[const]
Just a wrapper around the version inherited from Deserializer. See test/why.cpp for a lengthier complaint.
Reimplemented from Deserializer.
void setSerializableClass (const char *name)
| setSerializableClass |
This sets the name of the Serializable subclass name, so that the same class can be instantiated from this node later.
Reimplemented from Serializer.
const char * getSerializableClass ()
| getSerializableClass |
[const]
This returns the name of the class which stored itself to the given node, if any.
Reimplemented from Deserializer.
void dumpTree (QString indent = "")
| dumpTree |
[const]
Print debugging information about the structure & contents of a node and all of its children to cout.
SerialTree * loadFromFile (const QString &filename)
| loadFromFile |
[static]
Opens the given filename and attempts to load its contents into a SerialTree. If successful, it returns the new tree, which the caller is responsible for deleting. Otherwise, it returns NULL, and you must consult steaming goat entrails to ascertain the reason.
(Basically this attempts to determine whether the file contains XML or plain text, and then calls loadFromXMLFile() or loadFromTextFile().)
template | loadFromFile |
[static]
Opens the given filename and attempts to load its contents into a SerialTree. If successful, it tries to retrieve a Serializable of the given class from the given node. If successful, it sets rv to the new Serializable, which the caller is responsible for deleting. Otherwise, it returns NULL, and you must consult steaming goat entrails to ascertain the reason.
SerialTree * loadFromXMLFile (const QString &filename)
| loadFromXMLFile |
[static]
Opens the given filename and attempts to load its contents into a SerialTree. If successful, it returns the new tree, which the caller is responsible for deleting. Otherwise, it returns NULL, and you must consult steaming goat entrails to ascertain the reason.
SerialTree * loadFromDomDoc ( QDomDocument &xdoc )
| loadFromDomDoc |
[static]
Just like loadFromXLMFile() except that it takes a QDomDocument.
SerialTree * loadFromXMLString ( const QString &xmlstuff )
| loadFromXMLString |
[static]
Just like loadFromXLMFile() except that it takes a QString which contains XML code.
bool saveToXMLFile (const QString &filename, int mode = 0, int gzipLevel = 0)
| saveToXMLFile |
Opens the given filename and attempts to save the tree as XML. If you want to append to the file instead of stomping its contents, the optional mode argument should be IO_Append (defined in qiodevice.h). NOTE that's being ignored right now.
bool saveXMLToStream (std::ostream &os)
| saveXMLToStream |
Writes XML data to the given ostream. Returns false if the XML data is 0 bytes, else true.
SerialTree * loadFromTextStream (QTextStream &is)
| loadFromTextStream |
[static]
Attempts to read a SerialTree as text from the given input stream. If successful, it returns the new tree, which the caller is responsible for deleting. Otherwise, it returns NULL, and you must consult steaming goat entrails to ascertain the reason.
bool saveToTextStream (std::ostream &os)
| saveToTextStream |
Save the tree as text to the given output stream.
QString toString ()
| toString |
Returns an XML string.
bool saveToTextStream ( QTextStream &os, int indent=2)
| saveToTextStream |
SerialTree * decode ( QDropEvent *event )
| decode |
[static]
SerialTree * loadFromTextFile (const QString &filename)
| loadFromTextFile |
[static]
Opens the given filename and attempts to load its contents into a SerialTree. If successful, it returns the new tree, which the caller is responsible for deleting. Otherwise, it returns NULL, and you must consult steaming goat entrails to ascertain the reason.
bool saveToTextFile (const QString &filename, int mode = 0)
| saveToTextFile |
Opens the given filename and attempts to save the tree as text. If you want to append to the file instead of stomping its contents, the optional mode argument should be IO_Append (defined in qiodevice.h). NOTE that's being ignored right now.
SerialTree * loadFromBinaryStream (QDataStream &is)
| loadFromBinaryStream |
[static]
Attempts to read a SerialTree in binary from the given input stream. If successful, it returns the new tree, which the caller is responsible for deleting. Otherwise, it returns NULL, and you must consult steaming goat entrails to ascertain the reason.
bool saveToBinaryStream (QDataStream &os, int version = 0)
| saveToBinaryStream |
Save the tree as binary to the given output stream.
The version number is 1 for version 1, 2 for version 2, or 0 for the default (which depends on whether BOZO_CONTEXT is set in SerialTree.h).
SerialTree * loadFromBinaryFile (const QString &filename)
| loadFromBinaryFile |
[static]
Opens the given filename and attempts to load its contents into a SerialTree. If successful, it returns the new tree, which the caller is responsible for deleting. Otherwise, it returns NULL, and you must consult steaming goat entrails to ascertain the reason.
bool saveToBinaryFile (const QString &filename, int verson = 0, int mode = 0)
| saveToBinaryFile |
Opens the given filename and attempts to save the tree as binary. If you want to append to the file instead of stomping its contents, the optional mode argument should be IO_Append (defined in qiodevice.h). NOTE that's being ignored right now.
The version number is 1 for version 1, 2 for version 2, or 0 for the default (which depends on whether BOZO_CONTEXT is set in SerialTree.h).
template | clone |
[static]
Copies the object by serializing & deserializing it. (Maybe not the most efficient way, but it's easy...)
If a Deserialization::Context is given, it will be passed to pushContext() before deserialization, and deleted afterwards.
Generated by: stephan on cheyenne on Mon Aug 11 14:06:52 2003, using kdoc 2.0a54. |