QxOrm  1.5.0
C++ Object Relational Mapping library
is_qt_variant_compatible.h
Go to the documentation of this file.
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_IS_QT_VARIANT_COMPATIBLE_H_
00033 #define _QX_IS_QT_VARIANT_COMPATIBLE_H_
00034 
00035 #ifdef _MSC_VER
00036 #pragma once
00037 #endif
00038 
00046 #include <QtCore/qvariant.h>
00047 
00048 #include <QxCommon/QxConfig.h>
00049 
00050 namespace qx {
00051 namespace trait {
00052 
00057 template <typename T>
00058 struct is_qt_variant_compatible
00059 { enum { value = (std::is_enum<T>::value || std::is_integral<T>::value) }; };
00060 
00061 template <> struct is_qt_variant_compatible<bool>                 { enum { value = true }; };
00062 template <> struct is_qt_variant_compatible<short>                { enum { value = true }; };
00063 template <> struct is_qt_variant_compatible<int>                  { enum { value = true }; };
00064 template <> struct is_qt_variant_compatible<long>                 { enum { value = true }; };
00065 template <> struct is_qt_variant_compatible<long long>            { enum { value = true }; };
00066 template <> struct is_qt_variant_compatible<float>                { enum { value = true }; };
00067 template <> struct is_qt_variant_compatible<double>               { enum { value = true }; };
00068 template <> struct is_qt_variant_compatible<long double>          { enum { value = true }; };
00069 template <> struct is_qt_variant_compatible<unsigned short>       { enum { value = true }; };
00070 template <> struct is_qt_variant_compatible<unsigned int>         { enum { value = true }; };
00071 template <> struct is_qt_variant_compatible<unsigned long>        { enum { value = true }; };
00072 template <> struct is_qt_variant_compatible<unsigned long long>   { enum { value = true }; };
00073 template <> struct is_qt_variant_compatible<QString>              { enum { value = true }; };
00074 template <> struct is_qt_variant_compatible<QDate>                { enum { value = true }; };
00075 template <> struct is_qt_variant_compatible<QTime>                { enum { value = true }; };
00076 template <> struct is_qt_variant_compatible<QDateTime>            { enum { value = true }; };
00077 template <> struct is_qt_variant_compatible<QBitArray>            { enum { value = true }; };
00078 template <> struct is_qt_variant_compatible<QByteArray>           { enum { value = true }; };
00079 template <> struct is_qt_variant_compatible<QLatin1String>        { enum { value = true }; };
00080 template <> struct is_qt_variant_compatible<QStringList>          { enum { value = true }; };
00081 template <> struct is_qt_variant_compatible<QChar>                { enum { value = true }; };
00082 template <> struct is_qt_variant_compatible<QLocale>              { enum { value = true }; };
00083 template <> struct is_qt_variant_compatible<QSize>                { enum { value = true }; };
00084 template <> struct is_qt_variant_compatible<QSizeF>               { enum { value = true }; };
00085 template <> struct is_qt_variant_compatible<QPoint>               { enum { value = true }; };
00086 template <> struct is_qt_variant_compatible<QPointF>              { enum { value = true }; };
00087 template <> struct is_qt_variant_compatible<QLine>                { enum { value = true }; };
00088 template <> struct is_qt_variant_compatible<QLineF>               { enum { value = true }; };
00089 template <> struct is_qt_variant_compatible<QRect>                { enum { value = true }; };
00090 template <> struct is_qt_variant_compatible<QRectF>               { enum { value = true }; };
00091 template <> struct is_qt_variant_compatible<QUrl>                 { enum { value = true }; };
00092 template <> struct is_qt_variant_compatible<QVariant>             { enum { value = true }; };
00093 
00094 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
00095 template <> struct is_qt_variant_compatible<QRegExp>              { enum { value = true }; };
00096 #endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
00097 
00098 #ifdef _QX_ENABLE_QT_GUI
00099 template <> struct is_qt_variant_compatible<QBrush>               { enum { value = true }; };
00100 template <> struct is_qt_variant_compatible<QColor>               { enum { value = true }; };
00101 template <> struct is_qt_variant_compatible<QFont>                { enum { value = true }; };
00102 template <> struct is_qt_variant_compatible<QImage>               { enum { value = true }; };
00103 template <> struct is_qt_variant_compatible<QPixmap>              { enum { value = true }; };
00104 template <> struct is_qt_variant_compatible<QRegion>              { enum { value = true }; };
00105 #endif // _QX_ENABLE_QT_GUI
00106 
00107 template <> struct is_qt_variant_compatible< QList<QVariant> >             { enum { value = true }; };
00108 template <> struct is_qt_variant_compatible< QMap<QString, QVariant> >     { enum { value = true }; };
00109 template <> struct is_qt_variant_compatible< QHash<QString, QVariant> >    { enum { value = true }; };
00110 
00111 } // namespace trait
00112 } // namespace qx
00113 
00114 #endif // _QX_IS_QT_VARIANT_COMPATIBLE_H_