Mercurial > projects > qtd
comparison cpp/qt_qtd/qtd_core.cpp @ 357:9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Q_CLASSINFO implementation
Now Qtd can be built on Windows
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Wed, 02 Jun 2010 19:38:05 +0300 |
parents | 08c1ca7975ab |
children | 12f60887ed15 a032df77b6ab |
comparison
equal
deleted
inserted
replaced
356:12cec2d14e1c | 357:9784459f0750 |
---|---|
1 /** | 1 /** |
2 * | 2 Copyright: Copyright QtD Team, 2008-2010 |
3 * Copyright: Copyright QtD Team, 2008-2009 | 3 License: Boost License 1.0 |
4 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> | 4 */ |
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 | 5 |
12 #include "qtd_core.h" | 6 #include "qtd_core.h" |
13 #include <iostream> | 7 #include <iostream> |
14 | 8 |
15 uint userDataId; | 9 QTD_EXPORT(CORE, toUtf8); |
10 QTD_EXPORT(CORE, QtdObject_delete); | |
16 | 11 |
17 extern "C" DLL_PUBLIC QModelIndex qtd_to_QModelIndex(QModelIndexAccessor mia) | 12 QTD_EXTERN QTD_DLL_EXPORT void qtd_initCore() |
13 { | |
14 QObjectLink::userDataId = QObject::registerUserData(); | |
15 } | |
16 | |
17 QTD_EXTERN QTD_DLL_PUBLIC QModelIndex qtd_to_QModelIndex(QModelIndexAccessor mia) | |
18 { | 18 { |
19 return * (QModelIndex *) (&mia) ; | 19 return * (QModelIndex *) (&mia) ; |
20 } | 20 } |
21 | 21 |
22 extern "C" DLL_PUBLIC QModelIndexAccessor qtd_from_QModelIndex(const QModelIndex &index) | 22 QTD_EXTERN QTD_DLL_PUBLIC QModelIndexAccessor qtd_from_QModelIndex(const QModelIndex &index) |
23 { | 23 { |
24 QModelIndexAccessor mia = { | 24 QModelIndexAccessor mia = { |
25 index.row(), | 25 index.row(), |
26 index.column(), | 26 index.column(), |
27 index.internalPointer(), | 27 index.internalPointer(), |
29 }; | 29 }; |
30 | 30 |
31 return mia; | 31 return mia; |
32 } | 32 } |
33 | 33 |
34 extern "C" DLL_PUBLIC const char* qtd_qVersion() | 34 QTD_EXTERN QTD_DLL_PUBLIC const char* qtd_qVersion() |
35 { | 35 { |
36 return qVersion(); | 36 return qVersion(); |
37 } | 37 } |
38 | 38 |
39 extern "C" DLL_PUBLIC bool qtd_qSharedBuild() | 39 QTD_EXTERN QTD_DLL_PUBLIC bool qtd_qSharedBuild() |
40 { | 40 { |
41 return qSharedBuild(); | 41 return qSharedBuild(); |
42 } | 42 } |
43 | |
44 //TODO: this has to be replaced with something that makes some sense | |
45 #ifdef CPP_SHARED | |
46 QTD_EXPORT_VAR(qtd_toUtf8); | |
47 QTD_EXPORT_VAR(qtd_QtdObject_delete); | |
48 | |
49 extern "C" DLL_PUBLIC void qtd_core_initCallBacks(pfunc_abstr d_func, pfunc_abstr del_d_qobj) { | |
50 QTD_EXPORT_VAR_SET(qtd_toUtf8, d_func); | |
51 QTD_EXPORT_VAR_SET(qtd_QtdObject_delete, del_d_qobj); | |
52 | |
53 userDataId = QObject::registerUserData(); | |
54 } | |
55 #endif | |
56 | 43 |
57 extern bool qRegisterResourceData | 44 extern bool qRegisterResourceData |
58 (int, const unsigned char *, const unsigned char *, const unsigned char *); | 45 (int, const unsigned char *, const unsigned char *, const unsigned char *); |
59 | 46 |
60 extern bool qUnregisterResourceData | 47 extern bool qUnregisterResourceData |
61 (int, const unsigned char *, const unsigned char *, const unsigned char *); | 48 (int, const unsigned char *, const unsigned char *, const unsigned char *); |
62 | 49 |
63 extern "C" DLL_PUBLIC bool qtd_register_resource_data(int version, const unsigned char *tree, | 50 QTD_EXTERN QTD_DLL_PUBLIC bool qtd_register_resource_data(int version, const unsigned char *tree, |
64 const unsigned char *name, const unsigned char *data) | 51 const unsigned char *name, const unsigned char *data) |
65 { | 52 { |
66 return qRegisterResourceData(version, tree, name, data); | 53 return qRegisterResourceData(version, tree, name, data); |
67 } | 54 } |
68 | 55 |
69 extern "C" DLL_PUBLIC bool qtd_unregister_resource_data(int version, const unsigned char *tree, | 56 QTD_EXTERN QTD_DLL_PUBLIC bool qtd_unregister_resource_data(int version, const unsigned char *tree, |
70 const unsigned char *name, const unsigned char *data) | 57 const unsigned char *name, const unsigned char *data) |
71 { | 58 { |
72 return qUnregisterResourceData(version, tree, name, data); | 59 return qUnregisterResourceData(version, tree, name, data); |
73 } | 60 } |
74 | 61 |
80 QtdObjectLink(dId), | 67 QtdObjectLink(dId), |
81 flags(None) | 68 flags(None) |
82 { | 69 { |
83 qObject->setUserData(userDataId, this); | 70 qObject->setUserData(userDataId, this); |
84 } | 71 } |
72 | |
73 uint QObjectLink::userDataId; | |
85 | 74 |
86 QObjectLink* QObjectLink::getLink(const QObject *qObject) | 75 QObjectLink* QObjectLink::getLink(const QObject *qObject) |
87 { | 76 { |
88 return static_cast<QObjectLink*>(qObject->userData(userDataId)); | 77 return static_cast<QObjectLink*>(qObject->userData(userDataId)); |
89 } | 78 } |