Mercurial > projects > orange
annotate 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 |
rev | line source |
---|---|
0 | 1 /** |
2 * Copyright: Copyright (c) 2010 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Jan 26, 2010 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module orange.serialization.Events; | |
8 | |
9 import orange.util._; | |
10 | |
11 template OnDeserialized (alias method) | |
12 { | |
13 orange.serialization.Events.Event!(method) __onDeserialized; | |
14 } | |
15 | |
16 template OnDeserializing (alias method) | |
17 { | |
18 orange.serialization.Events.Event!(method) __onDeserializing; | |
19 } | |
20 | |
21 template OnSerialized (alias method) | |
22 { | |
23 orange.serialization.Events.Event!(method) __onSerialized; | |
24 } | |
25 | |
26 template OnSerializing (alias method) | |
27 { | |
28 orange.serialization.Events.Event!(method) __onSerializing; | |
29 } | |
30 | |
31 struct Event (alias m) | |
32 { | |
44
1fef41162966
Fixed deserialization of whcar for D2. Fixed events for D2.
Jacob Carlborg <doob@me.com>
parents:
42
diff
changeset
|
33 version (Tango) |
1fef41162966
Fixed deserialization of whcar for D2. Fixed events for D2.
Jacob Carlborg <doob@me.com>
parents:
42
diff
changeset
|
34 private const method = &m; |
1fef41162966
Fixed deserialization of whcar for D2. Fixed events for D2.
Jacob Carlborg <doob@me.com>
parents:
42
diff
changeset
|
35 |
1fef41162966
Fixed deserialization of whcar for D2. Fixed events for D2.
Jacob Carlborg <doob@me.com>
parents:
42
diff
changeset
|
36 else |
1fef41162966
Fixed deserialization of whcar for D2. Fixed events for D2.
Jacob Carlborg <doob@me.com>
parents:
42
diff
changeset
|
37 mixin("private enum method = &m;"); |
0 | 38 |
39 void opCall (T) (T value) | |
40 { | |
41 void delegate () dg; | |
42 dg.ptr = cast(void*) value; | |
43 dg.funcptr = method; | |
44 dg(); | |
45 } | |
46 } | |
47 | |
42
8b9409423740
Added unit tests for (de)serializing events.
Jacob Carlborg <doob@me.com>
parents:
0
diff
changeset
|
48 package: |
8b9409423740
Added unit tests for (de)serializing events.
Jacob Carlborg <doob@me.com>
parents:
0
diff
changeset
|
49 |
8b9409423740
Added unit tests for (de)serializing events.
Jacob Carlborg <doob@me.com>
parents:
0
diff
changeset
|
50 const onDeserializedField = "__onDeserialized"; |
8b9409423740
Added unit tests for (de)serializing events.
Jacob Carlborg <doob@me.com>
parents:
0
diff
changeset
|
51 const onDeserializingField = "__onDeserializing"; |
8b9409423740
Added unit tests for (de)serializing events.
Jacob Carlborg <doob@me.com>
parents:
0
diff
changeset
|
52 const onSerializedField = "__onSerialized"; |
8b9409423740
Added unit tests for (de)serializing events.
Jacob Carlborg <doob@me.com>
parents:
0
diff
changeset
|
53 const onSerializingField = "__onSerializing"; |