QxOrm
1.5.0
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** https://www.qxorm.com/ 00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com) 00005 ** 00006 ** This file is part of the QxOrm library 00007 ** 00008 ** This software is provided 'as-is', without any express or implied 00009 ** warranty. In no event will the authors be held liable for any 00010 ** damages arising from the use of this software 00011 ** 00012 ** Commercial Usage 00013 ** Licensees holding valid commercial QxOrm licenses may use this file in 00014 ** accordance with the commercial license agreement provided with the 00015 ** Software or, alternatively, in accordance with the terms contained in 00016 ** a written agreement between you and Lionel Marty 00017 ** 00018 ** GNU General Public License Usage 00019 ** Alternatively, this file may be used under the terms of the GNU 00020 ** General Public License version 3.0 as published by the Free Software 00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the 00022 ** packaging of this file. Please review the following information to 00023 ** ensure the GNU General Public License version 3.0 requirements will be 00024 ** met : http://www.gnu.org/copyleft/gpl.html 00025 ** 00026 ** If you are unsure which license is appropriate for your use, or 00027 ** if you have questions regarding the use of this file, please contact : 00028 ** contact@qxorm.com 00029 ** 00030 ****************************************************************************/ 00031 00032 #ifndef _QX_REGISTER_H_ 00033 #define _QX_REGISTER_H_ 00034 00035 #ifdef _MSC_VER 00036 #pragma once 00037 #endif 00038 00046 #ifdef _MSC_VER 00047 #pragma warning(push) 00048 #pragma warning(disable:4996) 00049 #pragma warning(disable:4094) 00050 #endif // _MSC_VER 00051 00052 #include <QxCommon/QxConfig.h> 00053 #include <QxCommon/QxMacro.h> 00054 00055 #include <QxRegister/QxClass.h> 00056 #include <QxRegister/QxVersion.h> 00057 00058 #include <QxFactory/QxFactory.h> 00059 00060 #include <QxSerialize/QxSerializeInvoker.h> 00061 #include <QxSerialize/QxBoostSerializeHelper/QxBoostSerializeRegisterHelper.h> 00062 #include <QxSerialize/boost/QxExportDllMacroHpp.h> 00063 #include <QxSerialize/boost/QxExportDllMacroCpp.h> 00064 #include <QxSerialize/QDataStream/QxSerializeQDataStream_qx_registered_class.h> 00065 00066 #include <QxTraits/is_qx_registered.h> 00067 00068 #define QX_REGISTER_CLASS_MAPPING_FCT_HPP(dllImportExport, className) \ 00069 namespace qx { template <> dllImportExport void register_class(QxClass< className > & t) QX_USED; } 00070 00071 #define QX_REGISTER_SERIALIZE_QDATASTREAM_HPP(dllImportExport, className) \ 00072 dllImportExport QDataStream & operator<< (QDataStream & stream, const className & t) QX_USED; \ 00073 dllImportExport QDataStream & operator>> (QDataStream & stream, className & t) QX_USED; 00074 00075 #define QX_REGISTER_SERIALIZE_QDATASTREAM_CPP(className) \ 00076 QDataStream & operator<< (QDataStream & stream, const className & t) \ 00077 { return qx::QxSerializeRegistered< className >::save(stream, t); } \ 00078 QDataStream & operator>> (QDataStream & stream, className & t) \ 00079 { return qx::QxSerializeRegistered< className >::load(stream, t); } 00080 00081 #define QX_REGISTER_CLASS_MAPPING_FCT_EMPTY_CPP(className) \ 00082 namespace qx { template <> void register_class(QxClass< className > & t) { Q_UNUSED(t); } } 00083 00084 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00085 #define QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(Archive, className) \ 00086 namespace boost { namespace serialization { \ 00087 inline void serialize(Archive & ar, className & t, const unsigned int file_version) \ 00088 { \ 00089 static_assert(qx::trait::is_qx_registered< className >::value, "qx::trait::is_qx_registered< className >::value"); \ 00090 typedef std::conditional< Archive::is_saving::value, qx::serialization::detail::saver< Archive, className >, qx::serialization::detail::loader< Archive, className > >::type type_invoker; \ 00091 type_invoker::invoke(ar, t, file_version); \ 00092 } } } // namespace boost::serialization 00093 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00094 00095 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00096 #define QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, Archive, className) \ 00097 namespace boost { namespace serialization { \ 00098 dllImportExport void serialize(Archive & ar, className & t, const unsigned int file_version) QX_USED; \ 00099 } } // namespace boost::serialization 00100 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00101 00102 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00103 #define QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(Archive, className) \ 00104 namespace boost { namespace serialization { \ 00105 inline void serialize(Archive & ar, className & t, const unsigned int file_version) \ 00106 { Q_UNUSED(ar); Q_UNUSED(t); Q_UNUSED(file_version); \ 00107 } } } // namespace boost::serialization 00108 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00109 00110 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00111 #define QX_SERIALIZE_ARCHIVE_TEMPLATE_HPP(className) \ 00112 namespace boost { namespace serialization { \ 00113 template <class Archive> \ 00114 void serialize(Archive & ar, className & t, const unsigned int file_version); \ 00115 } } // namespace boost::serialization 00116 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00117 00118 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00119 #if _QX_SERIALIZE_POLYMORPHIC 00120 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_POLYMORPHIC_CPP(className) \ 00121 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::polymorphic_oarchive, className) \ 00122 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::polymorphic_iarchive, className) \ 00123 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::polymorphic_binary_oarchive, className) \ 00124 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::polymorphic_binary_iarchive, className) \ 00125 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::polymorphic_text_oarchive, className) \ 00126 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::polymorphic_text_iarchive, className) \ 00127 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::polymorphic_xml_oarchive, className) \ 00128 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::polymorphic_xml_iarchive, className) \ 00129 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::binary_oarchive, className) \ 00130 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::binary_iarchive, className) \ 00131 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::text_oarchive, className) \ 00132 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::text_iarchive, className) \ 00133 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::xml_oarchive, className) \ 00134 QX_SERIALIZE_IMPLEMENT_ARCHIVE_EMPTY_CPP(boost::archive::xml_iarchive, className) 00135 // --- 00136 #define QX_SERIALIZE_LIST_ARCHIVE_POLYMORPHIC_HPP(dllImportExport, className) \ 00137 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::polymorphic_oarchive, className) \ 00138 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::polymorphic_iarchive, className) \ 00139 QX_SERIALIZE_ARCHIVE_TEMPLATE_HPP(className) 00140 #else // _QX_SERIALIZE_POLYMORPHIC 00141 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_POLYMORPHIC_CPP(className) /* Nothing */ 00142 #define QX_SERIALIZE_LIST_ARCHIVE_POLYMORPHIC_HPP(dllImportExport, className) /* Nothing */ 00143 #endif // _QX_SERIALIZE_POLYMORPHIC 00144 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00145 00146 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00147 #if _QX_SERIALIZE_BINARY 00148 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_BINARY_CPP(className) \ 00149 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::binary_oarchive, className) \ 00150 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::binary_iarchive, className) 00151 // --- 00152 #define QX_SERIALIZE_LIST_ARCHIVE_BINARY_HPP(dllImportExport, className) \ 00153 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::binary_oarchive, className) \ 00154 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::binary_iarchive, className) 00155 #else // _QX_SERIALIZE_BINARY 00156 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_BINARY_CPP(className) /* Nothing */ 00157 #define QX_SERIALIZE_LIST_ARCHIVE_BINARY_HPP(dllImportExport, className) /* Nothing */ 00158 #endif // _QX_SERIALIZE_BINARY 00159 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00160 00161 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00162 #if _QX_SERIALIZE_TEXT 00163 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_TEXT_CPP(className) \ 00164 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::text_oarchive, className) \ 00165 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::text_iarchive, className) 00166 // --- 00167 #define QX_SERIALIZE_LIST_ARCHIVE_TEXT_HPP(dllImportExport, className) \ 00168 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::text_oarchive, className) \ 00169 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::text_iarchive, className) 00170 #else // _QX_SERIALIZE_TEXT 00171 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_TEXT_CPP(className) /* Nothing */ 00172 #define QX_SERIALIZE_LIST_ARCHIVE_TEXT_HPP(dllImportExport, className) /* Nothing */ 00173 #endif // _QX_SERIALIZE_TEXT 00174 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00175 00176 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00177 #if _QX_SERIALIZE_XML 00178 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_XML_CPP(className) \ 00179 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::xml_oarchive, className) \ 00180 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::xml_iarchive, className) 00181 // --- 00182 #define QX_SERIALIZE_LIST_ARCHIVE_XML_HPP(dllImportExport, className) \ 00183 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::xml_oarchive, className) \ 00184 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::xml_iarchive, className) 00185 #else // _QX_SERIALIZE_XML 00186 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_XML_CPP(className) /* Nothing */ 00187 #define QX_SERIALIZE_LIST_ARCHIVE_XML_HPP(dllImportExport, className) /* Nothing */ 00188 #endif // _QX_SERIALIZE_XML 00189 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00190 00191 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00192 #if _QX_SERIALIZE_PORTABLE_BINARY 00193 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_PORTABLE_BINARY_CPP(className) \ 00194 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(eos::portable_oarchive, className) \ 00195 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(eos::portable_iarchive, className) 00196 // --- 00197 #define QX_SERIALIZE_LIST_ARCHIVE_PORTABLE_BINARY_HPP(dllImportExport, className) \ 00198 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, eos::portable_oarchive, className) \ 00199 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, eos::portable_iarchive, className) 00200 #else // _QX_SERIALIZE_PORTABLE_BINARY 00201 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_PORTABLE_BINARY_CPP(className) /* Nothing */ 00202 #define QX_SERIALIZE_LIST_ARCHIVE_PORTABLE_BINARY_HPP(dllImportExport, className) /* Nothing */ 00203 #endif // _QX_SERIALIZE_PORTABLE_BINARY 00204 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00205 00206 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00207 #if _QX_SERIALIZE_WIDE_BINARY 00208 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_BINARY_CPP(className) \ 00209 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::binary_woarchive, className) \ 00210 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::binary_wiarchive, className) 00211 // --- 00212 #define QX_SERIALIZE_LIST_ARCHIVE_WIDE_BINARY_HPP(dllImportExport, className) \ 00213 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::binary_woarchive, className) \ 00214 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::binary_wiarchive, className) 00215 #else // _QX_SERIALIZE_WIDE_BINARY 00216 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_BINARY_CPP(className) /* Nothing */ 00217 #define QX_SERIALIZE_LIST_ARCHIVE_WIDE_BINARY_HPP(dllImportExport, className) /* Nothing */ 00218 #endif // _QX_SERIALIZE_WIDE_BINARY 00219 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00220 00221 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00222 #if _QX_SERIALIZE_WIDE_TEXT 00223 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_TEXT_CPP(className) \ 00224 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::text_woarchive, className) \ 00225 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::text_wiarchive, className) 00226 // --- 00227 #define QX_SERIALIZE_LIST_ARCHIVE_WIDE_TEXT_HPP(dllImportExport, className) \ 00228 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::text_woarchive, className) \ 00229 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::text_wiarchive, className) 00230 #else // _QX_SERIALIZE_WIDE_TEXT 00231 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_TEXT_CPP(className) /* Nothing */ 00232 #define QX_SERIALIZE_LIST_ARCHIVE_WIDE_TEXT_HPP(dllImportExport, className) /* Nothing */ 00233 #endif // _QX_SERIALIZE_WIDE_TEXT 00234 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00235 00236 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00237 #if _QX_SERIALIZE_WIDE_XML 00238 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_XML_CPP(className) \ 00239 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::xml_woarchive, className) \ 00240 QX_SERIALIZE_IMPLEMENT_ARCHIVE_CPP(boost::archive::xml_wiarchive, className) 00241 // --- 00242 #define QX_SERIALIZE_LIST_ARCHIVE_WIDE_XML_HPP(dllImportExport, className) \ 00243 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::xml_woarchive, className) \ 00244 QX_SERIALIZE_ARCHIVE_HPP(dllImportExport, boost::archive::xml_wiarchive, className) 00245 #else // _QX_SERIALIZE_WIDE_XML 00246 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_XML_CPP(className) /* Nothing */ 00247 #define QX_SERIALIZE_LIST_ARCHIVE_WIDE_XML_HPP(dllImportExport, className) /* Nothing */ 00248 #endif // _QX_SERIALIZE_WIDE_XML 00249 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00250 00251 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00252 #define QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_CPP(className) \ 00253 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_POLYMORPHIC_CPP(className) \ 00254 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_BINARY_CPP(className) \ 00255 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_TEXT_CPP(className) \ 00256 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_XML_CPP(className) \ 00257 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_PORTABLE_BINARY_CPP(className) \ 00258 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_BINARY_CPP(className) \ 00259 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_TEXT_CPP(className) \ 00260 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_WIDE_XML_CPP(className) 00261 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00262 00263 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00264 #define QX_SERIALIZE_LIST_ARCHIVE_HPP(dllImportExport, className) \ 00265 QX_SERIALIZE_LIST_ARCHIVE_POLYMORPHIC_HPP(dllImportExport, className) \ 00266 QX_SERIALIZE_LIST_ARCHIVE_BINARY_HPP(dllImportExport, className) \ 00267 QX_SERIALIZE_LIST_ARCHIVE_TEXT_HPP(dllImportExport, className) \ 00268 QX_SERIALIZE_LIST_ARCHIVE_XML_HPP(dllImportExport, className) \ 00269 QX_SERIALIZE_LIST_ARCHIVE_PORTABLE_BINARY_HPP(dllImportExport, className) \ 00270 QX_SERIALIZE_LIST_ARCHIVE_WIDE_BINARY_HPP(dllImportExport, className) \ 00271 QX_SERIALIZE_LIST_ARCHIVE_WIDE_TEXT_HPP(dllImportExport, className) \ 00272 QX_SERIALIZE_LIST_ARCHIVE_WIDE_XML_HPP(dllImportExport, className) 00273 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00274 00275 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00276 #if _QX_WRITE_BOOST_CLASS_EXPORT_IN_HPP_FILE 00277 #define QX_BOOST_CLASS_EXPORT_HPP(className) BOOST_CLASS_EXPORT_GUID(className, #className) 00278 #else 00279 #define QX_BOOST_CLASS_EXPORT_HPP(className) /* Nothing */ 00280 #endif // _QX_WRITE_BOOST_CLASS_EXPORT_IN_HPP_FILE 00281 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00282 00283 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00284 #if _QX_WRITE_BOOST_CLASS_EXPORT_IN_CPP_FILE 00285 #define QX_BOOST_CLASS_EXPORT_CPP(className) BOOST_CLASS_EXPORT_GUID(className, #className) 00286 #else 00287 #define QX_BOOST_CLASS_EXPORT_CPP(className) /* Nothing */ 00288 #endif // _QX_WRITE_BOOST_CLASS_EXPORT_IN_CPP_FILE 00289 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00290 00291 #define QX_REGISTER_FRIEND_CLASS(className) \ 00292 template <class T> friend void qx::register_class(T & t); 00293 00294 #define QX_DLL_EXPORT_TEMPLATE_QX_CLASS_HPP(className) \ 00295 QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxDataMemberX< className >) \ 00296 QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxSingleton< qx::QxDataMemberX< className > >) \ 00297 QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxClass< className >) \ 00298 QX_DLL_EXPORT_TEMPLATE_HPP(class, qx::QxSingleton< qx::QxClass< className > >) 00299 00300 #define QX_DLL_EXPORT_TEMPLATE_QX_CLASS_CPP(className) \ 00301 QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxDataMemberX< className >) \ 00302 QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxSingleton< qx::QxDataMemberX< className > >) \ 00303 QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxClass< className >) \ 00304 QX_DLL_EXPORT_TEMPLATE_CPP(class, qx::QxSingleton< qx::QxClass< className > >) 00305 00306 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00307 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00308 QX_SET_REGISTERED(className) \ 00309 QX_REGISTER_CLASS_NAME(className) \ 00310 QX_REGISTER_BASE_CLASS(className, baseClass) \ 00311 QX_REGISTER_FACTORY_COMPLEX_CLASS_NAME_HPP(className, classNameFormatted) \ 00312 QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME(className, classNameFormatted) \ 00313 QX_BOOST_CLASS_EXPORT_HPP(className) \ 00314 QX_CLASS_VERSION(className, version) 00315 #else // _QX_ENABLE_BOOST_SERIALIZATION 00316 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00317 QX_SET_REGISTERED(className) \ 00318 QX_REGISTER_CLASS_NAME(className) \ 00319 QX_REGISTER_BASE_CLASS(className, baseClass) \ 00320 QX_REGISTER_FACTORY_COMPLEX_CLASS_NAME_HPP(className, classNameFormatted) \ 00321 QX_CLASS_VERSION(className, version) 00322 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00323 00324 #define QX_REGISTER_HPP(className, baseClass, version) \ 00325 QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, className) 00326 00327 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00328 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00329 QX_BOOST_CLASS_EXPORT_CPP(className) \ 00330 QX_REGISTER_FACTORY_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00331 QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00332 QX_SERIALIZE_IMPLEMENT_LIST_ARCHIVE_CPP(className) 00333 #else // _QX_ENABLE_BOOST_SERIALIZATION 00334 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00335 QX_REGISTER_FACTORY_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) 00336 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00337 00338 #define QX_REGISTER_CPP(className) \ 00339 QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, className) 00340 00341 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00342 00343 #ifdef _MSC_VER 00344 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, classNameFormatted) \ 00345 QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00346 QX_SERIALIZE_LIST_ARCHIVE_HPP(QX_DLL_EXPORT_HELPER, className) \ 00347 QX_REGISTER_CLASS_MAPPING_FCT_HPP(QX_DLL_EXPORT_HELPER, className) \ 00348 QX_REGISTER_SERIALIZE_QDATASTREAM_HPP(QX_DLL_EXPORT_HELPER, className) 00349 // --- 00350 #define QX_REGISTER_HPP_EXPORT_DLL(className, baseClass, version) \ 00351 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, className) 00352 #else // _MSC_VER 00353 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, classNameFormatted) \ 00354 QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00355 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_HPP(className) \ 00356 QX_BOOST_EXPORT_SERIALIZATION_HPP(className) \ 00357 QX_SERIALIZE_LIST_ARCHIVE_HPP(QX_DLL_EXPORT_HELPER, className) \ 00358 QX_REGISTER_CLASS_MAPPING_FCT_HPP(QX_DLL_EXPORT_HELPER, className) \ 00359 QX_REGISTER_SERIALIZE_QDATASTREAM_HPP(QX_DLL_EXPORT_HELPER, className) 00360 // --- 00361 #define QX_REGISTER_HPP_EXPORT_DLL(className, baseClass, version) \ 00362 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, className) 00363 #endif // _MSC_VER 00364 00365 #else // _QX_ENABLE_BOOST_SERIALIZATION 00366 00367 #ifdef _MSC_VER 00368 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, classNameFormatted) \ 00369 QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00370 QX_REGISTER_CLASS_MAPPING_FCT_HPP(QX_DLL_EXPORT_HELPER, className) \ 00371 QX_REGISTER_SERIALIZE_QDATASTREAM_HPP(QX_DLL_EXPORT_HELPER, className) 00372 // --- 00373 #define QX_REGISTER_HPP_EXPORT_DLL(className, baseClass, version) \ 00374 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, className) 00375 #else // _MSC_VER 00376 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, classNameFormatted) \ 00377 QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00378 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_HPP(className) \ 00379 QX_REGISTER_CLASS_MAPPING_FCT_HPP(QX_DLL_EXPORT_HELPER, className) \ 00380 QX_REGISTER_SERIALIZE_QDATASTREAM_HPP(QX_DLL_EXPORT_HELPER, className) 00381 // --- 00382 #define QX_REGISTER_HPP_EXPORT_DLL(className, baseClass, version) \ 00383 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL(className, baseClass, version, className) 00384 #endif // _MSC_VER 00385 00386 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00387 00388 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00389 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_IMPORT_DLL(className, baseClass, version, classNameFormatted) \ 00390 QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00391 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_HPP(className) \ 00392 QX_BOOST_EXPORT_SERIALIZATION_HPP(className) \ 00393 QX_SERIALIZE_LIST_ARCHIVE_HPP(QX_DLL_IMPORT_HELPER, className) \ 00394 QX_REGISTER_CLASS_MAPPING_FCT_HPP(QX_DLL_IMPORT_HELPER, className) \ 00395 QX_REGISTER_SERIALIZE_QDATASTREAM_HPP(QX_DLL_IMPORT_HELPER, className) 00396 #else // _QX_ENABLE_BOOST_SERIALIZATION 00397 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_IMPORT_DLL(className, baseClass, version, classNameFormatted) \ 00398 QX_REGISTER_COMPLEX_CLASS_NAME_HPP(className, baseClass, version, classNameFormatted) \ 00399 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_HPP(className) \ 00400 QX_REGISTER_CLASS_MAPPING_FCT_HPP(QX_DLL_IMPORT_HELPER, className) \ 00401 QX_REGISTER_SERIALIZE_QDATASTREAM_HPP(QX_DLL_IMPORT_HELPER, className) 00402 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00403 00404 #define QX_REGISTER_HPP_IMPORT_DLL(className, baseClass, version) \ 00405 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_IMPORT_DLL(className, baseClass, version, className) 00406 00407 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00408 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_EXPORT_DLL(className, classNameFormatted) \ 00409 QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00410 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_CPP(className) \ 00411 QX_BOOST_EXPORT_SERIALIZATION_CPP(className) \ 00412 QX_REGISTER_SERIALIZE_QDATASTREAM_CPP(className) 00413 #else // _QX_ENABLE_BOOST_SERIALIZATION 00414 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_EXPORT_DLL(className, classNameFormatted) \ 00415 QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00416 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_CPP(className) \ 00417 QX_REGISTER_SERIALIZE_QDATASTREAM_CPP(className) 00418 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00419 00420 #define QX_REGISTER_CPP_EXPORT_DLL(className) \ 00421 QX_REGISTER_COMPLEX_CLASS_NAME_CPP_EXPORT_DLL(className, className) 00422 00423 #ifdef _MSC_VER 00424 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL(className, classNameFormatted) \ 00425 QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) 00426 // --- 00427 #define QX_REGISTER_CPP_IMPORT_DLL(className) \ 00428 QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL(className, className) 00429 #else // _MSC_VER 00430 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00431 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL(className, classNameFormatted) \ 00432 QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00433 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_CPP(className) \ 00434 QX_BOOST_EXPORT_SERIALIZATION_CPP(className) 00435 #else // _QX_ENABLE_BOOST_SERIALIZATION 00436 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL(className, classNameFormatted) \ 00437 QX_REGISTER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \ 00438 QX_DLL_EXPORT_TEMPLATE_QX_CLASS_CPP(className) 00439 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00440 // --- 00441 #define QX_REGISTER_CPP_IMPORT_DLL(className) \ 00442 QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL(className, className) 00443 #endif // _MSC_VER 00444 00445 #ifdef _QX_ENABLE_BOOST_SERIALIZATION 00446 #define QX_REGISTER_ABSTRACT_CLASS(className) \ 00447 BOOST_SERIALIZATION_ASSUME_ABSTRACT(className) \ 00448 namespace boost { namespace serialization { \ 00449 template<class Archive> \ 00450 inline void load_construct_data(Archive & ar, className * t, const unsigned int file_version) \ 00451 { Q_UNUSED(ar); Q_UNUSED(t); Q_UNUSED(file_version); } \ 00452 } } // namespace boost::serialization 00453 #else // _QX_ENABLE_BOOST_SERIALIZATION 00454 #define QX_REGISTER_ABSTRACT_CLASS(className) /* Nothing */ 00455 #endif // _QX_ENABLE_BOOST_SERIALIZATION 00456 00457 /* -- Create your macro (in your precompiled header) replacing "MY_DLL" 00458 #ifdef _BUILDING_MY_DLL 00459 #define QX_REGISTER_HPP_MY_DLL QX_REGISTER_HPP_EXPORT_DLL 00460 #define QX_REGISTER_CPP_MY_DLL QX_REGISTER_CPP_EXPORT_DLL 00461 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_MY_DLL QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL 00462 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_MY_DLL QX_REGISTER_COMPLEX_CLASS_NAME_CPP_EXPORT_DLL 00463 #else 00464 #define QX_REGISTER_HPP_MY_DLL QX_REGISTER_HPP_IMPORT_DLL 00465 #define QX_REGISTER_CPP_MY_DLL QX_REGISTER_CPP_IMPORT_DLL 00466 #define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_MY_DLL QX_REGISTER_COMPLEX_CLASS_NAME_HPP_IMPORT_DLL 00467 #define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_MY_DLL QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL 00468 #endif // _BUILDING_MY_DLL 00469 */ 00470 00471 #ifdef _MSC_VER 00472 #pragma warning(pop) 00473 #endif // _MSC_VER 00474 00475 #endif // _QX_REGISTER_H_