Deserializes and returns a serialized value.
Deserializes and returns a serialized value, interpreting values according to Policy when possible.
Attribute for overriding the field name during (de-)serialization.
Serializes a value with the given serializer.
Serializes a value with the given serializer, representing values according to Policy when possible.
Attribute for representing a struct/class as an array instead of an object.
Attribute for forcing serialization of enum fields by name instead of by value.
Attribute for marking non-serialized fields.
Attribute marking a field as optional during deserialization.
User defined attribute (not intended for direct use)
User defined attribute (not intended for direct use)
Chains serialization policy.
Checks if a given type has a custom serialization representation.
Checks if a given type has an ISO extended string serialization representation.
Checks if a given policy supports custom serialization for a given type.
Checks if a given type has a string serialization representation.
The following rules are applied in order when serializing or deserializing a certain type:
Note that no aliasing detection is performed, so that pointers, class references and arrays referencing the same memory will be serialized as multiple copies. When in turn deserializing the data, they will also end up as separate copies in memory.
Serializers are implemented in terms of a struct with template methods that get called by the serialization framework:
struct ExampleSerializer { enum isSupportedValueType(T) = is(T == string) || is(T == typeof(null)); // serialization auto getSerializedResult(); void beginWriteDictionary(T)(); void endWriteDictionary(T)(); void beginWriteDictionaryEntry(T)(string name); void endWriteDictionaryEntry(T)(string name); void beginWriteArray(T)(size_t length); void endWriteArray(T)(); void beginWriteArrayEntry(T)(size_t index); void endWriteArrayEntry(T)(size_t index); void writeValue(T)(T value); // deserialization void readDictionary(T)(scope void delegate(string) entry_callback); void readArray(T)(scope void delegate(size_t) size_callback, scope void delegate() entry_callback); T readValue(T)(); bool tryReadNull(); }
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
© 2013-2014 rejectedsoftware e.K.
Generic serialization framework.
This module provides general means for implementing (de-)serialization with a standardized behavior.