| QxOrm 1.4.1 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

QxDataMember_QObject.h
Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** http://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_DATA_MEMBER_QOBJECT_H_
    00033 #define _QX_DATA_MEMBER_QOBJECT_H_
    00034
    00035 #ifdef _MSC_VER
    00036 #pragma once
    00037 #endif
    00038
    00046 #include <QtCore/qmetaobject.h>
    00047 #include <QtCore/qmetatype.h>
    00048
    00049 #include <QxDataMember/IxDataMember.h>
    00050
    00051 #include <QxSerialize/Qt/QxSerialize_QString.h>
    00052 #include <QxSerialize/Qt/QxSerialize_QVariant.h>
    00053
    00054 #define QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(ArchiveInput, ArchiveOutput) \
    00055 virtual void toArchive(const void * pOwner, ArchiveOutput & ar) const; \
    00056 virtual void fromArchive(void * pOwner, ArchiveInput & ar);
    00057
    00058 namespace qx {
    00059
    00064 class QX_DLL_EXPORT QxDataMember_QObject : public IxDataMember
    00065 {
    00066
    00067 protected:
    00068
    00069    const QMetaObject *  m_metaObject;
    00070    QMetaProperty        m_metaProperty;
    00071
    00072 public:
    00073
    00074    QxDataMember_QObject(const QMetaObject * pMetaObject, const QString & sKey);
    00075    virtual ~QxDataMember_QObject() { ; }
    00076
    00077    virtual bool isEqual(const void * pOwner1, const void * pOwner2) const;
    00078    virtual QString toString(const void * pOwner, const QString & sFormat, int iIndexName = -1) const;
    00079    virtual qx_bool fromString(void * pOwner, const QString & s, const QString & sFormat, int iIndexName = -1);
    00080    virtual QVariant toVariant(const void * pOwner, const QString & sFormat, int iIndexName = -1) const;
    00081    virtual qx_bool fromVariant(void * pOwner, const QVariant & v, const QString & sFormat, int iIndexName = -1);
    00082
    00083 public:
    00084
    00085 #ifdef _QX_ENABLE_BOOST_SERIALIZATION
    00086
    00087 #if _QX_SERIALIZE_POLYMORPHIC
    00088    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive)
    00089 #endif // _QX_SERIALIZE_POLYMORPHIC
    00090
    00091 #if _QX_SERIALIZE_BINARY
    00092    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive)
    00093 #endif // _QX_SERIALIZE_BINARY
    00094
    00095 #if _QX_SERIALIZE_TEXT
    00096    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_iarchive, boost::archive::text_oarchive)
    00097 #endif // _QX_SERIALIZE_TEXT
    00098
    00099 #if _QX_SERIALIZE_XML
    00100    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive)
    00101 #endif // _QX_SERIALIZE_XML
    00102
    00103 #if _QX_SERIALIZE_PORTABLE_BINARY
    00104    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(eos::portable_iarchive, eos::portable_oarchive)
    00105 #endif // _QX_SERIALIZE_PORTABLE_BINARY
    00106
    00107 #if _QX_SERIALIZE_WIDE_BINARY
    00108    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive)
    00109 #endif // _QX_SERIALIZE_WIDE_BINARY
    00110
    00111 #if _QX_SERIALIZE_WIDE_TEXT
    00112    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_wiarchive, boost::archive::text_woarchive)
    00113 #endif // _QX_SERIALIZE_WIDE_TEXT
    00114
    00115 #if _QX_SERIALIZE_WIDE_XML
    00116    QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive)
    00117 #endif // _QX_SERIALIZE_WIDE_XML
    00118
    00119 #endif // _QX_ENABLE_BOOST_SERIALIZATION
    00120
    00121 protected:
    00122
    00123    virtual boost::any getDataPtr(const void * pOwner) const;
    00124    virtual boost::any getDataPtr(void * pOwner);
    00125    virtual void * getDataVoidPtr(const void * pOwner) const;
    00126    virtual void * getDataVoidPtr(void * pOwner);
    00127
    00128 };
    00129
    00130 } // namespace qx
    00131
    00132 #endif // _QX_DATA_MEMBER_QOBJECT_H_