QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
QxDataMember_QObject.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** https://www.qxorm.com/
4** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
5**
6** This file is part of the QxOrm library
7**
8** This software is provided 'as-is', without any express or implied
9** warranty. In no event will the authors be held liable for any
10** damages arising from the use of this software
11**
12** Commercial Usage
13** Licensees holding valid commercial QxOrm licenses may use this file in
14** accordance with the commercial license agreement provided with the
15** Software or, alternatively, in accordance with the terms contained in
16** a written agreement between you and Lionel Marty
17**
18** GNU General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU
20** General Public License version 3.0 as published by the Free Software
21** Foundation and appearing in the file 'license.gpl3.txt' included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU General Public License version 3.0 requirements will be
24** met : http://www.gnu.org/copyleft/gpl.html
25**
26** If you are unsure which license is appropriate for your use, or
27** if you have questions regarding the use of this file, please contact :
28** contact@qxorm.com
29**
30****************************************************************************/
31
32#ifndef _QX_DATA_MEMBER_QOBJECT_H_
33#define _QX_DATA_MEMBER_QOBJECT_H_
34
35#ifdef _MSC_VER
36#pragma once
37#endif
38
46#include <QtCore/qmetaobject.h>
47#include <QtCore/qmetatype.h>
48
50
53
54#define QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(ArchiveInput, ArchiveOutput) \
55virtual void toArchive(const void * pOwner, ArchiveOutput & ar) const; \
56virtual void fromArchive(void * pOwner, ArchiveInput & ar);
57
58namespace qx {
59
65{
66
67protected:
68
69 const QMetaObject * m_metaObject;
70 QMetaProperty m_metaProperty;
71
72public:
73
74 QxDataMember_QObject(const QMetaObject * pMetaObject, const QString & sKey);
75 virtual ~QxDataMember_QObject() { ; }
76
77 virtual bool isEqual(const void * pOwner1, const void * pOwner2) const;
78 virtual QVariant toVariant(const void * pOwner, const QString & sFormat, int iIndexName = -1, qx::cvt::context::ctx_type ctx = qx::cvt::context::e_no_context) const;
79 virtual qx_bool fromVariant(void * pOwner, const QVariant & v, const QString & sFormat, int iIndexName = -1, qx::cvt::context::ctx_type ctx = qx::cvt::context::e_no_context);
80 virtual QString getType() const;
81
82#ifndef _QX_NO_JSON
83 virtual QJsonValue toJson(const void * pOwner, const QString & sFormat) const;
84 virtual qx_bool fromJson(void * pOwner, const QJsonValue & j, const QString & sFormat);
85#endif // _QX_NO_JSON
86
87public:
88
89#ifdef _QX_ENABLE_BOOST_SERIALIZATION
90
91#if _QX_SERIALIZE_POLYMORPHIC
92 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive)
93#endif // _QX_SERIALIZE_POLYMORPHIC
94
95#if _QX_SERIALIZE_BINARY
96 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive)
97#endif // _QX_SERIALIZE_BINARY
98
99#if _QX_SERIALIZE_TEXT
100 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_iarchive, boost::archive::text_oarchive)
101#endif // _QX_SERIALIZE_TEXT
102
103#if _QX_SERIALIZE_XML
104 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive)
105#endif // _QX_SERIALIZE_XML
106
107#if _QX_SERIALIZE_PORTABLE_BINARY
109#endif // _QX_SERIALIZE_PORTABLE_BINARY
110
111#if _QX_SERIALIZE_WIDE_BINARY
112 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive)
113#endif // _QX_SERIALIZE_WIDE_BINARY
114
115#if _QX_SERIALIZE_WIDE_TEXT
116 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::text_wiarchive, boost::archive::text_woarchive)
117#endif // _QX_SERIALIZE_WIDE_TEXT
118
119#if _QX_SERIALIZE_WIDE_XML
120 QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive)
121#endif // _QX_SERIALIZE_WIDE_XML
122
123#endif // _QX_ENABLE_BOOST_SERIALIZATION
124
125protected:
126
127 virtual qx::any getDataPtr(const void * pOwner) const;
128 virtual qx::any getDataPtr(void * pOwner);
129 virtual void * getDataVoidPtr(const void * pOwner) const;
130 virtual void * getDataVoidPtr(void * pOwner);
131
132};
133
134} // namespace qx
135
136#endif // _QX_DATA_MEMBER_QOBJECT_H_
Common interface for all class properties registered into QxOrm context.
#define QX_DATA_MEMBER_QOBJECT_IMPL_VIRTUAL_ARCHIVE_HPP(ArchiveInput, ArchiveOutput)
#define QX_DLL_EXPORT
Definition QxMacro.h:182
Portable binary input archive using little endian format.
Portable binary output archive using little endian format.
qx::IxDataMember : common interface for all class properties registered into QxOrm context
qx_bool : boolean type with code and description message when an error occured
Definition QxBool.h:71
qx::QxDataMember_QObject : connect Qt introspection engine (based on QObject class,...
QxDataMember_QObject(const QMetaObject *pMetaObject, const QString &sKey)
virtual qx::any getDataPtr(void *pOwner)
virtual void * getDataVoidPtr(const void *pOwner) const
const QMetaObject * m_metaObject
Meta-object from introspection engine of Qt library (& MyQObject::staticMetaObject)
virtual bool isEqual(const void *pOwner1, const void *pOwner2) const
virtual qx_bool fromVariant(void *pOwner, const QVariant &v, const QString &sFormat, int iIndexName=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)
QMetaProperty m_metaProperty
Meta-property from introspection engine of Qt library.
virtual qx::any getDataPtr(const void *pOwner) const
virtual qx_bool fromJson(void *pOwner, const QJsonValue &j, const QString &sFormat)
virtual QString getType() const
virtual QVariant toVariant(const void *pOwner, const QString &sFormat, int iIndexName=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context) const
virtual QJsonValue toJson(const void *pOwner, const QString &sFormat) const
virtual void * getDataVoidPtr(void *pOwner)
Root namespace for all QxOrm library features.