A serialization library for the D programming language.
D Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
candydoc @ 56c6d78 Add candydoc. Jan 10, 2012
orange
tests Return proper exit code for failing tests Jul 15, 2016
wiki
.gitignore
.gitmodules
.travis.yml
Makefile
Makefile.win
README.markdown
docs.sh
dsss.conf
dub.sdl
modules.ddoc Add script to generate documentation. Mar 24, 2013
orange.orbspec
unittest.sh

README.markdown

Orange Build Status Go to orange

Orange is a serialization library for the D programming language. It supports D1/Tango and D2/Phobos. It can serialize most of the available types in D, including third party types and can serialize through base class references. It supports fully automatic serialization of all supported types and also supports several ways to customize the serialization process. Orange has a separate front end (the serializer) and back end (the archive) making it possible for the user to create new archive types that can be used with the existing serializer.

Building

Requirements

Building

  1. Install all requirements
  2. Clone the repository
  3. Run dub build

Unit Tests

Run the unit tests using Dub dub test

Simple Usage Example

module main;

import orange.serialization._;
import orange.serialization.archives._;

class Foo
{
    int a;
}

void main ()
{
    auto foo = new Foo; // create something to serialize
    foo.a = 3; // change the default value of "a"

    auto archive = new XmlArchive!(char); // create an XML archive
    auto serializer = new Serializer(archive); // create the serializer

    serializer.serialize(foo); // serialize "foo"

    // deserialize the serialized data as an instance of "Foo"
    auto f = serializer.deserialize!(Foo)(archive.untypedData);

    // verify that the deserialized value is equal to the original value
    assert(f.a == foo.a);
}

More Examples

See the test directory for some examples.

D Versions

  • D2/Phobos - master branch
  • D2/Tango - See the mambo repository. The API is the same, just replace "orange" with "mambo" for the imports
  • D1/Tango - d1 branch
  • D1/Tango and D2/Phobos in the same branch - mix branch