Abstract class that defines an interface that allows working with elements. More...
#include <Valuable/Archive.hpp>
Public Member Functions | |
| Archive (unsigned int options=DEFAULTS) | |
| Creates a new Archive and initializes the SerializationOptions with given options. More... | |
| virtual ArchiveElement | createElement (const QString &name)=0 |
| Create a new element with correct implementation. More... | |
| virtual bool | readFromFile (const QString &filename)=0 |
| Reads the archive from a file. More... | |
| virtual bool | readFromMem (const QByteArray &buffer)=0 |
| virtual ArchiveElement | root () const =0 |
| Query the root element. More... | |
| virtual void | setRoot (const ArchiveElement &element)=0 |
| Sets the root element. More... | |
| virtual bool | writeToFile (const QString &filename) const =0 |
| Writes the archive to file. More... | |
| virtual bool | writeToMem (QByteArray &buffer) const =0 |
| Write the archive to memory buffer. More... | |
| virtual DOMDocument * | xml () |
| If this is actually a XMLArchive, return the wrapped DOMDocument. More... | |
| virtual | ~Archive () |
| Default destructor does nothing. | |
Public Member Functions inherited from Valuable::SerializationOptions | |
| bool | checkFlags (Options flag) |
| Check if given flag is enabled. More... | |
| SerializationOptions (unsigned int options=DEFAULTS) | |
| Construct an options object with given flags. | |
| void | setOptions (Options flags) |
| Set the options for serialization. | |
Additional Inherited Members | |
Public Types inherited from Valuable::SerializationOptions | |
| enum | Options { LAYER_DEFAULT = 1 << 0, LAYER_STYLE = 1 << 1, LAYER_USER = 1 << 2, LAYER_STYLE_IMPORTANT = 1 << 3, DEFAULTS = LAYER_USER, ONLY_CHANGED = LAYER_STYLE | LAYER_USER | LAYER_STYLE_IMPORTANT, EVERYTHING = LAYER_DEFAULT | LAYER_STYLE | LAYER_USER | LAYER_STYLE_IMPORTANT } |
| Serialization bitflags. More... | |
Protected Attributes inherited from Valuable::SerializationOptions | |
| unsigned int | m_options |
| Actual bitmask of flags. | |
Abstract class that defines an interface that allows working with elements.
Different kinds of backends (XML, binary, etc..) should inherit from this class. There always should be an Archive-implementation and an ArchiveElementImpp-implementation, that are designed to work together.
Every time Serializable objects are being serialized, the recursive serialize() calls will have one Archive object as a parameter. It keeps the serialization state and options with the help of SerializationOptions.
Archive has one "root" ArchiveElement, that may have child elements.
| Valuable::Archive::Archive | ( | unsigned int | options = DEFAULTS | ) |
Creates a new Archive and initializes the SerializationOptions with given options.
| options | Bitmask of SerializationOptions::Options |
|
pure virtual |
Create a new element with correct implementation.
| name | Name of the element. |
Implemented in Valuable::XMLArchive.
|
pure virtual |
Reads the archive from a file.
| filename | Absolute or relative filepath |
Implemented in Valuable::XMLArchive.
|
pure virtual |
|
pure virtual |
Sets the root element.
| element | New element that should be set as a new root element |
Implemented in Valuable::XMLArchive.
|
pure virtual |
Writes the archive to file.
| filename | Absolute or relative filepath |
Implemented in Valuable::XMLArchive.
|
pure virtual |
Write the archive to memory buffer.
| buffer | The output buffer where the archive is written |
Implemented in Valuable::XMLArchive.
|
virtual |
If this is actually a XMLArchive, return the wrapped DOMDocument.
Reimplemented in Valuable::XMLArchive.