Mercurial > projects > qtd
comparison qt/d1/qt/QtdObject.d @ 253:073b9153ed8a
Rev. 264 done right.
Problems:
- classwizard segfaults on exit due to a bug in signals/slots or runtime.
- hellogl doesn't compile with dmd2 due to a bug in the compiler backend
author | maxter |
---|---|
date | Sun, 30 Aug 2009 09:59:12 +0000 |
parents | |
children | b1abe7f57321 |
comparison
equal
deleted
inserted
replaced
252:37eed70de029 | 253:073b9153ed8a |
---|---|
1 /** | |
2 * | |
3 * Copyright: Copyright QtD Team, 2008-2009 | |
4 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> | |
5 * | |
6 * Copyright QtD Team, 2008-2009 | |
7 * Distributed under the Boost Software License, Version 1.0. | |
8 * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
9 * | |
10 */ | |
11 | |
12 module qt.QtdObject; | |
13 | |
14 import qt.Signal; | |
15 //import tango.io.Stdout; | |
16 | |
17 enum QtdObjectFlags : ubyte | |
18 { | |
19 none, | |
20 nativeOwnership = 0x1, | |
21 dOwnership = 0x2, | |
22 dynamicEntity = 0x4 | |
23 //gcManaged = 0x4 | |
24 } | |
25 | |
26 package abstract class QtdObject | |
27 { | |
28 protected QtdObjectFlags __flags_; | |
29 void* __nativeId; | |
30 | |
31 mixin SignalHandlerOps; | |
32 | |
33 this(void* nativeId, QtdObjectFlags flags = QtdObjectFlags.none) | |
34 { | |
35 //Stdout.formatln("Created D object {} {:x}", nativeId, flags).newline; | |
36 __nativeId = nativeId; | |
37 __flags_ = flags; | |
38 } | |
39 | |
40 final QtdObjectFlags __flags() | |
41 { | |
42 return __flags_; | |
43 } | |
44 | |
45 /+ final +/ void __setFlags(QtdObjectFlags flags, bool value) | |
46 { | |
47 if (value) | |
48 __flags_ |= flags; | |
49 else | |
50 __flags_ &= ~flags; | |
51 } | |
52 | |
53 // COMPILER BUG: 3206 | |
54 protected void __deleteNative() | |
55 { | |
56 assert(false); | |
57 } | |
58 | |
59 ~this() | |
60 { | |
61 //Stdout.formatln("Deleting D object {}", __nativeId); | |
62 if (!(__flags_ & QtdObjectFlags.nativeOwnership)) | |
63 { | |
64 // avoid deleting D object twice. | |
65 //Stdout.formatln("About to delete native object {}", __nativeId); | |
66 __flags_ |= QtdObjectFlags.dOwnership; | |
67 __deleteNative; | |
68 } | |
69 //Stdout.formatln("Deleted native D object {}", __nativeId); | |
70 } | |
71 } | |
72 | |
73 class QtdMetaObject | |
74 { | |
75 private | |
76 { | |
77 void* _typeId; | |
78 QtdMetaObject _base; | |
79 } | |
80 | |
81 QtdMetaObject base() | |
82 { | |
83 return _base; | |
84 } | |
85 | |
86 this(void* typeId, QtdMetaObject base) | |
87 { | |
88 _typeId = typeId; | |
89 _base = base; | |
90 } | |
91 } |