![]() |
QxOrm
1.2.3
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** http://www.qxorm.com/ 00004 ** http://sourceforge.net/projects/qxorm/ 00005 ** Original file by Lionel Marty 00006 ** 00007 ** This file is part of the QxOrm library 00008 ** 00009 ** This software is provided 'as-is', without any express or implied 00010 ** warranty. In no event will the authors be held liable for any 00011 ** damages arising from the use of this software. 00012 ** 00013 ** GNU Lesser General Public License Usage 00014 ** This file must be used under the terms of the GNU Lesser 00015 ** General Public License version 2.1 as published by the Free Software 00016 ** Foundation and appearing in the file 'license.lgpl.txt' included in the 00017 ** packaging of this file. Please review the following information to 00018 ** ensure the GNU Lesser General Public License version 2.1 requirements 00019 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00020 ** 00021 ** If you have questions regarding the use of this file, please contact : 00022 ** contact@qxorm.com 00023 ** 00024 ****************************************************************************/ 00025 00026 #ifndef _QX_DATA_MEMBER_QOBJECT_H_ 00027 #define _QX_DATA_MEMBER_QOBJECT_H_ 00028 00029 #ifdef _MSC_VER 00030 #pragma once 00031 #endif 00032 00040 #include <QtCore/qmetaobject.h> 00041 #include <QtCore/qmetatype.h> 00042 00043 #include <QxDataMember/IxDataMember.h> 00044 00045 #include <QxSerialize/Qt/QxSerialize_QString.h> 00046 #include <QxSerialize/Qt/QxSerialize_QVariant.h> 00047 00048 #define QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(ArchiveInput, ArchiveOutput) \ 00049 virtual void toArchive(const void * pOwner, ArchiveOutput & ar) const; \ 00050 virtual void fromArchive(void * pOwner, ArchiveInput & ar); 00051 00052 namespace qx { 00053 00058 class QX_DLL_EXPORT QxDataMember_QObject : public IxDataMember 00059 { 00060 00061 protected: 00062 00063 const QMetaObject * m_metaObject; 00064 QMetaProperty m_metaProperty; 00065 00066 public: 00067 00068 QxDataMember_QObject(const QMetaObject * pMetaObject, const QString & sKey); 00069 virtual ~QxDataMember_QObject() { ; } 00070 00071 virtual bool isEqual(const void * pOwner1, const void * pOwner2) const; 00072 virtual QString toString(const void * pOwner, const QString & sFormat, int iIndexName = -1) const; 00073 virtual qx_bool fromString(void * pOwner, const QString & s, const QString & sFormat, int iIndexName = -1); 00074 virtual QVariant toVariant(const void * pOwner, const QString & sFormat, int iIndexName = -1) const; 00075 virtual qx_bool fromVariant(void * pOwner, const QVariant & v, const QString & sFormat, int iIndexName = -1); 00076 00077 public: 00078 00079 #if _QX_SERIALIZE_POLYMORPHIC 00080 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive) 00081 #endif // _QX_SERIALIZE_POLYMORPHIC 00082 00083 #if _QX_SERIALIZE_BINARY 00084 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive) 00085 #endif // _QX_SERIALIZE_BINARY 00086 00087 #if _QX_SERIALIZE_TEXT 00088 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_iarchive, boost::archive::text_oarchive) 00089 #endif // _QX_SERIALIZE_TEXT 00090 00091 #if _QX_SERIALIZE_XML 00092 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive) 00093 #endif // _QX_SERIALIZE_XML 00094 00095 #if _QX_SERIALIZE_PORTABLE_BINARY 00096 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(eos::portable_iarchive, eos::portable_oarchive) 00097 #endif // _QX_SERIALIZE_PORTABLE_BINARY 00098 00099 #if _QX_SERIALIZE_WIDE_BINARY 00100 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive) 00101 #endif // _QX_SERIALIZE_WIDE_BINARY 00102 00103 #if _QX_SERIALIZE_WIDE_TEXT 00104 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_wiarchive, boost::archive::text_woarchive) 00105 #endif // _QX_SERIALIZE_WIDE_TEXT 00106 00107 #if _QX_SERIALIZE_WIDE_XML 00108 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive) 00109 #endif // _QX_SERIALIZE_WIDE_XML 00110 00111 protected: 00112 00113 virtual boost::any getDataPtr(const void * pOwner) const; 00114 virtual boost::any getDataPtr(void * pOwner); 00115 virtual void * getDataVoidPtr(const void * pOwner) const; 00116 virtual void * getDataVoidPtr(void * pOwner); 00117 00118 }; 00119 00120 } // namespace qx 00121 00122 #endif // _QX_DATA_MEMBER_QOBJECT_H_