#include <Serializer.h>
Inheritance diagram for fun::Serializer:
Public Methods | |
Serializer () | |
Creates an empty Serializer node. | |
virtual void | put (const QString &key, const QString &val)=0 |
Adds a new element containing the given string value. | |
void | put (const QString &key, const char *val) |
Adds a new element containing the given string value. | |
virtual void | put (const QString &key, int val) |
This is just like the string version of put(), except that it converts the given int value to a string. | |
virtual void | put (const QString &key, unsigned val) |
This is just like the string version of put(), except that it converts the given unsigned int value to a string. | |
virtual void | put (const QString &key, bool val) |
This is just like the string version of put(), except that it converts the given bool value to a string. | |
virtual void | put (const QString &key, float val) |
This is just like the string version of put(), except that it converts the given float value to a string. | |
virtual void | put (const QString &key, double val) |
This is just like the string version of put(), except that it converts the given double value to a string. | |
virtual void | put (const QString &key, const QColor &val) |
This is just like the string version of put(), except that it converts the given QColor value to a string in the format rrggbb. | |
virtual void | put (const QString &key, const Serializable *val)=0 |
Adds a new element containing the given Serializable value. | |
virtual void | put (const QString &key, const QPtrList< Serializable > &list) |
Calls put() for each element in the list. | |
template<class InputIterator> void | put (const QString &key, InputIterator begin, InputIterator end) |
Calls put() for each element in the list. | |
template<class SC> void | put (const QString &key, const QPtrList< SC > &list) |
Calls put() for each Serializable element in the list. | |
template<class SC> void | put (const QString &key, const SC *const *list, unsigned len) |
Calls put() for each Serializable element in the array of pointers. | |
virtual void | put (const QString &key, const QStringList &list) |
Calls put() for each element in the list. | |
virtual void | put (const QString &key, const QString *list, unsigned len) |
Calls put() for each element in the list. | |
virtual void | put (const QString &key, const QPoint &val) |
This is just like the string version of put(), except that it converts the given QPoint value to a string in the format "x,y". | |
virtual void | put (const QString &key, const QSize &val) |
This is just like the string version of put(), except that it converts the given QSize value to a string in the format "x,y". | |
virtual void | setSerializableClass (const char *name)=0 |
This sets the name of the Serializable subclass name, so that the same class can be instantiated during deserialization. | |
virtual void | setComment (const QString &key, const QString &comment) |
Sets an optional comment which will be associated with a child element. |
Depending on the subclass' implementation, the data may be stored natively, or it may be converted to strings, or stuck in a database, etc.
Think of a Serializer as taking key/value pairs of data, where the values may be Serializable objects, which implies a tree structure. Duplicate keys are allowed, but note that the only way to get at the values for duplicate keys in a Deserializer is to use one of the forms of get() which takes a reference to a list of Serializables or QStrings.
As Serializer is abstract, subclasses must provide implementations for the following methods:
Definition at line 54 of file Serializer.h.
|
Calls put() for each element in the list. Note that in the result there may be no way to tell "null" and "empty" strings apart. Definition at line 93 of file Serializer.cpp. References put(). |
|
Calls put() for each element in the list. Note that in the result there may be no way to tell "null" and "empty" strings apart. Definition at line 84 of file Serializer.cpp. References put(). |
|
Calls put() for each Serializable element in the array of pointers. NULL elements in the list will be ignored... nuts, that means you can't rely on it to deserialize the same way. OK, how about the behavior is undefined in that case, ha ha. Definition at line 225 of file Serializer.h. References put(). |
|
Calls put() for each Serializable element in the list. This is because even if Foo is a subclass of Serializable, QPtrList<Foo> can't be (or isn't being) treated as a QPtrList<Serializable>. Definition at line 210 of file Serializer.h. References put(). |
|
Calls put() for each element in the list. To serialize an entire std::vector<Serializable *>, call put(key, vec.begin(), vec.end()). Definition at line 130 of file Serializer.h. References put(). |
|
Adds a new element containing the given Serializable value. Passing a NULL Serializable here has the same effect as not calling it at all. This is one of the methods which subclasses must implement. Implemented in fun::SerialTree. |
|
Adds a new element containing the given string value. (this one is because put(key, "bleh") was calling the bool version!) Definition at line 73 of file Serializer.h. References put(). |
|
Adds a new element containing the given string value. This is one of the methods which subclasses must implement. Implemented in fun::SerialTree. Referenced by put(). |
|
Sets an optional comment which will be associated with a child element. Note that if you have multiple elements with the same key, you're probably only going to have one comment. The default base class behavior is to do nothing. Definition at line 113 of file Serializer.cpp. |
|
This sets the name of the Serializable subclass name, so that the same class can be instantiated during deserialization. Every Serializable's serialize() method should call this with its own class name after calling its superclass' serialize(). This is one of the methods which subclasses must implement. Implemented in fun::SerialTree. Referenced by fun::PropertyList::serialize(), fun::DieRoll::serialize(), and fun::ConfigFile::serialize(). |