Archive.archiveReference

Archives a reference.

A reference is reference to another value. For example, if an object is archived more than once, the first time it's archived it will actual archive the object. The second time the object will be archived a reference will be archived instead of the actual object.

This method is also used when archiving a pointer that points to a value that has been or will be archived as well.

interface Archive
void
archiveReference
(
string key
,)

Parameters

key string

the key associated with the reference

id Id

the id of the value this reference refers to

Examples

class Foo {}

class Bar
{
    Foo f;
    Foo f2;
}

auto bar = new Bar;
bar.f = new Foo;
bar.f2 = bar.f;

auto archive = new XmlArchive!();

// when achiving "bar"
archive.archiveObject(Foo.classinfo.name, "Foo", "f", 0, {});
archive.archiveReference("f2", 0); // archive a reference to "f"

Meta