QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
IxParameter.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#ifdef _QX_ENABLE_QT_NETWORK
33#ifndef _IX_SERVICE_PARAMETER_H_
34#define _IX_SERVICE_PARAMETER_H_
35
36#ifdef _MSC_VER
37#pragma once
38#endif
39
47#include <QtCore/qdatastream.h>
48
49#ifndef _QX_NO_JSON
50#include <QtCore/qjsonvalue.h>
51#endif // _QX_NO_JSON
52
54
55namespace qx {
56namespace service {
57class IxParameter;
58} // namespace service
59} // namespace qx
60
61QX_DLL_EXPORT QDataStream & operator<< (QDataStream & stream, const qx::service::IxParameter & t) QX_USED;
62QX_DLL_EXPORT QDataStream & operator>> (QDataStream & stream, qx::service::IxParameter & t) QX_USED;
63
64namespace qx {
65namespace service {
66
74{
75
76 friend QX_DLL_EXPORT QDataStream & ::operator<< (QDataStream & stream, const qx::service::IxParameter & t);
77 friend QX_DLL_EXPORT QDataStream & ::operator>> (QDataStream & stream, qx::service::IxParameter & t);
78
79public:
80
82 virtual ~IxParameter();
83
84 // Need to override these methods only if you are using 'qx::service::QxConnect::serialization_qt' type (based on QDataStream) or 'qx::service::QxConnect::serialization_json' type (based on QJson engine)
85 // You can use QX_SERVICE_IX_PARAMETER_SERIALIZATION_HPP and QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP macro to override
86 virtual void registerClass() const;
87 virtual QString getClassName() const;
88 virtual void save(QDataStream & stream) const;
89 virtual void load(QDataStream & stream);
90
91#ifndef _QX_NO_JSON
92 virtual QJsonValue saveToJson() const;
93 virtual qx_bool loadFromJson(const QJsonValue & val);
94#endif // _QX_NO_JSON
95
96};
97
98typedef std::shared_ptr<IxParameter> IxParameter_ptr;
99
100} // namespace service
101} // namespace qx
102
104
105#define QX_SERVICE_IX_PARAMETER_QDATASTREAM_HPP(className) \
106public: \
107virtual void save(QDataStream & stream) const; \
108virtual void load(QDataStream & stream);
109
110#define QX_SERVICE_IX_PARAMETER_QDATASTREAM_CPP(className) \
111void className::save(QDataStream & stream) const { qx::QxSerializeRegistered< className >::save(stream, (* this)); } \
112void className::load(QDataStream & stream) { qx::QxSerializeRegistered< className >::load(stream, (* this)); }
113
114#ifndef _QX_NO_JSON
115
116#define QX_SERVICE_IX_PARAMETER_QJSON_HPP(className) \
117public: \
118virtual QJsonValue saveToJson() const; \
119virtual qx_bool loadFromJson(const QJsonValue & val);
120
121#define QX_SERVICE_IX_PARAMETER_QJSON_CPP(className) \
122QJsonValue className::saveToJson() const { return qx::cvt::detail::QxSerializeJsonRegistered< className >::save((* this), ""); } \
123qx_bool className::loadFromJson(const QJsonValue & val) { return qx::cvt::detail::QxSerializeJsonRegistered< className >::load(val, (* this), ""); }
124
125#else // _QX_NO_JSON
126#define QX_SERVICE_IX_PARAMETER_QJSON_HPP(className) /* Nothing */
127#define QX_SERVICE_IX_PARAMETER_QJSON_CPP(className) /* Nothing */
128#endif // _QX_NO_JSON
129
130#define QX_SERVICE_IX_PARAMETER_SERIALIZATION_HPP(className) \
131QX_SERVICE_IX_PARAMETER_QDATASTREAM_HPP(className) \
132QX_SERVICE_IX_PARAMETER_QJSON_HPP(className) \
133public: \
134virtual void registerClass() const; \
135virtual QString getClassName() const;
136
137#define QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(className) \
138QX_SERVICE_IX_PARAMETER_QDATASTREAM_CPP(className) \
139QX_SERVICE_IX_PARAMETER_QJSON_CPP(className) \
140void className::registerClass() const { qx::QxClass< className >::getSingleton(); } \
141QString className::getClassName() const { return #className; }
142
143#endif // _IX_SERVICE_PARAMETER_H_
144#endif // _QX_ENABLE_QT_NETWORK
QX_DLL_EXPORT QDataStream & operator<<(QDataStream &stream, const qx::service::IxParameter &t) QX_USED
QX_DLL_EXPORT QDataStream & operator>>(QDataStream &stream, qx::service::IxParameter &t) QX_USED
#define QX_USED
Definition QxMacro.h:244
#define QX_DLL_EXPORT
Definition QxMacro.h:182
#define QX_REGISTER_INTERNAL_HELPER_HPP(dllImportExport, className, version)
qx_bool : boolean type with code and description message when an error occured
Definition QxBool.h:71
qx::service::IxParameter : common interface for all parameters transfered by QxService module of QxOr...
Definition IxParameter.h:74
virtual QString getClassName() const
virtual void save(QDataStream &stream) const
virtual QJsonValue saveToJson() const
virtual void registerClass() const
virtual qx_bool loadFromJson(const QJsonValue &val)
virtual void load(QDataStream &stream)
std::shared_ptr< IxParameter > IxParameter_ptr
Definition IxParameter.h:98
Root namespace for all QxOrm library features.