Mercurial > projects > orange
view orange/serialization/Events.d @ 44:1fef41162966
Fixed deserialization of whcar for D2. Fixed events for D2.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 09 Aug 2011 10:11:14 +0200 |
parents | 8b9409423740 |
children |
line wrap: on
line source
/** * Copyright: Copyright (c) 2010 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Jan 26, 2010 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module orange.serialization.Events; import orange.util._; template OnDeserialized (alias method) { orange.serialization.Events.Event!(method) __onDeserialized; } template OnDeserializing (alias method) { orange.serialization.Events.Event!(method) __onDeserializing; } template OnSerialized (alias method) { orange.serialization.Events.Event!(method) __onSerialized; } template OnSerializing (alias method) { orange.serialization.Events.Event!(method) __onSerializing; } struct Event (alias m) { version (Tango) private const method = &m; else mixin("private enum method = &m;"); void opCall (T) (T value) { void delegate () dg; dg.ptr = cast(void*) value; dg.funcptr = method; dg(); } } package: const onDeserializedField = "__onDeserialized"; const onDeserializingField = "__onDeserializing"; const onSerializedField = "__onSerialized"; const onSerializingField = "__onSerializing";