QxOrm
1.5.0
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** https://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_CONSTRUCT_NULL_QVARIANT_H_ 00033 #define _QX_CONSTRUCT_NULL_QVARIANT_H_ 00034 00035 #ifdef _MSC_VER 00036 #pragma once 00037 #endif 00038 00046 #include <QtCore/qvariant.h> 00047 00048 #include <QxDao/QxDateNeutral.h> 00049 #include <QxDao/QxTimeNeutral.h> 00050 #include <QxDao/QxDateTimeNeutral.h> 00051 00052 namespace qx { 00053 namespace trait { 00054 00059 template <typename T> 00060 struct construct_null_qvariant { static inline QVariant get() { return QVariant(); } }; 00061 00062 template <> struct construct_null_qvariant<QBitArray> { static inline QVariant get() { return QVariant(QVariant::BitArray); } }; 00063 template <> struct construct_null_qvariant<QBitArray &> { static inline QVariant get() { return QVariant(QVariant::BitArray); } }; 00064 template <> struct construct_null_qvariant<const QBitArray> { static inline QVariant get() { return QVariant(QVariant::BitArray); } }; 00065 template <> struct construct_null_qvariant<const QBitArray &> { static inline QVariant get() { return QVariant(QVariant::BitArray); } }; 00066 00067 template <> struct construct_null_qvariant<QByteArray> { static inline QVariant get() { return QVariant(QVariant::ByteArray); } }; 00068 template <> struct construct_null_qvariant<QByteArray &> { static inline QVariant get() { return QVariant(QVariant::ByteArray); } }; 00069 template <> struct construct_null_qvariant<const QByteArray> { static inline QVariant get() { return QVariant(QVariant::ByteArray); } }; 00070 template <> struct construct_null_qvariant<const QByteArray &> { static inline QVariant get() { return QVariant(QVariant::ByteArray); } }; 00071 00072 template <> struct construct_null_qvariant<bool> { static inline QVariant get() { return QVariant(QVariant::Bool); } }; 00073 template <> struct construct_null_qvariant<bool &> { static inline QVariant get() { return QVariant(QVariant::Bool); } }; 00074 template <> struct construct_null_qvariant<const bool> { static inline QVariant get() { return QVariant(QVariant::Bool); } }; 00075 template <> struct construct_null_qvariant<const bool &> { static inline QVariant get() { return QVariant(QVariant::Bool); } }; 00076 00077 template <> struct construct_null_qvariant<short> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00078 template <> struct construct_null_qvariant<short &> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00079 template <> struct construct_null_qvariant<const short> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00080 template <> struct construct_null_qvariant<const short &> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00081 00082 template <> struct construct_null_qvariant<int> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00083 template <> struct construct_null_qvariant<int &> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00084 template <> struct construct_null_qvariant<const int> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00085 template <> struct construct_null_qvariant<const int &> { static inline QVariant get() { return QVariant(QVariant::Int); } }; 00086 00087 template <> struct construct_null_qvariant<long> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00088 template <> struct construct_null_qvariant<long &> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00089 template <> struct construct_null_qvariant<const long> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00090 template <> struct construct_null_qvariant<const long &> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00091 00092 template <> struct construct_null_qvariant<long long> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00093 template <> struct construct_null_qvariant<long long &> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00094 template <> struct construct_null_qvariant<const long long> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00095 template <> struct construct_null_qvariant<const long long &> { static inline QVariant get() { return QVariant(QVariant::LongLong); } }; 00096 00097 template <> struct construct_null_qvariant<float> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00098 template <> struct construct_null_qvariant<float &> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00099 template <> struct construct_null_qvariant<const float> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00100 template <> struct construct_null_qvariant<const float &> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00101 00102 template <> struct construct_null_qvariant<double> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00103 template <> struct construct_null_qvariant<double &> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00104 template <> struct construct_null_qvariant<const double> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00105 template <> struct construct_null_qvariant<const double &> { static inline QVariant get() { return QVariant(QVariant::Double); } }; 00106 00107 template <> struct construct_null_qvariant<unsigned short> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00108 template <> struct construct_null_qvariant<unsigned short &> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00109 template <> struct construct_null_qvariant<const unsigned short> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00110 template <> struct construct_null_qvariant<const unsigned short &> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00111 00112 template <> struct construct_null_qvariant<unsigned int> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00113 template <> struct construct_null_qvariant<unsigned int &> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00114 template <> struct construct_null_qvariant<const unsigned int> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00115 template <> struct construct_null_qvariant<const unsigned int &> { static inline QVariant get() { return QVariant(QVariant::UInt); } }; 00116 00117 template <> struct construct_null_qvariant<unsigned long> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00118 template <> struct construct_null_qvariant<unsigned long &> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00119 template <> struct construct_null_qvariant<const unsigned long> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00120 template <> struct construct_null_qvariant<const unsigned long &> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00121 00122 template <> struct construct_null_qvariant<unsigned long long> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00123 template <> struct construct_null_qvariant<unsigned long long &> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00124 template <> struct construct_null_qvariant<const unsigned long long> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00125 template <> struct construct_null_qvariant<const unsigned long long &> { static inline QVariant get() { return QVariant(QVariant::ULongLong); } }; 00126 00127 template <> struct construct_null_qvariant<QString> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00128 template <> struct construct_null_qvariant<QString &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00129 template <> struct construct_null_qvariant<const QString> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00130 template <> struct construct_null_qvariant<const QString &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00131 00132 template <> struct construct_null_qvariant<QStringList> { static inline QVariant get() { return QVariant(QVariant::StringList); } }; 00133 template <> struct construct_null_qvariant<QStringList &> { static inline QVariant get() { return QVariant(QVariant::StringList); } }; 00134 template <> struct construct_null_qvariant<const QStringList> { static inline QVariant get() { return QVariant(QVariant::StringList); } }; 00135 template <> struct construct_null_qvariant<const QStringList &> { static inline QVariant get() { return QVariant(QVariant::StringList); } }; 00136 00137 template <> struct construct_null_qvariant<QDate> { static inline QVariant get() { return QVariant(QVariant::Date); } }; 00138 template <> struct construct_null_qvariant<QDate &> { static inline QVariant get() { return QVariant(QVariant::Date); } }; 00139 template <> struct construct_null_qvariant<const QDate> { static inline QVariant get() { return QVariant(QVariant::Date); } }; 00140 template <> struct construct_null_qvariant<const QDate &> { static inline QVariant get() { return QVariant(QVariant::Date); } }; 00141 00142 template <> struct construct_null_qvariant<QDateTime> { static inline QVariant get() { return QVariant(QVariant::DateTime); } }; 00143 template <> struct construct_null_qvariant<QDateTime &> { static inline QVariant get() { return QVariant(QVariant::DateTime); } }; 00144 template <> struct construct_null_qvariant<const QDateTime> { static inline QVariant get() { return QVariant(QVariant::DateTime); } }; 00145 template <> struct construct_null_qvariant<const QDateTime &> { static inline QVariant get() { return QVariant(QVariant::DateTime); } }; 00146 00147 template <> struct construct_null_qvariant<QTime> { static inline QVariant get() { return QVariant(QVariant::Time); } }; 00148 template <> struct construct_null_qvariant<QTime &> { static inline QVariant get() { return QVariant(QVariant::Time); } }; 00149 template <> struct construct_null_qvariant<const QTime> { static inline QVariant get() { return QVariant(QVariant::Time); } }; 00150 template <> struct construct_null_qvariant<const QTime &> { static inline QVariant get() { return QVariant(QVariant::Time); } }; 00151 00152 template <> struct construct_null_qvariant<QUuid> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00153 template <> struct construct_null_qvariant<QUuid &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00154 template <> struct construct_null_qvariant<const QUuid> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00155 template <> struct construct_null_qvariant<const QUuid &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00156 00157 template <> struct construct_null_qvariant<qx::QxDateNeutral> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00158 template <> struct construct_null_qvariant<qx::QxDateNeutral &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00159 template <> struct construct_null_qvariant<const qx::QxDateNeutral> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00160 template <> struct construct_null_qvariant<const qx::QxDateNeutral &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00161 00162 template <> struct construct_null_qvariant<qx::QxTimeNeutral> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00163 template <> struct construct_null_qvariant<qx::QxTimeNeutral &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00164 template <> struct construct_null_qvariant<const qx::QxTimeNeutral> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00165 template <> struct construct_null_qvariant<const qx::QxTimeNeutral &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00166 00167 template <> struct construct_null_qvariant<qx::QxDateTimeNeutral> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00168 template <> struct construct_null_qvariant<qx::QxDateTimeNeutral &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00169 template <> struct construct_null_qvariant<const qx::QxDateTimeNeutral> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00170 template <> struct construct_null_qvariant<const qx::QxDateTimeNeutral &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00171 00172 template <> struct construct_null_qvariant<std::string> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00173 template <> struct construct_null_qvariant<std::string &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00174 template <> struct construct_null_qvariant<const std::string> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00175 template <> struct construct_null_qvariant<const std::string &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00176 00177 template <> struct construct_null_qvariant<std::wstring> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00178 template <> struct construct_null_qvariant<std::wstring &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00179 template <> struct construct_null_qvariant<const std::wstring> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00180 template <> struct construct_null_qvariant<const std::wstring &> { static inline QVariant get() { return QVariant(QVariant::String); } }; 00181 00182 #ifdef _QX_ENABLE_QT_GUI 00183 00184 template <> struct construct_null_qvariant<QBrush> { static inline QVariant get() { return QVariant(QVariant::Brush); } }; 00185 template <> struct construct_null_qvariant<QBrush &> { static inline QVariant get() { return QVariant(QVariant::Brush); } }; 00186 template <> struct construct_null_qvariant<const QBrush> { static inline QVariant get() { return QVariant(QVariant::Brush); } }; 00187 template <> struct construct_null_qvariant<const QBrush &> { static inline QVariant get() { return QVariant(QVariant::Brush); } }; 00188 00189 template <> struct construct_null_qvariant<QColor> { static inline QVariant get() { return QVariant(QVariant::Color); } }; 00190 template <> struct construct_null_qvariant<QColor &> { static inline QVariant get() { return QVariant(QVariant::Color); } }; 00191 template <> struct construct_null_qvariant<const QColor> { static inline QVariant get() { return QVariant(QVariant::Color); } }; 00192 template <> struct construct_null_qvariant<const QColor &> { static inline QVariant get() { return QVariant(QVariant::Color); } }; 00193 00194 template <> struct construct_null_qvariant<QFont> { static inline QVariant get() { return QVariant(QVariant::Font); } }; 00195 template <> struct construct_null_qvariant<QFont &> { static inline QVariant get() { return QVariant(QVariant::Font); } }; 00196 template <> struct construct_null_qvariant<const QFont> { static inline QVariant get() { return QVariant(QVariant::Font); } }; 00197 template <> struct construct_null_qvariant<const QFont &> { static inline QVariant get() { return QVariant(QVariant::Font); } }; 00198 00199 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 00200 template <> struct construct_null_qvariant<QMatrix> { static inline QVariant get() { return QVariant(QVariant::Matrix); } }; 00201 template <> struct construct_null_qvariant<QMatrix &> { static inline QVariant get() { return QVariant(QVariant::Matrix); } }; 00202 template <> struct construct_null_qvariant<const QMatrix> { static inline QVariant get() { return QVariant(QVariant::Matrix); } }; 00203 template <> struct construct_null_qvariant<const QMatrix &> { static inline QVariant get() { return QVariant(QVariant::Matrix); } }; 00204 #endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 00205 00206 template <> struct construct_null_qvariant<QRegion> { static inline QVariant get() { return QVariant(QVariant::Region); } }; 00207 template <> struct construct_null_qvariant<QRegion &> { static inline QVariant get() { return QVariant(QVariant::Region); } }; 00208 template <> struct construct_null_qvariant<const QRegion> { static inline QVariant get() { return QVariant(QVariant::Region); } }; 00209 template <> struct construct_null_qvariant<const QRegion &> { static inline QVariant get() { return QVariant(QVariant::Region); } }; 00210 00211 template <> struct construct_null_qvariant<QImage> { static inline QVariant get() { return QVariant(QVariant::Image); } }; 00212 template <> struct construct_null_qvariant<QImage &> { static inline QVariant get() { return QVariant(QVariant::Image); } }; 00213 template <> struct construct_null_qvariant<const QImage> { static inline QVariant get() { return QVariant(QVariant::Image); } }; 00214 template <> struct construct_null_qvariant<const QImage &> { static inline QVariant get() { return QVariant(QVariant::Image); } }; 00215 00216 template <> struct construct_null_qvariant<QPixmap> { static inline QVariant get() { return QVariant(QVariant::Pixmap); } }; 00217 template <> struct construct_null_qvariant<QPixmap &> { static inline QVariant get() { return QVariant(QVariant::Pixmap); } }; 00218 template <> struct construct_null_qvariant<const QPixmap> { static inline QVariant get() { return QVariant(QVariant::Pixmap); } }; 00219 template <> struct construct_null_qvariant<const QPixmap &> { static inline QVariant get() { return QVariant(QVariant::Pixmap); } }; 00220 00221 #endif // _QX_ENABLE_QT_GUI 00222 00223 } // namespace trait 00224 } // namespace qx 00225 00226 #endif // _QX_CONSTRUCT_NULL_QVARIANT_H_