QxOrm 1.1.9
C++ Object Relational Mapping library
QxDataMember_QObject.h
Go to the documentation of this file.
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 qx_bool isValid(const void * pOwner) const;
00073    virtual qx_bool isValid(void * pOwner);
00074 
00075    virtual QString toString(const void * pOwner, const QString & sFormat, int iIndexName = -1) const;
00076    virtual qx_bool fromString(void * pOwner, const QString & s, const QString & sFormat, int iIndexName = -1);
00077    virtual QVariant toVariant(const void * pOwner, const QString & sFormat, int iIndexName = -1) const;
00078    virtual qx_bool fromVariant(void * pOwner, const QVariant & v, const QString & sFormat, int iIndexName = -1);
00079 
00080 public:
00081 
00082 #if _QX_SERIALIZE_POLYMORPHIC
00083    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive)
00084 #endif // _QX_SERIALIZE_POLYMORPHIC
00085 
00086 #if _QX_SERIALIZE_BINARY
00087    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive)
00088 #endif // _QX_SERIALIZE_BINARY
00089 
00090 #if _QX_SERIALIZE_TEXT
00091    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_iarchive, boost::archive::text_oarchive)
00092 #endif // _QX_SERIALIZE_TEXT
00093 
00094 #if _QX_SERIALIZE_XML
00095    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive)
00096 #endif // _QX_SERIALIZE_XML
00097 
00098 #if _QX_SERIALIZE_PORTABLE_BINARY
00099    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(eos::portable_iarchive, eos::portable_oarchive)
00100 #endif // _QX_SERIALIZE_PORTABLE_BINARY
00101 
00102 #if _QX_SERIALIZE_WIDE_BINARY
00103    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive)
00104 #endif // _QX_SERIALIZE_WIDE_BINARY
00105 
00106 #if _QX_SERIALIZE_WIDE_TEXT
00107    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_wiarchive, boost::archive::text_woarchive)
00108 #endif // _QX_SERIALIZE_WIDE_TEXT
00109 
00110 #if _QX_SERIALIZE_WIDE_XML
00111    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive)
00112 #endif // _QX_SERIALIZE_WIDE_XML
00113 
00114 protected:
00115 
00116    virtual boost::any getDataPtr(const void * pOwner) const;
00117    virtual boost::any getDataPtr(void * pOwner);
00118    virtual void * getDataVoidPtr(const void * pOwner) const;
00119    virtual void * getDataVoidPtr(void * pOwner);
00120 
00121 };
00122 
00123 } // namespace qx
00124 
00125 #endif // _QX_DATA_MEMBER_QOBJECT_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines