comparison generator/typesystem_core-java.java @ 252:37eed70de029

More things broken than fixed. Rolling back to 263
author maxter
date Sat, 22 Aug 2009 12:50:58 +0000
parents 7664de4a55e5
children 073b9153ed8a
comparison
equal deleted inserted replaced
251:739d0ee5bd91 252:37eed70de029
20 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and 20 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
21 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special 21 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special
22 * exception, Nokia gives you certain additional rights. These rights 22 * exception, Nokia gives you certain additional rights. These rights
23 * are described in the Nokia Qt GPL Exception version 1.2, included in 23 * are described in the Nokia Qt GPL Exception version 1.2, included in
24 * the file GPL_EXCEPTION.txt in this package. 24 * the file GPL_EXCEPTION.txt in this package.
25 * 25 *
26 * Qt for Windows(R) Licensees 26 * Qt for Windows(R) Licensees
27 * As a special exception, Nokia, as the sole copyright holder for Qt 27 * As a special exception, Nokia, as the sole copyright holder for Qt
28 * Designer, grants users of the Qt/Eclipse Integration plug-in the 28 * Designer, grants users of the Qt/Eclipse Integration plug-in the
29 * right for the Qt/Eclipse Integration to link to functionality 29 * right for the Qt/Eclipse Integration to link to functionality
30 * provided by Qt Designer and its related libraries. 30 * provided by Qt Designer and its related libraries.
44 import qt.*; 44 import qt.*;
45 import qt.core.*; 45 import qt.core.*;
46 46
47 class QObject___ extends QObject { 47 class QObject___ extends QObject {
48 48
49 /* TODO: test whether the linked list is really a better solution
50 public bool __stackAllocated = false; 49 public bool __stackAllocated = false;
50
51 public bool __qobject_is_deleting = false;
51 52
52 new(size_t size, void* p = null) 53 new(size_t size, void* p = null)
53 { 54 {
54 if (!p) 55 if (!p)
55 { 56 {
69 free(p); 70 free(p);
70 GC.removeRange(p); 71 GC.removeRange(p);
71 } 72 }
72 } 73 }
73 } 74 }
74 */
75 75
76 private 76 // list of QObjects references to prevent them from garbage collecting if they are managed by Qt
77 { 77 private static QObject[] __gc_ref_list;
78 static QObject __root;
79 QObject __next;
80 QObject __prev;
81 }
82 78
83 ~this() 79 // this flag needs to be set false when QObject is deleted from inside Qt so when deleting it from D it won't delete C++ object
84 { 80 public bool __no_real_delete = false;
85 if (__prev)
86 __prev.__next = __next;
87 else
88 __root = __next;
89
90 if (__next)
91 __next.__prev = __prev;
92 }
93
94 /**
95 */
96 T findChild(T : QObject = QObject)(string name = null)
97 {
98 foreach (obj; children)
99 {
100 auto tmp = cast(T)obj;
101 if (tmp && (!name.length || tmp.objectName == name))
102 return tmp;
103
104 tmp = obj.findChild!(T)(name);
105 if (tmp)
106 return tmp;
107 }
108
109 return null;
110 }
111
112 /**
113 */
114 T[] findChildren(T : QObject = QObject)(string name = null)
115 {
116 T[] result;
117
118 void find(QObject[] objects)
119 {
120 foreach (obj; objects)
121 {
122 auto tmp = cast(T)obj;
123 if (tmp && (!name.length || tmp.objectName == name))
124 result ~= tmp;
125 find(obj.children);
126 }
127 }
128
129 find(children);
130 return result;
131 }
132 }// class 81 }// class
133 82
134 abstract class QAbstractItemModel___ extends QAbstractItemModel { 83 abstract class QAbstractItemModel___ extends QAbstractItemModel {
135 /* private native boolean setData_native(long id, int row, int col, Object value, int role); 84 /* private native boolean setData_native(long id, int row, int col, Object value, int role);
136 85
190 139
191 this(string[] args) 140 this(string[] args)
192 { 141 {
193 // if (m_instance != null) 142 // if (m_instance != null)
194 // throw new RuntimeException("QCoreApplication can only be initialized once"); 143 // throw new RuntimeException("QCoreApplication can only be initialized once");
195 144
196 argc = args.length; 145 argc = args.length;
197 argv = toStringzArray(args); 146 argv = toStringzArray(args);
198 this(&argc, argv); 147 this(&argc, argv);
199 148
200 // m_instance.aboutToQuit.connect(m_instance, "disposeOfMyself()"); 149 // m_instance.aboutToQuit.connect(m_instance, "disposeOfMyself()");
201 } 150 }
202 151
203 private int argc; 152 private int argc;
204 private char **argv; 153 private char **argv;
205 /* 154 /*
206 public static string translate(string context, string key, string disambiguation, QCoreApplication_Encoding encoding) { 155 public static string translate(string context, string key, string disambiguation, QCoreApplication_Encoding encoding) {
207 string res; 156 string res;
538 } 487 }
539 */ 488 */
540 489
541 public final long write(string str) { 490 public final long write(string str) {
542 return write(str.ptr, str.length); 491 return write(str.ptr, str.length);
543 } 492 }
544 }// class 493 }// class
545 494
546 class QCryptographicHash___ extends QCryptographicHash { 495 class QCryptographicHash___ extends QCryptographicHash {
547 496
548 public final void addData(byte data[]) { 497 public final void addData(byte data[]) {