first commit

This commit is contained in:
bing
2026-04-03 11:32:07 +08:00
commit 003be19522
1142 changed files with 185854 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_ARCHIVE_PRINTABLE_H_
#define _QX_ARCHIVE_PRINTABLE_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file archive_printable.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_archive_printable<T>::value : define if a boost::archive type is readable by a human (for example XML archive) or not (for example binary archive)
*/
#include <QxSerialize/boost/QxSerializeInclude.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_archive_printable<T>::value : define if a boost::archive type is readable by a human (for example XML archive) or not (for example binary archive)
*/
template <typename T>
struct is_archive_printable
{
enum
{
value = false
};
};
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
#if _QX_SERIALIZE_POLYMORPHIC
template <>
struct is_archive_printable<boost::archive::polymorphic_iarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_printable<boost::archive::polymorphic_oarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_POLYMORPHIC
#if _QX_SERIALIZE_TEXT
template <>
struct is_archive_printable<boost::archive::text_iarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_printable<boost::archive::text_oarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_TEXT
#if _QX_SERIALIZE_XML
template <>
struct is_archive_printable<boost::archive::xml_iarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_printable<boost::archive::xml_oarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_XML
#if _QX_SERIALIZE_WIDE_TEXT
template <>
struct is_archive_printable<boost::archive::text_wiarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_printable<boost::archive::text_woarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_WIDE_TEXT
#if _QX_SERIALIZE_WIDE_XML
template <>
struct is_archive_printable<boost::archive::xml_wiarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_printable<boost::archive::xml_woarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_WIDE_XML
#endif // _QX_ENABLE_BOOST_SERIALIZATION
} // namespace trait
} // namespace qx
#endif // _QX_ARCHIVE_PRINTABLE_H_

View File

@@ -0,0 +1,249 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_ARCHIVE_WIDE_TRAITS_H_
#define _QX_ARCHIVE_WIDE_TRAITS_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file archive_wide_traits.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_archive_wide<T>::value : define if a boost::archive type uses wide string character and stream (for example std::wstring) or not (for example std::string)
*/
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <QtCore/qstring.h>
#include <QxSerialize/boost/QxSerializeInclude.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_archive_wide<T>::value : define if a boost::archive type uses wide string character and stream (for example std::wstring) or not (for example std::string)
*/
template <typename T>
struct is_archive_wide
{
enum
{
value = false
};
};
#if _QX_SERIALIZE_WIDE_BINARY
template <>
struct is_archive_wide<boost::archive::binary_wiarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_wide<boost::archive::binary_woarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_WIDE_BINARY
#if _QX_SERIALIZE_WIDE_TEXT
template <>
struct is_archive_wide<boost::archive::text_wiarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_wide<boost::archive::text_woarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_WIDE_TEXT
#if _QX_SERIALIZE_WIDE_XML
template <>
struct is_archive_wide<boost::archive::xml_wiarchive>
{
enum
{
value = true
};
};
template <>
struct is_archive_wide<boost::archive::xml_woarchive>
{
enum
{
value = true
};
};
#endif // _QX_SERIALIZE_WIDE_XML
template <typename T>
class archive_wide_traits
{
public:
enum
{
is_wide = qx::trait::is_archive_wide<T>::value
};
typedef typename std::conditional<is_wide, wchar_t, char>::type type_char;
typedef typename std::conditional<is_wide, std::wstring, std::string>::type type_string;
typedef typename std::conditional<is_wide, std::wistream, std::istream>::type type_istream;
typedef typename std::conditional<is_wide, std::wostream, std::ostream>::type type_ostream;
typedef typename std::conditional<is_wide, std::wstringstream, std::stringstream>::type type_stringstream;
typedef typename std::conditional<is_wide, std::wistringstream, std::istringstream>::type type_istringstream;
typedef typename std::conditional<is_wide, std::wostringstream, std::ostringstream>::type type_ostringstream;
typedef typename std::conditional<is_wide, std::wfstream, std::fstream>::type type_fstream;
typedef typename std::conditional<is_wide, std::wifstream, std::ifstream>::type type_ifstream;
typedef typename std::conditional<is_wide, std::wofstream, std::ofstream>::type type_ofstream;
static inline QString toQString(const type_string &str) { return cvtQString<is_wide, 0>::toQString(str); }
static inline void fromQString(const QString &str, type_string &result) { cvtQString<is_wide, 0>::fromQString(str, result); }
static inline QByteArray toQByteArray(const type_string &str, type_string *owner) { return cvtQByteArray<is_wide, 0>::toQByteArray(str, owner); }
static inline void fromQByteArray(const QByteArray &data, type_string &result) { cvtQByteArray<is_wide, 0>::fromQByteArray(data, result); }
private:
template <bool isWide /* = false */, int dummy>
struct cvtQString
{
#ifndef QT_NO_STL
static inline QString toQString(const std::string &str) { return QString::fromStdString(str); }
static inline void fromQString(const QString &str, std::string &result) { result = str.toStdString(); }
#else // QT_NO_STL
static inline QString toQString(const std::string &str) { return QString::fromLatin1(str.data(), int(str.size())); }
static inline void fromQString(const QString &str, std::string &result) { result = str.toLatin1().constData(); }
#endif // QT_NO_STL
};
template <int dummy>
struct cvtQString<true, dummy>
{
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
static inline QString toQString(const std::wstring &str) { return QString::fromStdWString(str); }
static inline void fromQString(const QString &str, std::wstring &result) { result = str.toStdWString(); }
#else // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
static inline QString toQString(const std::wstring &str)
{
Q_UNUSED(str);
qAssert(false); /* Need STL compatibility ! */
return QString();
}
static inline void fromQString(const QString &str, std::wstring &result)
{
Q_UNUSED(str);
Q_UNUSED(result);
qAssert(false); /* Need STL compatibility ! */
}
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
};
template <bool isWide /* = false */, int dummy>
struct cvtQByteArray
{
static inline QByteArray toQByteArray(const std::string &str, std::string *owner)
{
if (owner)
{
(*owner) = str;
};
return (owner ? QByteArray::fromRawData(owner->data(), owner->size()) : QByteArray(str.data(), str.size()));
}
static inline void fromQByteArray(const QByteArray &data, std::string &result)
{
result.clear();
result.append(data.constData(), data.size());
}
};
template <int dummy>
struct cvtQByteArray<true, dummy>
{
static inline QByteArray toQByteArray(const std::wstring &str, std::wstring *owner)
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
{
Q_UNUSED(owner);
return QString::fromStdWString(str).toUtf8();
}
#else // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
{
Q_UNUSED(owner);
Q_UNUSED(str);
qAssert(false); /* Need STL compatibility ! */
return QByteArray();
}
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
static inline void fromQByteArray(const QByteArray &data, std::wstring &result)
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
{
result = QString::fromUtf8(data.constData(), data.size()).toStdWString();
}
#else // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
{
Q_UNUSED(data);
Q_UNUSED(result);
qAssert(false); /* Need STL compatibility ! */
}
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
};
};
} // namespace trait
} // namespace qx
#endif // _QX_ARCHIVE_WIDE_TRAITS_H_

View File

@@ -0,0 +1,727 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_CONSTRUCT_NULL_QVARIANT_H_
#define _QX_CONSTRUCT_NULL_QVARIANT_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file construct_null_qvariant.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::construct_null_qvariant<T>::get() : create a NULL QVariant which matches QVariant::Type with type T
*/
#include <QtCore/qvariant.h>
#include <QxDao/QxDateNeutral.h>
#include <QxDao/QxTimeNeutral.h>
#include <QxDao/QxDateTimeNeutral.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::construct_null_qvariant<T>::get() : create a NULL QVariant which matches QVariant::Type with type T
*/
template <typename T>
struct construct_null_qvariant
{
static inline QVariant get() { return QVariant(); }
};
template <>
struct construct_null_qvariant<QBitArray>
{
static inline QVariant get() { return QVariant(QVariant::BitArray); }
};
template <>
struct construct_null_qvariant<QBitArray &>
{
static inline QVariant get() { return QVariant(QVariant::BitArray); }
};
template <>
struct construct_null_qvariant<const QBitArray>
{
static inline QVariant get() { return QVariant(QVariant::BitArray); }
};
template <>
struct construct_null_qvariant<const QBitArray &>
{
static inline QVariant get() { return QVariant(QVariant::BitArray); }
};
template <>
struct construct_null_qvariant<QByteArray>
{
static inline QVariant get() { return QVariant(QVariant::ByteArray); }
};
template <>
struct construct_null_qvariant<QByteArray &>
{
static inline QVariant get() { return QVariant(QVariant::ByteArray); }
};
template <>
struct construct_null_qvariant<const QByteArray>
{
static inline QVariant get() { return QVariant(QVariant::ByteArray); }
};
template <>
struct construct_null_qvariant<const QByteArray &>
{
static inline QVariant get() { return QVariant(QVariant::ByteArray); }
};
template <>
struct construct_null_qvariant<bool>
{
static inline QVariant get() { return QVariant(QVariant::Bool); }
};
template <>
struct construct_null_qvariant<bool &>
{
static inline QVariant get() { return QVariant(QVariant::Bool); }
};
template <>
struct construct_null_qvariant<const bool>
{
static inline QVariant get() { return QVariant(QVariant::Bool); }
};
template <>
struct construct_null_qvariant<const bool &>
{
static inline QVariant get() { return QVariant(QVariant::Bool); }
};
template <>
struct construct_null_qvariant<short>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<short &>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<const short>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<const short &>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<int>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<int &>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<const int>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<const int &>
{
static inline QVariant get() { return QVariant(QVariant::Int); }
};
template <>
struct construct_null_qvariant<long>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<long &>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<const long>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<const long &>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<long long>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<long long &>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<const long long>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<const long long &>
{
static inline QVariant get() { return QVariant(QVariant::LongLong); }
};
template <>
struct construct_null_qvariant<float>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<float &>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<const float>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<const float &>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<double>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<double &>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<const double>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<const double &>
{
static inline QVariant get() { return QVariant(QVariant::Double); }
};
template <>
struct construct_null_qvariant<unsigned short>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<unsigned short &>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<const unsigned short>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<const unsigned short &>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<unsigned int>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<unsigned int &>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<const unsigned int>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<const unsigned int &>
{
static inline QVariant get() { return QVariant(QVariant::UInt); }
};
template <>
struct construct_null_qvariant<unsigned long>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<unsigned long &>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<const unsigned long>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<const unsigned long &>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<unsigned long long>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<unsigned long long &>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<const unsigned long long>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<const unsigned long long &>
{
static inline QVariant get() { return QVariant(QVariant::ULongLong); }
};
template <>
struct construct_null_qvariant<QString>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<QString &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const QString>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const QString &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<QStringList>
{
static inline QVariant get() { return QVariant(QVariant::StringList); }
};
template <>
struct construct_null_qvariant<QStringList &>
{
static inline QVariant get() { return QVariant(QVariant::StringList); }
};
template <>
struct construct_null_qvariant<const QStringList>
{
static inline QVariant get() { return QVariant(QVariant::StringList); }
};
template <>
struct construct_null_qvariant<const QStringList &>
{
static inline QVariant get() { return QVariant(QVariant::StringList); }
};
template <>
struct construct_null_qvariant<QDate>
{
static inline QVariant get() { return QVariant(QVariant::Date); }
};
template <>
struct construct_null_qvariant<QDate &>
{
static inline QVariant get() { return QVariant(QVariant::Date); }
};
template <>
struct construct_null_qvariant<const QDate>
{
static inline QVariant get() { return QVariant(QVariant::Date); }
};
template <>
struct construct_null_qvariant<const QDate &>
{
static inline QVariant get() { return QVariant(QVariant::Date); }
};
template <>
struct construct_null_qvariant<QDateTime>
{
static inline QVariant get() { return QVariant(QVariant::DateTime); }
};
template <>
struct construct_null_qvariant<QDateTime &>
{
static inline QVariant get() { return QVariant(QVariant::DateTime); }
};
template <>
struct construct_null_qvariant<const QDateTime>
{
static inline QVariant get() { return QVariant(QVariant::DateTime); }
};
template <>
struct construct_null_qvariant<const QDateTime &>
{
static inline QVariant get() { return QVariant(QVariant::DateTime); }
};
template <>
struct construct_null_qvariant<QTime>
{
static inline QVariant get() { return QVariant(QVariant::Time); }
};
template <>
struct construct_null_qvariant<QTime &>
{
static inline QVariant get() { return QVariant(QVariant::Time); }
};
template <>
struct construct_null_qvariant<const QTime>
{
static inline QVariant get() { return QVariant(QVariant::Time); }
};
template <>
struct construct_null_qvariant<const QTime &>
{
static inline QVariant get() { return QVariant(QVariant::Time); }
};
template <>
struct construct_null_qvariant<QUuid>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<QUuid &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const QUuid>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const QUuid &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<qx::QxDateNeutral>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<qx::QxDateNeutral &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const qx::QxDateNeutral>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const qx::QxDateNeutral &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<qx::QxTimeNeutral>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<qx::QxTimeNeutral &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const qx::QxTimeNeutral>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const qx::QxTimeNeutral &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<qx::QxDateTimeNeutral>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<qx::QxDateTimeNeutral &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const qx::QxDateTimeNeutral>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const qx::QxDateTimeNeutral &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<std::string>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<std::string &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const std::string>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const std::string &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<std::wstring>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<std::wstring &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const std::wstring>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
template <>
struct construct_null_qvariant<const std::wstring &>
{
static inline QVariant get() { return QVariant(QVariant::String); }
};
#ifdef _QX_ENABLE_QT_GUI
template <>
struct construct_null_qvariant<QBrush>
{
static inline QVariant get() { return QVariant(QVariant::Brush); }
};
template <>
struct construct_null_qvariant<QBrush &>
{
static inline QVariant get() { return QVariant(QVariant::Brush); }
};
template <>
struct construct_null_qvariant<const QBrush>
{
static inline QVariant get() { return QVariant(QVariant::Brush); }
};
template <>
struct construct_null_qvariant<const QBrush &>
{
static inline QVariant get() { return QVariant(QVariant::Brush); }
};
template <>
struct construct_null_qvariant<QColor>
{
static inline QVariant get() { return QVariant(QVariant::Color); }
};
template <>
struct construct_null_qvariant<QColor &>
{
static inline QVariant get() { return QVariant(QVariant::Color); }
};
template <>
struct construct_null_qvariant<const QColor>
{
static inline QVariant get() { return QVariant(QVariant::Color); }
};
template <>
struct construct_null_qvariant<const QColor &>
{
static inline QVariant get() { return QVariant(QVariant::Color); }
};
template <>
struct construct_null_qvariant<QFont>
{
static inline QVariant get() { return QVariant(QVariant::Font); }
};
template <>
struct construct_null_qvariant<QFont &>
{
static inline QVariant get() { return QVariant(QVariant::Font); }
};
template <>
struct construct_null_qvariant<const QFont>
{
static inline QVariant get() { return QVariant(QVariant::Font); }
};
template <>
struct construct_null_qvariant<const QFont &>
{
static inline QVariant get() { return QVariant(QVariant::Font); }
};
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <>
struct construct_null_qvariant<QMatrix>
{
static inline QVariant get() { return QVariant(QVariant::Matrix); }
};
template <>
struct construct_null_qvariant<QMatrix &>
{
static inline QVariant get() { return QVariant(QVariant::Matrix); }
};
template <>
struct construct_null_qvariant<const QMatrix>
{
static inline QVariant get() { return QVariant(QVariant::Matrix); }
};
template <>
struct construct_null_qvariant<const QMatrix &>
{
static inline QVariant get() { return QVariant(QVariant::Matrix); }
};
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <>
struct construct_null_qvariant<QRegion>
{
static inline QVariant get() { return QVariant(QVariant::Region); }
};
template <>
struct construct_null_qvariant<QRegion &>
{
static inline QVariant get() { return QVariant(QVariant::Region); }
};
template <>
struct construct_null_qvariant<const QRegion>
{
static inline QVariant get() { return QVariant(QVariant::Region); }
};
template <>
struct construct_null_qvariant<const QRegion &>
{
static inline QVariant get() { return QVariant(QVariant::Region); }
};
template <>
struct construct_null_qvariant<QImage>
{
static inline QVariant get() { return QVariant(QVariant::Image); }
};
template <>
struct construct_null_qvariant<QImage &>
{
static inline QVariant get() { return QVariant(QVariant::Image); }
};
template <>
struct construct_null_qvariant<const QImage>
{
static inline QVariant get() { return QVariant(QVariant::Image); }
};
template <>
struct construct_null_qvariant<const QImage &>
{
static inline QVariant get() { return QVariant(QVariant::Image); }
};
template <>
struct construct_null_qvariant<QPixmap>
{
static inline QVariant get() { return QVariant(QVariant::Pixmap); }
};
template <>
struct construct_null_qvariant<QPixmap &>
{
static inline QVariant get() { return QVariant(QVariant::Pixmap); }
};
template <>
struct construct_null_qvariant<const QPixmap>
{
static inline QVariant get() { return QVariant(QVariant::Pixmap); }
};
template <>
struct construct_null_qvariant<const QPixmap &>
{
static inline QVariant get() { return QVariant(QVariant::Pixmap); }
};
#endif // _QX_ENABLE_QT_GUI
} // namespace trait
} // namespace qx
#endif // _QX_CONSTRUCT_NULL_QVARIANT_H_

View File

@@ -0,0 +1,242 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_CONSTRUCT_PTR_H_
#define _QX_CONSTRUCT_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file construct_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::construct_ptr<T>::get(T & t, bool bReset = false) : instantiate (or reset) a new pointer, support both nude-pointer and smart-pointer of boost, Qt and QxOrm libraries
*/
#include <QtCore/qsharedpointer.h>
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QtCore/qscopedpointer.h>
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QxDao/QxDaoPointer.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::construct_ptr<T>::get(T & t, bool bReset = false) : instantiate (or reset) a new pointer, support both nude-pointer and smart-pointer of boost, Qt and QxOrm libraries
*/
template <typename T>
struct construct_ptr
{
private:
typedef typename std::remove_pointer<T>::type type_ptr;
public:
static inline void get(T &t, bool bReset = false)
{
new_ptr<std::is_abstract<type_ptr>::value, 0>::get(t, bReset);
}
private:
template <bool isAbstract /* = false */, int dummy>
struct new_ptr
{
static inline void get(T &t, bool bReset)
{
if (bReset)
{
t = NULL;
}
else
{
t = new type_ptr();
}
}
};
template <int dummy>
struct new_ptr<true, dummy>
{
static inline void get(T &t, bool bReset)
{
Q_UNUSED(t);
Q_UNUSED(bReset);
qDebug("[QxOrm] qx::trait::construct_ptr<T> : %s", "cannot instantiate abstract class");
}
};
};
#ifdef _QX_ENABLE_BOOST
template <typename T>
struct construct_ptr<boost::scoped_ptr<T>>
{
static inline void get(boost::scoped_ptr<T> &t, bool bReset = false)
{
if (bReset)
{
t.reset();
}
else
{
t.reset(new T());
}
}
};
template <typename T>
struct construct_ptr<boost::shared_ptr<T>>
{
static inline void get(boost::shared_ptr<T> &t, bool bReset = false)
{
if (bReset)
{
t.reset();
}
else
{
t.reset(new T());
}
}
};
template <typename T>
struct construct_ptr<boost::intrusive_ptr<T>>
{
static inline void get(boost::intrusive_ptr<T> &t, bool bReset = false)
{
if (bReset)
{
t.reset();
}
else
{
t.reset(new T());
}
}
};
#endif // _QX_ENABLE_BOOST
template <typename T>
struct construct_ptr<QSharedPointer<T>>
{
static inline void get(QSharedPointer<T> &t, bool bReset = false)
{
if (bReset)
{
t = QSharedPointer<T>();
}
else
{
t = QSharedPointer<T>(new T());
}
}
};
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct construct_ptr<QScopedPointer<T>>
{
static inline void get(QScopedPointer<T> &t, bool bReset = false)
{
if (bReset)
{
t = QScopedPointer<T>();
}
else
{
t = QScopedPointer<T>(new T());
}
}
};
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct construct_ptr<qx::dao::ptr<T>>
{
static inline void get(qx::dao::ptr<T> &t, bool bReset = false)
{
if (bReset)
{
t = qx::dao::ptr<T>();
}
else
{
t = qx::dao::ptr<T>(new T());
}
}
};
template <typename T>
struct construct_ptr<std::unique_ptr<T>>
{
static inline void get(std::unique_ptr<T> &t, bool bReset = false)
{
if (bReset)
{
t.reset();
}
else
{
t.reset(new T());
}
}
};
template <typename T>
struct construct_ptr<std::shared_ptr<T>>
{
static inline void get(std::shared_ptr<T> &t, bool bReset = false)
{
if (bReset)
{
t.reset();
}
else
{
t = std::make_shared<T>();
}
}
};
} // namespace trait
} // namespace qx
#endif // _QX_CONSTRUCT_PTR_H_

View File

@@ -0,0 +1,662 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_GENERIC_CONTAINER_H_
#define _QX_GENERIC_CONTAINER_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file generic_container.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::generic_container<T> : provide some tools to manage all containers without knowing its type
*/
#include <QxTraits/is_smart_ptr.h>
#include <QxTraits/remove_attr.h>
#include <QxTraits/remove_smart_ptr.h>
#include <QxTraits/construct_ptr.h>
namespace qx
{
namespace trait
{
class no_type
{
private:
void dummy() const { ; }
};
/*!
* \ingroup QxTraits
* \brief qx::trait::generic_container<T> : provide some tools to manage all containers without knowing its type
*/
template <class T>
struct generic_container
{
typedef no_type type_item;
typedef no_type type_key;
typedef no_type type_value;
typedef no_type type_value_qx;
typedef no_type type_iterator;
};
template <typename Key, typename Value>
struct generic_container_item
{
typedef Key type_key;
typedef Value type_value;
typedef typename qx::trait::remove_attr<Value>::type type_value_qx_tmp;
typedef typename qx::trait::remove_smart_ptr<type_value_qx_tmp>::type type_value_qx;
enum
{
is_key_pointer = (std::is_pointer<type_key>::value || qx::trait::is_smart_ptr<type_key>::value)
};
enum
{
is_value_pointer = (std::is_pointer<type_value>::value || qx::trait::is_smart_ptr<type_value>::value)
};
private:
std::pair<type_key, type_value> m_pair;
public:
generic_container_item() { ; }
generic_container_item(const Key &key, const Value &value) { m_pair = std::make_pair(key, value); }
~generic_container_item() { ; }
inline type_key &key() { return m_pair.first; }
inline type_value &value() { return m_pair.second; }
inline const type_key &key() const { return m_pair.first; }
inline const type_value &value() const { return m_pair.second; }
inline type_value_qx &value_qx() { return value_qx_Helper<is_value_pointer, type_value, type_value_qx, 0>::get(m_pair.second); }
inline const type_value_qx &value_qx() const { return value_qx_Helper<is_value_pointer, type_value, type_value_qx, 0>::get(m_pair.second); }
inline void key(const Key &key) { m_pair.first = key; }
inline void value(const Value &value) { m_pair.second = value; }
static inline type_key newKey() { return new_Helper<is_key_pointer, type_key, 0>::get(); }
static inline type_value newValue() { return new_Helper<is_value_pointer, type_value, 0>::get(); }
private:
template <bool bIsPointer /* = true */, typename T, int dummy>
struct new_Helper
{
static inline T get()
{
T t;
qx::trait::construct_ptr<T>::get(t);
return t;
}
};
template <typename T, int dummy>
struct new_Helper<false, T, dummy>
{
static inline T get() { return T(); }
};
template <bool bIsPointer /* = true */, typename T, typename U, int dummy>
struct value_qx_Helper
{
static inline U &get(T &t) { return (*t); }
};
template <typename T, typename U, int dummy>
struct value_qx_Helper<false, T, U, dummy>
{
static inline U &get(T &t) { return t; }
};
};
} // namespace trait
} // namespace qx
#define QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(TypeContainer, TypeKey, TypeValue) \
typedef qx::trait::generic_container_item<TypeKey, TypeValue> type_item; \
typedef typename type_item::type_key type_key; \
typedef typename type_item::type_value type_value; \
typedef typename type_item::type_value_qx type_value_qx; \
typedef typename TypeContainer::iterator type_iterator;
namespace qx
{
namespace trait
{
namespace detail
{
template <typename Container, typename Item>
struct generic_container_base
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, qx::trait::no_type, Item)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l) { t.reserve(l); }
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Item *insertItem(Container &t, type_item &item)
{
t.push_back(item.value());
return (&t.back());
}
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin());
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr);
return itr;
}
};
template <typename Container, typename Item>
struct generic_container_base_without_reserve
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, qx::trait::no_type, Item)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l)
{
Q_UNUSED(t);
Q_UNUSED(l);
}
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Item *insertItem(Container &t, type_item &item)
{
t.push_back(item.value());
return (&t.back());
}
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin());
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr);
return itr;
}
};
template <typename Container, typename Item>
struct generic_container_base_set
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, qx::trait::no_type, Item)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l)
{
Q_UNUSED(t);
Q_UNUSED(l);
}
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Item *insertItem(Container &t, type_item &item) { return const_cast<Item *>(&(*(t.insert(item.value()).first))); }
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin());
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr);
return itr;
}
};
template <typename Container, typename Item>
struct generic_container_base_multi_set
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, qx::trait::no_type, Item)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l)
{
Q_UNUSED(t);
Q_UNUSED(l);
}
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Item *insertItem(Container &t, type_item &item) { return const_cast<Item *>(&(*(t.insert(item.value())))); }
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin());
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr);
return itr;
}
};
template <typename Container, typename Key, typename Value>
struct generic_container_base_key_value_std_style
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, Key, Value)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l) { t.reserve(l); }
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Value *insertItem(Container &t, type_item &item) { return (&(t.insert(std::make_pair(item.key(), item.value())).first->second)); }
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin().second);
item.key(*t.begin().first);
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr.second);
item.key(*itr.first);
return itr;
}
};
template <typename Container, typename Key, typename Value>
struct generic_container_base_key_value_without_reserve
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, Key, Value)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l)
{
Q_UNUSED(t);
Q_UNUSED(l);
}
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Value *insertItem(Container &t, type_item &item) { return (&(t.insert(std::make_pair(item.key(), item.value())).first->second)); }
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin().second);
item.key(*t.begin().first);
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr.second);
item.key(*itr.first);
return itr;
}
};
template <typename Container, typename Key, typename Value>
struct generic_container_base_key_value_multi_std_style
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, Key, Value)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l) { t.reserve(l); }
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Value *insertItem(Container &t, type_item &item) { return (&(t.insert(std::make_pair(item.key(), item.value()))->second)); }
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin().second);
item.key(*t.begin().first);
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr.second);
item.key(*itr.first);
return itr;
}
};
template <typename Container, typename Key, typename Value>
struct generic_container_base_key_value_qt_style
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(Container, Key, Value)
static inline long size(const Container &t) { return static_cast<long>(t.size()); }
static inline void clear(Container &t) { t.clear(); }
static inline void reserve(Container &t, long l) { t.reserve(l); }
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Value *insertItem(Container &t, type_item &item) { return (&(t.insert(item.key(), item.value()).value())); }
static inline type_iterator end(Container &t) { return t.end(); }
static inline type_iterator begin(Container &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(*t.begin().value());
item.key(*t.begin().key());
return t.begin();
}
static inline type_iterator next(Container &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
item.value(*itr.value());
item.key(*itr.key());
return itr;
}
};
} // namespace detail
template <typename T>
struct generic_container<std::vector<T>> : public qx::trait::detail::generic_container_base<std::vector<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(std::vector, T), qx::trait::no_type, T)
};
template <typename T>
struct generic_container<std::list<T>> : public qx::trait::detail::generic_container_base_without_reserve<std::list<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(std::list, T), qx::trait::no_type, T)
};
template <typename T>
struct generic_container<std::set<T>> : public qx::trait::detail::generic_container_base_set<std::set<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(std::set, T), qx::trait::no_type, T)
};
template <typename Key, typename Value>
struct generic_container<std::map<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_without_reserve<std::map<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(std::map, Key, Value), Key, Value)
};
#ifdef _QX_ENABLE_BOOST
template <typename T>
struct generic_container<boost::unordered_set<T>> : public qx::trait::detail::generic_container_base_set<boost::unordered_set<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(boost::unordered_set, T), qx::trait::no_type, T)
};
template <typename T>
struct generic_container<boost::unordered_multiset<T>> : public qx::trait::detail::generic_container_base_multi_set<boost::unordered_multiset<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(boost::unordered_multiset, T), qx::trait::no_type, T)
};
template <typename Key, typename Value>
struct generic_container<boost::unordered_map<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_std_style<boost::unordered_map<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(boost::unordered_map, Key, Value), Key, Value)
};
template <typename Key, typename Value>
struct generic_container<boost::unordered_multimap<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_multi_std_style<boost::unordered_multimap<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(boost::unordered_multimap, Key, Value), Key, Value)
};
#endif // _QX_ENABLE_BOOST
template <typename T>
struct generic_container<std::unordered_set<T>> : public qx::trait::detail::generic_container_base_set<std::unordered_set<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(std::unordered_set, T), qx::trait::no_type, T)
};
template <typename T>
struct generic_container<std::unordered_multiset<T>> : public qx::trait::detail::generic_container_base_multi_set<std::unordered_multiset<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(std::unordered_multiset, T), qx::trait::no_type, T)
};
template <typename Key, typename Value>
struct generic_container<std::unordered_map<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_std_style<std::unordered_map<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(std::unordered_map, Key, Value), Key, Value)
};
template <typename Key, typename Value>
struct generic_container<std::unordered_multimap<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_multi_std_style<std::unordered_multimap<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(std::unordered_multimap, Key, Value), Key, Value)
};
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename T>
struct generic_container<QVector<T>> : public qx::trait::detail::generic_container_base<QVector<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(QVector, T), qx::trait::no_type, T)
};
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
template <typename T>
struct generic_container<QList<T>> : public qx::trait::detail::generic_container_base<QList<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(QList, T), qx::trait::no_type, T)
};
#else // (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
template <typename T>
struct generic_container<QList<T>> : public qx::trait::detail::generic_container_base_without_reserve<QList<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(QList, T), qx::trait::no_type, T)
};
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
template <typename T>
struct generic_container<QLinkedList<T>> : public qx::trait::detail::generic_container_base_without_reserve<QLinkedList<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(QLinkedList, T), qx::trait::no_type, T)
};
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
template <typename T>
struct generic_container<QSet<T>> : public qx::trait::detail::generic_container_base_multi_set<QSet<T>, T>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1(QSet, T), qx::trait::no_type, T)
};
template <typename Key, typename Value>
struct generic_container<QMap<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_qt_style<QMap<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(QMap, Key, Value), Key, Value)
};
template <typename Key, typename Value>
struct generic_container<QMultiMap<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_qt_style<QMultiMap<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(QMultiMap, Key, Value), Key, Value)
};
template <typename Key, typename Value>
struct generic_container<QHash<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_qt_style<QHash<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(QHash, Key, Value), Key, Value)
};
template <typename Key, typename Value>
struct generic_container<QMultiHash<Key, Value>> : public qx::trait::detail::generic_container_base_key_value_qt_style<QMultiHash<Key, Value>, Key, Value>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(QMultiHash, Key, Value), Key, Value)
};
template <typename Key, typename Value>
struct generic_container<qx::QxCollection<Key, Value>>
{
QX_TRAIT_GENERIC_CONTAINER_TYPEDEF(QX_TEMPLATE_T_P1_P2(qx::QxCollection, Key, Value), Key, Value)
static inline long size(const qx::QxCollection<Key, Value> &t) { return static_cast<long>(t.size()); }
static inline void clear(qx::QxCollection<Key, Value> &t) { t.clear(); }
static inline void reserve(qx::QxCollection<Key, Value> &t, long l) { t.reserve(l); }
static inline type_item createItem() { return type_item(type_item::newKey(), type_item::newValue()); }
static inline Value *insertItem(qx::QxCollection<Key, Value> &t, type_item &item)
{
t.insert(item.key(), item.value());
return const_cast<Value *>(&t.getByKey(item.key()));
}
static inline type_iterator end(qx::QxCollection<Key, Value> &t) { return t.end(); }
static inline type_iterator begin(qx::QxCollection<Key, Value> &t, type_item &item)
{
if (t.size() <= 0)
{
return t.end();
};
item.value(t.getByIndex(0));
item.key(t.getKeyByIndex(0));
return t.begin();
}
static inline type_iterator next(qx::QxCollection<Key, Value> &t, type_iterator itr, type_item &item)
{
itr++;
if (itr == t.end())
{
return t.end();
};
long l = (itr - t.begin());
item.value(t.getByIndex(l));
item.key(t.getKeyByIndex(l));
return itr;
}
};
} // namespace trait
} // namespace qx
#endif // _QX_GENERIC_CONTAINER_H_

View File

@@ -0,0 +1,124 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_GET_BASE_CLASS_H_
#define _QX_GET_BASE_CLASS_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file get_base_class.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::get_base_class<T>::type : retrieve base class of type T registered into QxOrm context and return qx::trait::no_base_class_defined if no base class defined
*/
#include <QxTraits/get_class_name.h>
namespace qx
{
namespace trait
{
class no_base_class_defined
{
public:
no_base_class_defined() { ; };
virtual ~no_base_class_defined() { ; };
virtual void dummy() = 0;
};
/*!
* \ingroup QxTraits
* \brief qx::trait::get_base_class<T>::type : retrieve base class of type T registered into QxOrm context and return qx::trait::no_base_class_defined if no base class defined
*/
template <class T>
class get_base_class
{
public:
typedef qx::trait::no_base_class_defined type;
};
template <class T>
class is_base_class_defined
{
public:
enum
{
value = (std::is_same<typename qx::trait::get_base_class<T>::type, qx::trait::no_base_class_defined>::value ? 0 : 1)
};
};
template <class T>
class get_base_class_2
{
private:
typedef typename qx::trait::get_base_class<T>::type type_base;
private:
enum
{
is_base_ok = (std::is_same<type_base, qx::trait::no_base_class_defined>::value ? 0 : 1)
};
public:
typedef typename std::conditional<is_base_ok, type_base, T>::type type;
};
} // namespace trait
} // namespace qx
QX_REGISTER_CLASS_NAME(qx::trait::no_base_class_defined)
#define QX_REGISTER_BASE_CLASS(derivedClass, baseClass) \
namespace qx \
{ \
namespace trait \
{ \
template <> \
class get_base_class<derivedClass> \
{ \
public: \
typedef baseClass type; \
}; \
} \
} // namespace qx::trait
#define QX_GET_BASE_CLASS(T) qx::trait::get_base_class<T>::type
#define QX_GET_BASE_CLASS_WITH_TYPENAME(T) qx::trait::get_base_class<typename T>::type
#define QX_IS_BASE_CLASS_DEFINED(T) qx::trait::is_base_class_defined<T>::value
#define QX_IS_BASE_CLASS_DEFINED_WITH_TYPENAME(T) qx::trait::is_base_class_defined<typename T>::value
#define QX_GET_BASE_CLASS_2(T) qx::trait::get_base_class_2<T>::type
#define QX_GET_BASE_CLASS_2_WITH_TYPENAME(T) qx::trait::get_base_class_2<typename T>::type
#endif // _QX_GET_BASE_CLASS_H_

View File

@@ -0,0 +1,378 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_GET_CLASS_NAME_H_
#define _QX_GET_CLASS_NAME_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file get_class_name.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::get_class_name<T>::get() : return class name of type T under const char * format, T must be registered with QX_REGISTER_CLASS_NAME(T) macro
*/
#ifndef _QX_NO_RTTI
#include <typeinfo>
#endif // _QX_NO_RTTI
#include <QxTraits/remove_attr.h>
#define QX_REGISTER_CLASS_NAME_SEP_INF "<"
#define QX_REGISTER_CLASS_NAME_SEP_SUP ">"
#define QX_REGISTER_CLASS_NAME_SEP_NXT ", "
#define QX_REGISTER_CLASS_NAME_SEP_INF_XML_TAG "-"
#define QX_REGISTER_CLASS_NAME_SEP_SUP_XML_TAG "-"
#define QX_REGISTER_CLASS_NAME_SEP_NXT_XML_TAG "_"
#define QX_GET_CLASS_NAME(TYPE) \
qx::trait::get_class_name<qx::trait::remove_attr<TYPE>::type>::get()
#define QX_GET_CLASS_NAME_STD_STR(TYPE) \
std::string(qx::trait::get_class_name<qx::trait::remove_attr<TYPE>::type>::get())
#define QX_GET_CLASS_NAME_XML_TAG(TYPE) \
qx::trait::get_class_name<qx::trait::remove_attr<TYPE>::type>::get_xml_tag()
#define QX_GET_CLASS_NAME_XML_TAG_STD_STR(TYPE) \
std::string(qx::trait::get_class_name<qx::trait::remove_attr<TYPE>::type>::get_xml_tag())
#define QX_GET_CLASS_NAME_WITH_TYPENAME(TYPE) \
qx::trait::get_class_name<typename qx::trait::remove_attr<TYPE>::type>::get()
#define QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(TYPE) \
std::string(qx::trait::get_class_name<typename qx::trait::remove_attr<TYPE>::type>::get())
#define QX_GET_CLASS_NAME_XML_TAG_WITH_TYPENAME(TYPE) \
qx::trait::get_class_name<typename qx::trait::remove_attr<TYPE>::type>::get_xml_tag()
#define QX_GET_CLASS_NAME_XML_TAG_STD_STR_WITH_TYPENAME(TYPE) \
std::string(qx::trait::get_class_name<typename qx::trait::remove_attr<TYPE>::type>::get_xml_tag())
#define QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG() \
static inline const char *get_xml_tag() \
{ \
static std::string result_xml; \
if (!result_xml.empty()) \
{ \
return result_xml.c_str(); \
} \
QString tmp = get_class_name::get(); \
tmp.replace(QX_REGISTER_CLASS_NAME_SEP_INF, QX_REGISTER_CLASS_NAME_SEP_INF_XML_TAG); \
tmp.replace(QX_REGISTER_CLASS_NAME_SEP_SUP, QX_REGISTER_CLASS_NAME_SEP_SUP_XML_TAG); \
tmp.replace(QX_REGISTER_CLASS_NAME_SEP_NXT, QX_REGISTER_CLASS_NAME_SEP_NXT_XML_TAG); \
tmp.replace("::", "."); \
tmp.replace(" ", ""); \
result_xml = tmp.toLatin1().constData(); \
return result_xml.c_str(); \
}
#ifdef _QX_NO_RTTI
#define QX_REGISTER_CLASS_NAME_NO_RTTI(className) std::string(#className)
#endif // _QX_NO_RTTI
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::get_class_name<T>::get() : return class name of type T under const char * format, T must be registered with QX_REGISTER_CLASS_NAME(T) macro
*/
template <typename T>
struct get_class_name
{
static inline const char *get()
{
static std::string result;
if (!result.empty())
{
return result.c_str();
}
#ifndef _QX_NO_RTTI
T *dummy = NULL;
Q_UNUSED(dummy);
result = std::string(typeid(dummy).name());
#else // _QX_NO_RTTI
result = QX_REGISTER_CLASS_NAME_NO_RTTI(T);
#endif // _QX_NO_RTTI
qDebug("[QxOrm] Unable to define correct class name : '%s' => use macro 'QX_REGISTER_CLASS_NAME()' or 'QX_REGISTER_CLASS_NAME_TEMPLATE_X()'", result.c_str());
return result.c_str();
}
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG();
};
} // namespace trait
} // namespace qx
#define QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className) \
static std::string result; \
if (!result.empty()) \
{ \
return result.c_str(); \
} \
result = std::string(#className);
#define QX_REGISTER_CLASS_NAME(className) \
namespace qx \
{ \
namespace trait \
{ \
template <> \
struct get_class_name<className> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_1(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T> \
struct get_class_name<className<T>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_2(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2> \
struct get_class_name<className<T1, T2>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_3(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2, typename T3> \
struct get_class_name<className<T1, T2, T3>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T3) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_4(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2, typename T3, typename T4> \
struct get_class_name<className<T1, T2, T3, T4>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T3) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T4) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_5(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2, typename T3, typename T4, typename T5> \
struct get_class_name<className<T1, T2, T3, T4, T5>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T3) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T4) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T5) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_6(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> \
struct get_class_name<className<T1, T2, T3, T4, T5, T6>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T3) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T4) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T5) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T6) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_7(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
struct get_class_name<className<T1, T2, T3, T4, T5, T6, T7>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T3) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T4) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T5) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T6) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T7) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_8(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
struct get_class_name<className<T1, T2, T3, T4, T5, T6, T7, T8>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T3) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T4) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T5) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T6) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T7) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T8) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#define QX_REGISTER_CLASS_NAME_TEMPLATE_9(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> \
struct get_class_name<className<T1, T2, T3, T4, T5, T6, T7, T8, T9>> \
{ \
static inline const char *get() \
{ \
QX_REGISTER_CLASS_NAME_TEMPLATE_INIT(className); \
result += QX_REGISTER_CLASS_NAME_SEP_INF + QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T1) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T2) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T3) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T4) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T5) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T6) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T7) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T8) + QX_REGISTER_CLASS_NAME_SEP_NXT; \
result += QX_GET_CLASS_NAME_STD_STR_WITH_TYPENAME(T9) + QX_REGISTER_CLASS_NAME_SEP_SUP; \
return result.c_str(); \
} \
QX_GET_CLASS_NAME_IMPLEMENT_FCT_GET_XML_TAG(); \
}; \
} \
} // namespace qx::trait
#endif // _QX_GET_CLASS_NAME_H_

View File

@@ -0,0 +1,237 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_GET_CLASS_NAME_PRIMITIVE_H_
#define _QX_GET_CLASS_NAME_PRIMITIVE_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file get_class_name_primitive.h
* \author XDL Team
* \ingroup QxTraits
* \brief Register all primitive and useful types of stl, boost and Qt libraries using QX_REGISTER_CLASS_NAME(T) macro
*/
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <QtCore/qglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qvector.h>
#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
#include <QtCore/qhash.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qvariant.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qpair.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qsize.h>
#include <QtCore/qurl.h>
#include <QtCore/quuid.h>
#include <QtCore/QWeakPointer>
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
#include <QtCore/qlinkedlist.h>
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QtCore/qregexp.h>
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QtSql/qsqlerror.h>
#ifdef _QX_ENABLE_QT_GUI
#include <QtGui/qcolor.h>
#include <QtGui/qfont.h>
#include <QtGui/qimage.h>
#include <QtGui/qbrush.h>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QtGui/qmatrix.h>
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QtGui/qpicture.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qregion.h>
#endif // _QX_ENABLE_QT_GUI
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QtCore/qscopedpointer.h>
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QxDao/QxDaoPointer.h>
#include <QxTraits/get_class_name.h>
QX_REGISTER_CLASS_NAME(void)
QX_REGISTER_CLASS_NAME(bool)
QX_REGISTER_CLASS_NAME(int)
QX_REGISTER_CLASS_NAME(short)
QX_REGISTER_CLASS_NAME(long)
QX_REGISTER_CLASS_NAME(float)
QX_REGISTER_CLASS_NAME(double)
QX_REGISTER_CLASS_NAME(long double)
QX_REGISTER_CLASS_NAME(char)
QX_REGISTER_CLASS_NAME(unsigned int)
QX_REGISTER_CLASS_NAME(unsigned short)
QX_REGISTER_CLASS_NAME(unsigned long)
QX_REGISTER_CLASS_NAME(unsigned char)
QX_REGISTER_CLASS_NAME(std::string)
QX_REGISTER_CLASS_NAME(std::wstring)
QX_REGISTER_CLASS_NAME(QObject)
QX_REGISTER_CLASS_NAME(QString)
QX_REGISTER_CLASS_NAME(QStringList)
QX_REGISTER_CLASS_NAME(QByteArray)
QX_REGISTER_CLASS_NAME(QDate)
QX_REGISTER_CLASS_NAME(QDateTime)
QX_REGISTER_CLASS_NAME(QPoint)
QX_REGISTER_CLASS_NAME(QRect)
QX_REGISTER_CLASS_NAME(QSize)
QX_REGISTER_CLASS_NAME(QTime)
QX_REGISTER_CLASS_NAME(QUrl)
QX_REGISTER_CLASS_NAME(QVariant)
QX_REGISTER_CLASS_NAME(QUuid)
QX_REGISTER_CLASS_NAME(QSqlError)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_REGISTER_CLASS_NAME(QRegExp)
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#ifdef _QX_ENABLE_QT_GUI
QX_REGISTER_CLASS_NAME(QColor)
QX_REGISTER_CLASS_NAME(QFont)
QX_REGISTER_CLASS_NAME(QImage)
QX_REGISTER_CLASS_NAME(QBrush)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_REGISTER_CLASS_NAME(QMatrix)
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_REGISTER_CLASS_NAME(QPicture)
QX_REGISTER_CLASS_NAME(QPixmap)
QX_REGISTER_CLASS_NAME(QRegion)
#endif // _QX_ENABLE_QT_GUI
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::allocator)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::vector)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::list)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::set)
#ifdef _QX_ENABLE_BOOST
QX_REGISTER_CLASS_NAME_TEMPLATE_1(boost::shared_ptr)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(boost::scoped_ptr)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(boost::weak_ptr)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(boost::optional)
#endif // _QX_ENABLE_BOOST
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QList)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QSharedPointer)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QWeakPointer)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QFlags)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QSet)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QVector)
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QLinkedList)
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
QX_REGISTER_CLASS_NAME_TEMPLATE_1(qx::dao::ptr)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::unique_ptr)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::shared_ptr)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::weak_ptr)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(std::pair)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(std::map)
#ifdef _QX_ENABLE_BOOST
QX_REGISTER_CLASS_NAME_TEMPLATE_2(boost::unordered_map)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(boost::unordered_multimap)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(boost::unordered_set)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(boost::unordered_multiset)
#endif // _QX_ENABLE_BOOST
QX_REGISTER_CLASS_NAME_TEMPLATE_2(std::unordered_map)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(std::unordered_multimap)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::unordered_set)
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::unordered_multiset)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_REGISTER_CLASS_NAME_TEMPLATE_2(QPair)
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_REGISTER_CLASS_NAME_TEMPLATE_2(QHash)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(QMultiHash)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(QMap)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(QMultiMap)
#ifdef _QX_ENABLE_BOOST
QX_REGISTER_CLASS_NAME_TEMPLATE_1(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_3(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_4(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_5(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_6(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_7(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_8(boost::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_9(boost::tuple)
#endif // _QX_ENABLE_BOOST
QX_REGISTER_CLASS_NAME_TEMPLATE_1(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_2(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_3(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_4(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_5(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_6(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_7(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_8(std::tuple)
QX_REGISTER_CLASS_NAME_TEMPLATE_9(std::tuple)
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
QX_REGISTER_CLASS_NAME_TEMPLATE_1(QScopedPointer)
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#endif // _QX_GET_CLASS_NAME_PRIMITIVE_H_

View File

@@ -0,0 +1,79 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_GET_PRIMARY_KEY_H_
#define _QX_GET_PRIMARY_KEY_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file get_primary_key.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::get_primary_key<T>::type : return primary key type of T, by default primary key is long type, use QX_REGISTER_PRIMARY_KEY() macro to register another type (for example QX_REGISTER_PRIMARY_KEY(T, QString))
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::get_primary_key<T>::type : return primary key type of T, by default primary key is long type, use QX_REGISTER_PRIMARY_KEY() macro to register another type (for example QX_REGISTER_PRIMARY_KEY(T, QString))
*/
template <class T>
class get_primary_key
{
public:
typedef long type;
};
} // namespace trait
} // namespace qx
#define QX_REGISTER_PRIMARY_KEY(daoClass, primaryKey) \
namespace qx \
{ \
namespace trait \
{ \
template <> \
class get_primary_key<daoClass> \
{ \
public: \
typedef primaryKey type; \
}; \
} \
} // namespace qx::trait
#endif // _QX_GET_PRIMARY_KEY_H_

View File

@@ -0,0 +1,416 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_GET_SQL_TYPE_H_
#define _QX_GET_SQL_TYPE_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file get_sql_type.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::get_sql_type<T>::get() : return type name under const char * format used by database engine to map a C++ type T
*/
#include <QtCore/qsharedpointer.h>
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QtCore/qscopedpointer.h>
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QxTraits/is_qx_registered.h>
#include <QxTraits/get_primary_key.h>
#include <QxTraits/remove_attr.h>
#include <QxTraits/get_class_name_primitive.h>
#include <QxDao/QxDaoPointer.h>
#include <QxDao/QxDateNeutral.h>
#include <QxDao/QxTimeNeutral.h>
#include <QxDao/QxDateTimeNeutral.h>
#include <QxCommon/QxBool.h>
namespace qx
{
namespace trait
{
namespace detail
{
template <typename T>
struct get_sql_type_helper
{
private:
typedef typename qx::trait::remove_attr<T>::type type_1;
typedef typename std::conditional<qx::trait::is_qx_registered<type_1>::value, typename qx::trait::get_primary_key<type_1>::type, type_1>::type type_2;
typedef typename std::conditional<std::is_enum<type_2>::value, long, type_2>::type type_3;
public:
typedef typename qx::trait::detail::get_sql_type_helper<T>::type_3 type;
};
template <typename T>
struct get_sql_type
{
static inline const char *get() { return ""; }
};
/* Implemented into './src/QxRegister/QxClassX.cpp' file */
QX_DLL_EXPORT const char *get_sql_type_by_class_name(const char *sClassName, const char *sDefaultValue);
} // namespace detail
/*!
* \ingroup QxTraits
* \brief qx::trait::get_sql_type<T>::get() : return type name under const char * format used by database engine to map a C++ type T
*/
template <typename T>
struct get_sql_type
{
typedef typename qx::trait::detail::get_sql_type_helper<T>::type type_sql;
static inline const char *get() { return (std::is_same<T, type_sql>::value ? qx::trait::detail::get_sql_type<type_sql>::get() : qx::trait::get_sql_type<type_sql>::get()); }
};
#ifdef _QX_ENABLE_BOOST
template <typename T>
struct get_sql_type<boost::optional<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
template <typename T>
struct get_sql_type<boost::scoped_ptr<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
template <typename T>
struct get_sql_type<boost::shared_ptr<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
template <typename T>
struct get_sql_type<boost::intrusive_ptr<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
#endif // _QX_ENABLE_BOOST
template <typename T>
struct get_sql_type<QSharedPointer<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct get_sql_type<QScopedPointer<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct get_sql_type<std::unique_ptr<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
template <typename T>
struct get_sql_type<std::shared_ptr<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
template <typename T>
struct get_sql_type<qx::dao::ptr<T>>
{
static inline const char *get() { return qx::trait::get_sql_type<T>::get(); }
};
template <typename T1, typename T2>
struct get_sql_type<std::pair<T1, T2>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()));
return s.c_str();
}
};
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename T1, typename T2>
struct get_sql_type<QPair<T1, T2>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()));
return s.c_str();
}
};
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#ifdef _QX_ENABLE_BOOST
template <typename T1, typename T2>
struct get_sql_type<boost::tuple<T1, T2>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3>
struct get_sql_type<boost::tuple<T1, T2, T3>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4>
struct get_sql_type<boost::tuple<T1, T2, T3, T4>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5>
struct get_sql_type<boost::tuple<T1, T2, T3, T4, T5>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct get_sql_type<boost::tuple<T1, T2, T3, T4, T5, T6>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
struct get_sql_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()) + "|" + std::string(qx::trait::get_sql_type<T7>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
struct get_sql_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()) + "|" + std::string(qx::trait::get_sql_type<T7>::get()) + "|" + std::string(qx::trait::get_sql_type<T8>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
struct get_sql_type<boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()) + "|" + std::string(qx::trait::get_sql_type<T7>::get()) + "|" + std::string(qx::trait::get_sql_type<T8>::get()) + "|" + std::string(qx::trait::get_sql_type<T9>::get()));
return s.c_str();
}
};
#endif // _QX_ENABLE_BOOST
template <typename T1, typename T2>
struct get_sql_type<std::tuple<T1, T2>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3>
struct get_sql_type<std::tuple<T1, T2, T3>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4>
struct get_sql_type<std::tuple<T1, T2, T3, T4>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5>
struct get_sql_type<std::tuple<T1, T2, T3, T4, T5>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct get_sql_type<std::tuple<T1, T2, T3, T4, T5, T6>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
struct get_sql_type<std::tuple<T1, T2, T3, T4, T5, T6, T7>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()) + "|" + std::string(qx::trait::get_sql_type<T7>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
struct get_sql_type<std::tuple<T1, T2, T3, T4, T5, T6, T7, T8>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()) + "|" + std::string(qx::trait::get_sql_type<T7>::get()) + "|" + std::string(qx::trait::get_sql_type<T8>::get()));
return s.c_str();
}
};
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
struct get_sql_type<std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>>
{
static inline const char *get()
{
static std::string s;
s = (std::string(qx::trait::get_sql_type<T1>::get()) + "|" + std::string(qx::trait::get_sql_type<T2>::get()) + "|" + std::string(qx::trait::get_sql_type<T3>::get()) + "|" + std::string(qx::trait::get_sql_type<T4>::get()) + "|" + std::string(qx::trait::get_sql_type<T5>::get()) + "|" + std::string(qx::trait::get_sql_type<T6>::get()) + "|" + std::string(qx::trait::get_sql_type<T7>::get()) + "|" + std::string(qx::trait::get_sql_type<T8>::get()) + "|" + std::string(qx::trait::get_sql_type<T9>::get()));
return s.c_str();
}
};
} // namespace trait
} // namespace qx
#define QX_REGISTER_TRAIT_GET_SQL_TYPE(className, sqlType) \
namespace qx \
{ \
namespace trait \
{ \
namespace detail \
{ \
template <> \
struct get_sql_type<className> \
{ \
static inline const char *get() { return get_sql_type_by_class_name(#className, sqlType); } \
}; \
} \
} \
}
QX_REGISTER_TRAIT_GET_SQL_TYPE(bool, "SMALLINT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(qx_bool, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(char, "SMALLINT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(short, "SMALLINT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(int, "INTEGER")
QX_REGISTER_TRAIT_GET_SQL_TYPE(long, "INTEGER")
QX_REGISTER_TRAIT_GET_SQL_TYPE(long long, "INTEGER")
QX_REGISTER_TRAIT_GET_SQL_TYPE(float, "FLOAT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(double, "FLOAT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(long double, "FLOAT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(unsigned short, "SMALLINT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(unsigned int, "INTEGER")
QX_REGISTER_TRAIT_GET_SQL_TYPE(unsigned long, "INTEGER")
QX_REGISTER_TRAIT_GET_SQL_TYPE(unsigned long long, "INTEGER")
QX_REGISTER_TRAIT_GET_SQL_TYPE(std::string, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(std::wstring, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(QString, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(QVariant, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(QUuid, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(QDate, "DATE")
QX_REGISTER_TRAIT_GET_SQL_TYPE(QTime, "TIME")
QX_REGISTER_TRAIT_GET_SQL_TYPE(QDateTime, "TIMESTAMP")
QX_REGISTER_TRAIT_GET_SQL_TYPE(QByteArray, "BLOB")
QX_REGISTER_TRAIT_GET_SQL_TYPE(qx::QxDateNeutral, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(qx::QxTimeNeutral, "TEXT")
QX_REGISTER_TRAIT_GET_SQL_TYPE(qx::QxDateTimeNeutral, "TEXT")
#endif // _QX_GET_SQL_TYPE_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifdef _QX_ENABLE_BOOST
#ifndef _QX_IS_BOOST_INTRUSIVE_PTR_H_
#define _QX_IS_BOOST_INTRUSIVE_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_boost_intrusive_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_boost_intrusive_ptr<T>::value : return true if T is a boost::intrusive_ptr<> smart-pointer, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_boost_intrusive_ptr<T>::value : return true if T is a boost::intrusive_ptr<> smart-pointer, otherwise return false
*/
template <typename T>
struct is_boost_intrusive_ptr : public std::false_type
{
;
};
template <typename T>
struct is_boost_intrusive_ptr<boost::intrusive_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_intrusive_ptr<boost::intrusive_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_boost_intrusive_ptr<const boost::intrusive_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_intrusive_ptr<const boost::intrusive_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_BOOST_INTRUSIVE_PTR_H_
#endif // _QX_ENABLE_BOOST

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifdef _QX_ENABLE_BOOST
#ifndef _QX_IS_BOOST_SCOPED_PTR_H_
#define _QX_IS_BOOST_SCOPED_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_boost_scoped_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_boost_scoped_ptr<T>::value : return true if T is a boost::scoped_ptr<> smart-pointer, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_boost_scoped_ptr<T>::value : return true if T is a boost::scoped_ptr<> smart-pointer, otherwise return false
*/
template <typename T>
struct is_boost_scoped_ptr : public std::false_type
{
;
};
template <typename T>
struct is_boost_scoped_ptr<boost::scoped_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_scoped_ptr<boost::scoped_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_boost_scoped_ptr<const boost::scoped_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_scoped_ptr<const boost::scoped_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_BOOST_SCOPED_PTR_H_
#endif // _QX_ENABLE_BOOST

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifdef _QX_ENABLE_BOOST
#ifndef _QX_IS_BOOST_SHARED_PTR_H_
#define _QX_IS_BOOST_SHARED_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_boost_shared_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_boost_shared_ptr<T>::value : return true if T is a boost::shared_ptr<> smart-pointer, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_boost_shared_ptr<T>::value : return true if T is a boost::shared_ptr<> smart-pointer, otherwise return false
*/
template <typename T>
struct is_boost_shared_ptr : public std::false_type
{
;
};
template <typename T>
struct is_boost_shared_ptr<boost::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_shared_ptr<boost::shared_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_boost_shared_ptr<const boost::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_shared_ptr<const boost::shared_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_BOOST_SHARED_PTR_H_
#endif // _QX_ENABLE_BOOST

View File

@@ -0,0 +1,114 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifdef _QX_ENABLE_BOOST
#ifndef _QX_IS_BOOST_UNORDERED_MAP_H_
#define _QX_IS_BOOST_UNORDERED_MAP_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_boost_unordered_map.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_boost_unordered_map<T>::value : return true if T is a boost::unordered_map<> or boost::unordered_multimap<> container, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_boost_unordered_map<T>::value : return true if T is a boost::unordered_map<> or boost::unordered_multimap<> container, otherwise return false
*/
template <typename T>
struct is_boost_unordered_map : public std::false_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<boost::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<boost::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<const boost::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<const boost::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<boost::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<boost::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<const boost::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_boost_unordered_map<const boost::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_BOOST_UNORDERED_MAP_H_
#endif // _QX_ENABLE_BOOST

View File

@@ -0,0 +1,114 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifdef _QX_ENABLE_BOOST
#ifndef _QX_IS_BOOST_UNORDERED_SET_H_
#define _QX_IS_BOOST_UNORDERED_SET_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_boost_unordered_set.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_boost_unordered_set<T>::value : return true if T is a boost::unordered_set<> or boost::unordered_multiset<> container, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_boost_unordered_set<T>::value : return true if T is a boost::unordered_set<> or boost::unordered_multiset<> container, otherwise return false
*/
template <typename T>
struct is_boost_unordered_set : public std::false_type
{
;
};
template <typename T>
struct is_boost_unordered_set<boost::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_unordered_set<boost::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_boost_unordered_set<const boost::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_unordered_set<const boost::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_boost_unordered_set<boost::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_unordered_set<boost::unordered_multiset<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_boost_unordered_set<const boost::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_unordered_set<const boost::unordered_multiset<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_BOOST_UNORDERED_SET_H_
#endif // _QX_ENABLE_BOOST

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifdef _QX_ENABLE_BOOST
#ifndef _QX_IS_BOOST_WEAK_PTR_H_
#define _QX_IS_BOOST_WEAK_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_boost_weak_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_boost_weak_ptr<T>::value : return true if T is a boost::weak_ptr<> smart-pointer, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_boost_weak_ptr<T>::value : return true if T is a boost::weak_ptr<> smart-pointer, otherwise return false
*/
template <typename T>
struct is_boost_weak_ptr : public std::false_type
{
;
};
template <typename T>
struct is_boost_weak_ptr<boost::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_weak_ptr<boost::weak_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_boost_weak_ptr<const boost::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_boost_weak_ptr<const boost::weak_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_BOOST_WEAK_PTR_H_
#endif // _QX_ENABLE_BOOST

View File

@@ -0,0 +1,596 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_CONTAINER_H_
#define _QX_IS_CONTAINER_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_container.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_container<T>::value : return true if T is a container from stl, boost, Qt or QxOrm library, otherwise return false
*/
#include <QxTraits/is_boost_unordered_map.h>
#include <QxTraits/is_boost_unordered_set.h>
#include <QxTraits/is_qt_hash.h>
#include <QxTraits/is_qt_linked_list.h>
#include <QxTraits/is_qt_list.h>
#include <QxTraits/is_qt_map.h>
#include <QxTraits/is_qt_multi_hash.h>
#include <QxTraits/is_qt_multi_map.h>
#include <QxTraits/is_qt_set.h>
#include <QxTraits/is_qt_vector.h>
#include <QxTraits/is_qx_collection.h>
#include <QxTraits/is_std_list.h>
#include <QxTraits/is_std_map.h>
#include <QxTraits/is_std_set.h>
#include <QxTraits/is_std_vector.h>
#include <QxTraits/is_std_unordered_map.h>
#include <QxTraits/is_std_unordered_set.h>
#include <QxCollection/QxCollection.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_container<T>::value : return true if T is a container from stl, boost, Qt or QxOrm library, otherwise return false
*/
template <typename T>
struct is_container : public std::false_type
{
;
};
#ifdef _QX_ENABLE_BOOST
template <typename Key, typename Value>
struct is_container<boost::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<boost::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const boost::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const boost::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<boost::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<boost::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const boost::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const boost::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<boost::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<boost::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const boost::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const boost::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<boost::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<boost::unordered_multiset<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const boost::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const boost::unordered_multiset<T> &> : public std::true_type
{
;
};
#endif // _QX_ENABLE_BOOST
template <typename Key, typename Value>
struct is_container<QHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<QHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QHash<Key, Value> &> : public std::true_type
{
;
};
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
template <typename T>
struct is_container<QLinkedList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<QLinkedList<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QLinkedList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QLinkedList<T> &> : public std::true_type
{
;
};
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
template <typename T>
struct is_container<QList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<QList<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QList<T> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<QMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<QMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<QMultiHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<QMultiHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QMultiHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QMultiHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<QMultiMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<QMultiMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QMultiMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const QMultiMap<Key, Value> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<QSet<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<QSet<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QSet<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QSet<T> &> : public std::true_type
{
;
};
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename T>
struct is_container<QVector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<QVector<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QVector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const QVector<T> &> : public std::true_type
{
;
};
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename Key, typename Value>
struct is_container<qx::QxCollection<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<qx::QxCollection<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const qx::QxCollection<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const qx::QxCollection<Key, Value> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::list<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::list<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::list<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::list<T> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<std::map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<std::map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const std::map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const std::map<Key, Value> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::vector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::vector<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::vector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::vector<T> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<std::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<std::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const std::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const std::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<std::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<std::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const std::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container<const std::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<std::unordered_multiset<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_container<const std::unordered_multiset<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_CONTAINER_H_

View File

@@ -0,0 +1,166 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_CONTAINER_BASE_OF_H_
#define _QX_IS_CONTAINER_BASE_OF_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <QxTraits/is_container.h>
#define qx_container_base_of_test_0() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer(b, d)) == sizeof(char))
#define qx_container_base_of_test_1() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_std_vector), d)) == sizeof(char))
#define qx_container_base_of_test_2() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_std_list), d)) == sizeof(char))
#define qx_container_base_of_test_3() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_std_set), d)) == sizeof(char))
#define qx_container_base_of_test_4() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_qt_vector), d)) == sizeof(char))
#define qx_container_base_of_test_5() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_qt_list), d)) == sizeof(char))
#define qx_container_base_of_test_6() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_qt_set), d)) == sizeof(char))
#define qx_container_base_of_test_7() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_qt_linked_list), d)) == sizeof(char))
#define qx_container_base_of_test_8() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_boost_unordered_set), d)) == sizeof(char))
#define qx_container_base_of_test_9() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_boost_unordered_multi_set), d)) == sizeof(char))
#define qx_container_base_of_test_10() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_std_unordered_set), d)) == sizeof(char))
#define qx_container_base_of_test_11() (sizeof(qx::trait::is_container_base_of<B, D>::removeContainer((*b_std_unordered_multi_set), d)) == sizeof(char))
#define qx_container_base_of_all_test() \
qx_container_base_of_test_1() || qx_container_base_of_test_2() || qx_container_base_of_test_3() || \
qx_container_base_of_test_4() || qx_container_base_of_test_5() || qx_container_base_of_test_6() || \
qx_container_base_of_test_7() || qx_container_base_of_test_8() || qx_container_base_of_test_9() || \
qx_container_base_of_test_10() || qx_container_base_of_test_11()
namespace qx
{
namespace trait
{
template <typename B, typename D>
class is_container_base_of
{
private:
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const std::vector<V> &, const std::vector<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const std::list<V> &, const std::list<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const std::set<V> &, const std::set<W> &);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const QVector<V> &, const QVector<W> &);
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const QList<V> &, const QList<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const QSet<V> &, const QSet<W> &);
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const QLinkedList<V> &, const QLinkedList<W> &);
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
#ifdef _QX_ENABLE_BOOST
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const boost::unordered_set<V> &, const boost::unordered_set<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const boost::unordered_multiset<V> &, const boost::unordered_multiset<W> &);
#endif // _QX_ENABLE_BOOST
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const std::unordered_set<V> &, const std::unordered_set<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeContainer(const std::unordered_multiset<V> &, const std::unordered_multiset<W> &);
static int removeContainer(...);
static B b;
static D d;
static std::vector<B> *b_std_vector;
static std::list<B> *b_std_list;
static std::set<B> *b_std_set;
static QVector<B> *b_qt_vector;
static QList<B> *b_qt_list;
static QSet<B> *b_qt_set;
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
static QLinkedList<B> *b_qt_linked_list;
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
#ifdef _QX_ENABLE_BOOST
static boost::unordered_set<B> *b_boost_unordered_set;
static boost::unordered_multiset<B> *b_boost_unordered_multi_set;
#endif // _QX_ENABLE_BOOST
static std::unordered_set<B> *b_std_unordered_set;
static std::unordered_multiset<B> *b_std_unordered_multi_set;
enum
{
value_0 = (qx::trait::is_container<D>::value)
};
enum
{
value_1 = (qx::trait::is_container<B>::value)
};
enum
{
value_2 = ((value_0 && value_1) ? qx_container_base_of_test_0() : 0)
};
enum
{
value_3 = ((value_0 && !value_1) ? qx_container_base_of_all_test() : 0)
};
public:
enum
{
value = (qx::trait::is_container_base_of<B, D>::value_2 || qx::trait::is_container_base_of<B, D>::value_3)
};
typedef typename std::conditional<qx::trait::is_container_base_of<B, D>::value, std::true_type, std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_CONTAINER_BASE_OF_H_

View File

@@ -0,0 +1,310 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_CONTAINER_KEY_VALUE_H_
#define _QX_IS_CONTAINER_KEY_VALUE_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_container_key_value.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_container_key_value<T>::value : return true if T is a map or hash-map (with <Key, Value> template format) container from stl, boost, Qt or QxOrm library, otherwise return false
*/
#include <QxTraits/is_container.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_container_key_value<T>::value : return true if T is a map or hash-map (with <Key, Value> template format) container from stl, boost, Qt or QxOrm library, otherwise return false
*/
template <typename T>
struct is_container_key_value : public std::false_type
{
;
};
#ifdef _QX_ENABLE_BOOST
template <typename Key, typename Value>
struct is_container_key_value<boost::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<boost::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const boost::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const boost::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<boost::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<boost::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const boost::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const boost::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
#endif // _QX_ENABLE_BOOST
template <typename Key, typename Value>
struct is_container_key_value<QHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<QHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<QMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<QMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<QMultiHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<QMultiHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QMultiHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QMultiHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<QMultiMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<QMultiMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QMultiMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const QMultiMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<qx::QxCollection<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<qx::QxCollection<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const qx::QxCollection<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const qx::QxCollection<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<std::map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<std::map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const std::map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const std::map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<std::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<std::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const std::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const std::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<std::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<std::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const std::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_container_key_value<const std::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_CONTAINER_KEY_VALUE_H_

View File

@@ -0,0 +1,108 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_CONTAINER_TO_POD_H_
#define _QX_IS_CONTAINER_TO_POD_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <QxTraits/is_container.h>
#include <QxTraits/is_qx_pod.h>
namespace qx
{
namespace trait
{
template <typename T>
class is_container_to_pod
{
private:
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const std::vector<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const std::list<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const std::set<U> &);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const QVector<U> &);
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const QList<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const QSet<U> &);
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const QLinkedList<U> &);
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
#ifdef _QX_ENABLE_BOOST
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const boost::unordered_set<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const boost::unordered_multiset<U> &);
#endif // _QX_ENABLE_BOOST
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const std::unordered_set<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeContainer(const std::unordered_multiset<U> &);
static int removeContainer(...);
static T t;
public:
enum
{
value = (qx::trait::is_container<T>::value && (sizeof(qx::trait::is_container_to_pod<T>::removeContainer(t)) == sizeof(char)))
};
typedef typename std::conditional<qx::trait::is_container_to_pod<T>::value, std::true_type, std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_CONTAINER_TO_POD_H_

181
include/QxTraits/is_equal.h Normal file
View File

@@ -0,0 +1,181 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_TRAIT_IS_EQUAL_H_
#define _QX_TRAIT_IS_EQUAL_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_equal.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::has_operator_equal_equal<T>::value : return true if T provides operator==() function, T must be registered with QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(T) macro
*/
#include <QtCore/qstring.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qvariant.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
#include <QtCore/qsize.h>
#include <QtCore/qurl.h>
#include <QtCore/quuid.h>
#include <QtCore/qsharedpointer.h>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QtCore/qregexp.h>
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#ifdef _QX_ENABLE_QT_GUI
#include <QtGui/qcolor.h>
#include <QtGui/qfont.h>
#include <QtGui/qimage.h>
#include <QtGui/qbrush.h>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QtGui/qmatrix.h>
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QtGui/qregion.h>
#endif // _QX_ENABLE_QT_GUI
#include <QxDao/QxDaoPointer.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::has_operator_equal_equal<T>::value : return true if T provides operator==() function, T must be registered with QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(T) macro
*/
template <typename T>
struct has_operator_equal_equal
{
enum
{
value = std::is_pointer<T>::value
};
};
} // namespace trait
} // namespace qx
#define QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(className) \
namespace qx \
{ \
namespace trait \
{ \
template <> \
struct has_operator_equal_equal<className> \
{ \
enum \
{ \
value = true \
}; \
}; \
} \
} // namespace qx::trait
#define QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL_TEMPLATE_1(className) \
namespace qx \
{ \
namespace trait \
{ \
template <typename T> \
struct has_operator_equal_equal<className<T>> \
{ \
enum \
{ \
value = true \
}; \
}; \
} \
} // namespace qx::trait
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(bool)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(int)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(short)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(long)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(float)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(double)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(long double)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(char)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(unsigned int)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(unsigned short)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(unsigned long)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(unsigned char)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(std::string)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(std::wstring)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QString)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QByteArray)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QDate)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QDateTime)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QPoint)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QRect)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QSize)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QTime)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QUrl)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QVariant)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QUuid)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QRegExp)
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#ifdef _QX_ENABLE_QT_GUI
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QColor)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QFont)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QImage)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QBrush)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QMatrix)
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL(QRegion)
#endif // _QX_ENABLE_QT_GUI
#ifdef _QX_ENABLE_BOOST
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL_TEMPLATE_1(boost::shared_ptr)
#endif // _QX_ENABLE_BOOST
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL_TEMPLATE_1(QSharedPointer)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL_TEMPLATE_1(QWeakPointer)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL_TEMPLATE_1(qx::dao::ptr)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL_TEMPLATE_1(std::shared_ptr)
QX_TYPE_HAS_OPERATOR_EQUAL_EQUAL_TEMPLATE_1(std::weak_ptr)
#endif // _QX_TRAIT_IS_EQUAL_H_

View File

@@ -0,0 +1,79 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_PTR_BASE_OF_H_
#define _QX_IS_PTR_BASE_OF_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_ptr_base_of.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_ptr_base_of<B, D>::value : return true if B and D are pointer type and (*B) is a base class of (*D) or if B and D are same type, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_ptr_base_of<B, D>::value : return true if B and D are pointer type and (*B) is a base class of (*D) or if B and D are same type, otherwise return false
*/
template <typename B, typename D>
class is_ptr_base_of
{
private:
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removePtr(const volatile V *const volatile, const volatile W *const volatile);
static int removePtr(...);
static B b;
static D d;
public:
enum
{
value = (std::is_pointer<B>::value && std::is_pointer<D>::value && (sizeof(qx::trait::is_ptr_base_of<B, D>::removePtr(b, d)) == sizeof(char)))
};
typedef typename std::conditional<qx::trait::is_ptr_base_of<B, D>::value, std::true_type, std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_PTR_BASE_OF_H_

View File

@@ -0,0 +1,80 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_PTR_TO_POD_H_
#define _QX_IS_PTR_TO_POD_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_ptr_to_pod.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_ptr_to_pod<T>::value : return true if T is a pointer to a POD type (char, int, long, etc.), otherwise return false
*/
#include <QxTraits/is_qx_pod.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_ptr_to_pod<T>::value : return true if T is a pointer to a POD type (char, int, long, etc.), otherwise return false
*/
template <typename T>
class is_ptr_to_pod
{
private:
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removePtr(const volatile U *const volatile);
static int removePtr(...);
static T t;
public:
enum
{
value = (std::is_pointer<T>::value && (sizeof(qx::trait::is_ptr_to_pod<T>::removePtr(t)) == sizeof(char)))
};
typedef typename std::conditional<qx::trait::is_ptr_to_pod<T>::value, std::true_type, std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_PTR_TO_POD_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_HASH_H_
#define _QX_IS_QT_HASH_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_hash.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_hash<T>::value : return true if T is a QHash<> container of Qt library, otherwise return false
*/
#include <QtCore/qhash.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_hash<T>::value : return true if T is a QHash<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_hash : public std::false_type
{
;
};
template <typename Key, typename Value>
struct is_qt_hash<QHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_hash<QHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_hash<const QHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_hash<const QHash<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_HASH_H_

View File

@@ -0,0 +1,92 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
#ifndef _QX_IS_QT_LINKED_LIST_H_
#define _QX_IS_QT_LINKED_LIST_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_linked_list.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_linked_list<T>::value : return true if T is a QLinkedList<> container of Qt library, otherwise return false
*/
#include <QtCore/qlinkedlist.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_linked_list<T>::value : return true if T is a QLinkedList<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_linked_list : public std::false_type
{
;
};
template <typename T>
struct is_qt_linked_list<QLinkedList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_linked_list<QLinkedList<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_linked_list<const QLinkedList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_linked_list<const QLinkedList<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_LINKED_LIST_H_
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_LIST_H_
#define _QX_IS_QT_LIST_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_list.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_list<T>::value : return true if T is a QList<> container of Qt library, otherwise return false
*/
#include <QtCore/qlist.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_list<T>::value : return true if T is a QList<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_list : public std::false_type
{
;
};
template <typename T>
struct is_qt_list<QList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_list<QList<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_list<const QList<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_list<const QList<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_LIST_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_MAP_H_
#define _QX_IS_QT_MAP_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_map.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_map<T>::value : return true if T is a QMap<> container of Qt library, otherwise return false
*/
#include <QtCore/qmap.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_map<T>::value : return true if T is a QMap<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_map : public std::false_type
{
;
};
template <typename Key, typename Value>
struct is_qt_map<QMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_map<QMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_map<const QMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_map<const QMap<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_MAP_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_MULTI_HASH_H_
#define _QX_IS_QT_MULTI_HASH_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_multi_hash.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_multi_hash<T>::value : return true if T is a QMultiHash<> container of Qt library, otherwise return false
*/
#include <QtCore/QMultiHash>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_multi_hash<T>::value : return true if T is a QMultiHash<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_multi_hash : public std::false_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_hash<QMultiHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_hash<QMultiHash<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_hash<const QMultiHash<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_hash<const QMultiHash<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_MULTI_HASH_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_MULTI_MAP_H_
#define _QX_IS_QT_MULTI_MAP_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_multi_map.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_multi_map<T>::value : return true if T is a QMultiMap<> container of Qt library, otherwise return false
*/
#include <QtCore/QMultiMap>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_multi_map<T>::value : return true if T is a QMultiMap<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_multi_map : public std::false_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_map<QMultiMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_map<QMultiMap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_map<const QMultiMap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_qt_multi_map<const QMultiMap<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_MULTI_MAP_H_

View File

@@ -0,0 +1,114 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#ifndef _QX_IS_QT_SCOPED_PTR_H_
#define _QX_IS_QT_SCOPED_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_scoped_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_scoped_ptr<T>::value : return true if T is a QScopedPointer<> smart-pointer of Qt library, otherwise return false
*/
#include <QtCore/qscopedpointer.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_scoped_ptr<T>::value : return true if T is a QScopedPointer<> smart-pointer of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_scoped_ptr : public std::false_type
{
;
};
template <typename T>
struct is_qt_scoped_ptr<QScopedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_scoped_ptr<QScopedPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_scoped_ptr<const QScopedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_scoped_ptr<const QScopedPointer<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_SCOPED_PTR_H_
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#if (QT_VERSION < QT_VERSION_CHECK(4, 6, 0))
#ifndef _QX_IS_QT_SCOPED_PTR_H_
#define _QX_IS_QT_SCOPED_PTR_H_
namespace qx
{
namespace trait
{
template <typename T>
class is_qt_scoped_ptr
{
public:
enum
{
value = false
};
typedef std::false_type type;
};
}
} // namespace qx::trait
#endif // _QX_IS_QT_SCOPED_PTR_H_
#endif // (QT_VERSION < QT_VERSION_CHECK(4, 6, 0))

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_SET_H_
#define _QX_IS_QT_SET_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_set.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_set<T>::value : return true if T is a QSet<> container of Qt library, otherwise return false
*/
#include <QtCore/qset.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_set<T>::value : return true if T is a QSet<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_set : public std::false_type
{
;
};
template <typename T>
struct is_qt_set<QSet<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_set<QSet<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_set<const QSet<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_set<const QSet<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_SET_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_SHARED_DATA_PTR_H_
#define _QX_IS_QT_SHARED_DATA_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_shared_data_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_shared_data_ptr<T>::value : return true if T is a QSharedDataPointer<> smart-pointer of Qt library, otherwise return false
*/
#include <QtCore/QSharedDataPointer>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_shared_data_ptr<T>::value : return true if T is a QSharedDataPointer<> smart-pointer of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_shared_data_ptr : public std::false_type
{
;
};
template <typename T>
struct is_qt_shared_data_ptr<QSharedDataPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_shared_data_ptr<QSharedDataPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_shared_data_ptr<const QSharedDataPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_shared_data_ptr<const QSharedDataPointer<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_SHARED_DATA_PTR_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_SHARED_PTR_H_
#define _QX_IS_QT_SHARED_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_shared_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_shared_ptr<T>::value : return true if T is a QSharedPointer<> smart-pointer of Qt library, otherwise return false
*/
#include <QtCore/qsharedpointer.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_shared_ptr<T>::value : return true if T is a QSharedPointer<> smart-pointer of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_shared_ptr : public std::false_type
{
;
};
template <typename T>
struct is_qt_shared_ptr<QSharedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_shared_ptr<QSharedPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_shared_ptr<const QSharedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_shared_ptr<const QSharedPointer<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_SHARED_PTR_H_

View File

@@ -0,0 +1,415 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_VARIANT_COMPATIBLE_H_
#define _QX_IS_QT_VARIANT_COMPATIBLE_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_variant_compatible.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_variant_compatible<T>::value : return true if T can be host into a QVariant object of Qt library, otherwise return false
*/
#include <QtCore/qvariant.h>
#include <QxCommon/QxConfig.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_variant_compatible<T>::value : return true if T can be host into a QVariant object of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_variant_compatible
{
enum
{
value = (std::is_enum<T>::value || std::is_integral<T>::value)
};
};
template <>
struct is_qt_variant_compatible<bool>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<short>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<int>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<long>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<long long>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<float>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<double>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<long double>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<unsigned short>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<unsigned int>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<unsigned long>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<unsigned long long>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QString>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QDate>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QTime>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QDateTime>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QBitArray>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QByteArray>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QLatin1String>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QStringList>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QChar>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QLocale>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QSize>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QSizeF>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QPoint>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QPointF>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QLine>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QLineF>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QRect>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QRectF>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QUrl>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QVariant>
{
enum
{
value = true
};
};
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
template <>
struct is_qt_variant_compatible<QRegExp>
{
enum
{
value = true
};
};
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#ifdef _QX_ENABLE_QT_GUI
template <>
struct is_qt_variant_compatible<QBrush>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QColor>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QFont>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QImage>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QPixmap>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QRegion>
{
enum
{
value = true
};
};
#endif // _QX_ENABLE_QT_GUI
template <>
struct is_qt_variant_compatible<QList<QVariant>>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QMap<QString, QVariant>>
{
enum
{
value = true
};
};
template <>
struct is_qt_variant_compatible<QHash<QString, QVariant>>
{
enum
{
value = true
};
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_VARIANT_COMPATIBLE_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_VECTOR_H_
#define _QX_IS_QT_VECTOR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_vector.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_vector<T>::value : return true if T is a QVector<> container of Qt library, otherwise return false
*/
#include <QtCore/qvector.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_vector<T>::value : return true if T is a QVector<> container of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_vector : public std::false_type
{
;
};
template <typename T>
struct is_qt_vector<QVector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_vector<QVector<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_vector<const QVector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_vector<const QVector<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_VECTOR_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QT_WEAK_PTR_H_
#define _QX_IS_QT_WEAK_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qt_weak_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qt_weak_ptr<T>::value : return true if T is a QWeakPointer<> smart-pointer of Qt library, otherwise return false
*/
#include <QtCore/QWeakPointer>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qt_weak_ptr<T>::value : return true if T is a QWeakPointer<> smart-pointer of Qt library, otherwise return false
*/
template <typename T>
struct is_qt_weak_ptr : public std::false_type
{
;
};
template <typename T>
struct is_qt_weak_ptr<QWeakPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_weak_ptr<QWeakPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qt_weak_ptr<const QWeakPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qt_weak_ptr<const QWeakPointer<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QT_WEAK_PTR_H_

View File

@@ -0,0 +1,75 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QX_COLLECTION_H_
#define _QX_IS_QX_COLLECTION_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qx_collection.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qx_collection<T>::value : return true if T is a qx::QxCollection<> container of QxOrm library, otherwise return false
*/
#include <QxCollection/IxCollection.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qx_collection<T>::value : return true if T is a qx::QxCollection<> container of QxOrm library, otherwise return false
*/
template <typename T>
class is_qx_collection
{
public:
enum
{
value = std::is_base_of<qx::IxCollection, T>::value
};
typedef typename std::conditional<qx::trait::is_qx_collection<T>::value,
std::true_type,
std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QX_COLLECTION_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QX_DAO_PTR_H_
#define _QX_IS_QX_DAO_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qx_dao_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qx_dao_ptr<T>::value : return true if T is a qx::dao::ptr<> smart-pointer of QxOrm library, otherwise return false
*/
#include <QxDao/QxDaoPointer.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qx_dao_ptr<T>::value : return true if T is a qx::dao::ptr<> smart-pointer of QxOrm library, otherwise return false
*/
template <typename T>
struct is_qx_dao_ptr : public std::false_type
{
;
};
template <typename T>
struct is_qx_dao_ptr<qx::dao::ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qx_dao_ptr<qx::dao::ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_qx_dao_ptr<const qx::dao::ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_qx_dao_ptr<const qx::dao::ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QX_DAO_PTR_H_

View File

@@ -0,0 +1,70 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QX_POD_H_
#define _QX_IS_QX_POD_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qx_pod.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qx_pod<T>::value : return true if T is a POD type and not a pointer
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qx_pod<T>::value : return true if T is a POD type and not a pointer
*/
template <typename T>
struct is_qx_pod
{
enum
{
value = (std::is_pod<T>::value && !std::is_pointer<T>::value && !std::is_member_pointer<T>::value)
};
typedef typename std::conditional<qx::trait::is_qx_pod<T>::value, std::true_type, std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_QX_POD_H_

View File

@@ -0,0 +1,83 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_QX_REGISTERED_H_
#define _QX_IS_QX_REGISTERED_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_qx_registered.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_qx_registered<T>::value : return true if T is registered into QxOrm context to provide persitence (ORM), serialization and introspection features
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_qx_registered<T>::value : return true if T is registered into QxOrm context to provide persitence (ORM), serialization and introspection features
*/
template <typename T>
struct is_qx_registered
{
enum
{
value = false
};
};
} // namespace trait
} // namespace qx
#define QX_SET_REGISTERED(className) \
namespace qx \
{ \
namespace trait \
{ \
template <> \
struct is_qx_registered<className> \
{ \
enum \
{ \
value = true \
}; \
}; \
} \
} // namespace qx::trait
#endif // _QX_IS_QX_REGISTERED_H_

View File

@@ -0,0 +1,373 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_SMART_PTR_H_
#define _QX_IS_SMART_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_smart_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_smart_ptr<T>::value : return true if T is a smart-pointer of boost, Qt or QxOrm libraries, otherwise return false
*/
#include <QxTraits/is_boost_intrusive_ptr.h>
#include <QxTraits/is_boost_scoped_ptr.h>
#include <QxTraits/is_boost_shared_ptr.h>
#include <QxTraits/is_boost_weak_ptr.h>
#include <QxTraits/is_qt_shared_data_ptr.h>
#include <QxTraits/is_qt_scoped_ptr.h>
#include <QxTraits/is_qt_shared_ptr.h>
#include <QxTraits/is_qt_weak_ptr.h>
#include <QxTraits/is_qx_dao_ptr.h>
#include <QxTraits/is_std_unique_ptr.h>
#include <QxTraits/is_std_shared_ptr.h>
#include <QxTraits/is_std_weak_ptr.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_smart_ptr<T>::value : return true if T is a smart-pointer of boost, Qt or QxOrm libraries, otherwise return false
*/
template <typename T>
struct is_smart_ptr : public std::false_type
{
;
};
#ifdef _QX_ENABLE_BOOST
template <typename T>
struct is_smart_ptr<boost::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<boost::shared_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::shared_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<boost::intrusive_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<boost::intrusive_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::intrusive_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::intrusive_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<boost::scoped_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<boost::scoped_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::scoped_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::scoped_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<boost::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<boost::weak_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const boost::weak_ptr<T> &> : public std::true_type
{
;
};
#endif // _QX_ENABLE_BOOST
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct is_smart_ptr<QScopedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<QScopedPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QScopedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QScopedPointer<T> &> : public std::true_type
{
;
};
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct is_smart_ptr<QSharedDataPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<QSharedDataPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QSharedDataPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QSharedDataPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<QSharedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<QSharedPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QSharedPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QSharedPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<QWeakPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<QWeakPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QWeakPointer<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const QWeakPointer<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<qx::dao::ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<qx::dao::ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const qx::dao::ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const qx::dao::ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<std::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<std::shared_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const std::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const std::shared_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<std::unique_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<std::unique_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const std::unique_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const std::unique_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<std::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<std::weak_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const std::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_smart_ptr<const std::weak_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_SMART_PTR_H_

View File

@@ -0,0 +1,170 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_SMART_PTR_BASE_OF_H_
#define _QX_IS_SMART_PTR_BASE_OF_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_smart_ptr_base_of.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_smart_ptr_base_of<B, D>::value : return true if B and D are smart-pointers of boost, Qt or QxOrm libraries and if (*B) is a base class of (*D), otherwise return false
*/
#include <QxTraits/is_smart_ptr.h>
#define qx_smart_ptr_base_of_test_0() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr(b, d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_1() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_boost_scoped_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_2() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_boost_shared_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_3() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_boost_weak_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_4() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_boost_intrusive_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_5() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_qt_shared_data_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_6() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_qt_shared_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_7() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_qt_weak_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_8() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_qx_dao_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_9() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_std_unique_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_10() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_std_shared_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_test_11() (sizeof(qx::trait::is_smart_ptr_base_of<B, D>::removeSmartPtr((*b_std_weak_ptr), d)) == sizeof(char))
#define qx_smart_ptr_base_of_all_test() \
qx_smart_ptr_base_of_test_1() || qx_smart_ptr_base_of_test_2() || qx_smart_ptr_base_of_test_3() || \
qx_smart_ptr_base_of_test_4() || qx_smart_ptr_base_of_test_5() || qx_smart_ptr_base_of_test_6() || \
qx_smart_ptr_base_of_test_7() || qx_smart_ptr_base_of_test_8() || qx_smart_ptr_base_of_test_9() || \
qx_smart_ptr_base_of_test_10() || qx_smart_ptr_base_of_test_11()
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_smart_ptr_base_of<B, D>::value : return true if B and D are smart-pointers of boost, Qt or QxOrm libraries and if (*B) is a base class of (*D), otherwise return false
*/
template <typename B, typename D>
class is_smart_ptr_base_of
{
private:
#ifdef _QX_ENABLE_BOOST
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const boost::scoped_ptr<V> &, const boost::scoped_ptr<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const boost::shared_ptr<V> &, const boost::shared_ptr<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const boost::weak_ptr<V> &, const boost::weak_ptr<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const boost::intrusive_ptr<V> &, const boost::intrusive_ptr<W> &);
#endif // _QX_ENABLE_BOOST
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const QSharedDataPointer<V> &, const QSharedDataPointer<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const QSharedPointer<V> &, const QSharedPointer<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const QWeakPointer<V> &, const QWeakPointer<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const qx::dao::ptr<V> &, const qx::dao::ptr<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const std::unique_ptr<V> &, const std::unique_ptr<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const std::shared_ptr<V> &, const std::shared_ptr<W> &);
template <typename V, typename W>
static typename std::conditional<std::is_base_of<V, W>::value, char, int>::type removeSmartPtr(const std::weak_ptr<V> &, const std::weak_ptr<W> &);
static int removeSmartPtr(...);
static B b;
static D d;
#ifdef _QX_ENABLE_BOOST
static boost::scoped_ptr<B> *b_boost_scoped_ptr;
static boost::shared_ptr<B> *b_boost_shared_ptr;
static boost::weak_ptr<B> *b_boost_weak_ptr;
static boost::intrusive_ptr<B> *b_boost_intrusive_ptr;
#endif // _QX_ENABLE_BOOST
static QSharedDataPointer<B> *b_qt_shared_data_ptr;
static QSharedPointer<B> *b_qt_shared_ptr;
static QWeakPointer<B> *b_qt_weak_ptr;
static qx::dao::ptr<B> *b_qx_dao_ptr;
static std::unique_ptr<B> *b_std_unique_ptr;
static std::shared_ptr<B> *b_std_shared_ptr;
static std::weak_ptr<B> *b_std_weak_ptr;
enum
{
value_0 = (qx::trait::is_smart_ptr<D>::value)
};
enum
{
value_1 = (qx::trait::is_smart_ptr<B>::value)
};
enum
{
value_2 = ((value_0 && value_1) ? qx_smart_ptr_base_of_test_0() : 0)
};
enum
{
value_3 = ((value_0 && !value_1) ? qx_smart_ptr_base_of_all_test() : 0)
};
public:
enum
{
value = (qx::trait::is_smart_ptr_base_of<B, D>::value_2 || qx::trait::is_smart_ptr_base_of<B, D>::value_3)
};
typedef typename std::conditional<qx::trait::is_smart_ptr_base_of<B, D>::value, std::true_type, std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_SMART_PTR_BASE_OF_H_

View File

@@ -0,0 +1,115 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_SMART_PTR_TO_POD_H_
#define _QX_IS_SMART_PTR_TO_POD_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_smart_ptr_to_pod.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_smart_ptr_to_pod<T>::value : return true if T is a smart-pointer of boost, Qt or QxOrm libraries and (*T) is a POD type (char, int, long, etc.), otherwise return false
*/
#include <QxTraits/is_smart_ptr.h>
#include <QxTraits/is_qx_pod.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_smart_ptr_to_pod<T>::value : return true if T is a smart-pointer of boost, Qt or QxOrm libraries and (*T) is a POD type (char, int, long, etc.), otherwise return false
*/
template <typename T>
class is_smart_ptr_to_pod
{
private:
#ifdef _QX_ENABLE_BOOST
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const boost::scoped_ptr<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const boost::shared_ptr<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const boost::weak_ptr<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const boost::intrusive_ptr<U> &);
#endif // _QX_ENABLE_BOOST
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const QSharedDataPointer<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const QSharedPointer<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const QWeakPointer<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const qx::dao::ptr<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const std::unique_ptr<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const std::shared_ptr<U> &);
template <typename U>
static typename std::conditional<qx::trait::is_qx_pod<U>::value, char, int>::type removeSmartPtr(const std::weak_ptr<U> &);
static int removeSmartPtr(...);
static T t;
public:
enum
{
value = (qx::trait::is_smart_ptr<T>::value && (sizeof(qx::trait::is_smart_ptr_to_pod<T>::removeSmartPtr(t)) == sizeof(char)))
};
typedef typename std::conditional<qx::trait::is_smart_ptr_to_pod<T>::value, std::true_type, std::false_type>::type type;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_SMART_PTR_TO_POD_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_LIST_H_
#define _QX_IS_STD_LIST_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_list.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_list<T>::value : return true if T is a std::list<> container of stl library, otherwise return false
*/
#include <list>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_list<T>::value : return true if T is a std::list<> container of stl library, otherwise return false
*/
template <typename T>
struct is_std_list : public std::false_type
{
;
};
template <typename T>
struct is_std_list<std::list<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_list<std::list<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_list<const std::list<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_list<const std::list<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_LIST_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_MAP_H_
#define _QX_IS_STD_MAP_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_map.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_map<T>::value : return true if T is a std::map<> container of stl library, otherwise return false
*/
#include <map>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_map<T>::value : return true if T is a std::map<> container of stl library, otherwise return false
*/
template <typename T>
struct is_std_map : public std::false_type
{
;
};
template <typename Key, typename Value>
struct is_std_map<std::map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_map<std::map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_map<const std::map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_map<const std::map<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_MAP_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_SET_H_
#define _QX_IS_STD_SET_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_set.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_set<T>::value : return true if T is a std::set<> container of stl library, otherwise return false
*/
#include <set>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_set<T>::value : return true if T is a std::set<> container of stl library, otherwise return false
*/
template <typename T>
struct is_std_set : public std::false_type
{
;
};
template <typename T>
struct is_std_set<std::set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_set<std::set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_set<const std::set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_set<const std::set<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_SET_H_

View File

@@ -0,0 +1,88 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_SHARED_PTR_H_
#define _QX_IS_STD_SHARED_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_shared_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_shared_ptr<T>::value : return true if T is a std::shared_ptr<> smart-pointer, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_shared_ptr<T>::value : return true if T is a std::shared_ptr<> smart-pointer, otherwise return false
*/
template <typename T>
struct is_std_shared_ptr : public std::false_type
{
;
};
template <typename T>
struct is_std_shared_ptr<std::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_shared_ptr<std::shared_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_shared_ptr<const std::shared_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_shared_ptr<const std::shared_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_SHARED_PTR_H_

View File

@@ -0,0 +1,88 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_UNIQUE_PTR_H_
#define _QX_IS_STD_UNIQUE_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_unique_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_unique_ptr<T>::value : return true if T is a std::unique_ptr<> smart-pointer, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_unique_ptr<T>::value : return true if T is a std::unique_ptr<> smart-pointer, otherwise return false
*/
template <typename T>
struct is_std_unique_ptr : public std::false_type
{
;
};
template <typename T>
struct is_std_unique_ptr<std::unique_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_unique_ptr<std::unique_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_unique_ptr<const std::unique_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_unique_ptr<const std::unique_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_UNIQUE_PTR_H_

View File

@@ -0,0 +1,114 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_UNORDERED_MAP_H_
#define _QX_IS_STD_UNORDERED_MAP_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_unordered_map.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_unordered_map<T>::value : return true if T is a std::unordered_map<> or std::unordered_multimap<> container, otherwise return false
*/
#include <unordered_map>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_unordered_map<T>::value : return true if T is a std::unordered_map<> or std::unordered_multimap<> container, otherwise return false
*/
template <typename T>
struct is_std_unordered_map : public std::false_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<std::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<std::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<const std::unordered_map<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<const std::unordered_map<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<std::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<std::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<const std::unordered_multimap<Key, Value>> : public std::true_type
{
;
};
template <typename Key, typename Value>
struct is_std_unordered_map<const std::unordered_multimap<Key, Value> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_UNORDERED_MAP_H_

View File

@@ -0,0 +1,114 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_UNORDERED_SET_H_
#define _QX_IS_STD_UNORDERED_SET_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_unordered_set.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_unordered_set<T>::value : return true if T is a std::unordered_set<> or std::unordered_multiset<> container, otherwise return false
*/
#include <unordered_set>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_unordered_set<T>::value : return true if T is a std::unordered_set<> or std::unordered_multiset<> container, otherwise return false
*/
template <typename T>
struct is_std_unordered_set : public std::false_type
{
;
};
template <typename T>
struct is_std_unordered_set<std::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_unordered_set<std::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_unordered_set<const std::unordered_set<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_unordered_set<const std::unordered_set<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_unordered_set<std::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_unordered_set<std::unordered_multiset<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_unordered_set<const std::unordered_multiset<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_unordered_set<const std::unordered_multiset<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_UNORDERED_SET_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_VECTOR_H_
#define _QX_IS_STD_VECTOR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_vector.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_vector<T>::value : return true if T is a std::vector<> container of stl library, otherwise return false
*/
#include <vector>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_vector<T>::value : return true if T is a std::vector<> container of stl library, otherwise return false
*/
template <typename T>
struct is_std_vector : public std::false_type
{
;
};
template <typename T>
struct is_std_vector<std::vector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_vector<std::vector<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_vector<const std::vector<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_vector<const std::vector<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_VECTOR_H_

View File

@@ -0,0 +1,88 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_STD_WEAK_PTR_H_
#define _QX_IS_STD_WEAK_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_std_weak_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_std_weak_ptr<T>::value : return true if T is a std::weak_ptr<> smart-pointer, otherwise return false
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_std_weak_ptr<T>::value : return true if T is a std::weak_ptr<> smart-pointer, otherwise return false
*/
template <typename T>
struct is_std_weak_ptr : public std::false_type
{
;
};
template <typename T>
struct is_std_weak_ptr<std::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_weak_ptr<std::weak_ptr<T> &> : public std::true_type
{
;
};
template <typename T>
struct is_std_weak_ptr<const std::weak_ptr<T>> : public std::true_type
{
;
};
template <typename T>
struct is_std_weak_ptr<const std::weak_ptr<T> &> : public std::true_type
{
;
};
} // namespace trait
} // namespace qx
#endif // _QX_IS_STD_WEAK_PTR_H_

View File

@@ -0,0 +1,144 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_IS_VALID_PRIMARY_KEY_H_
#define _QX_IS_VALID_PRIMARY_KEY_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file is_valid_primary_key.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::is_valid_primary_key<T>(const T & t) : return true if t can be a valid primary key to be inserted into a database, otherwise return false
*/
namespace qx
{
namespace trait
{
namespace detail
{
/*!
* \ingroup QxTraits
* \brief qx::trait::is_valid_primary_key<T>(const T & t) : return true if t can be a valid primary key to be inserted into a database, otherwise return false
*/
template <typename T>
struct is_valid_primary_key
{
static inline bool get(const T &t)
{
Q_UNUSED(t);
qAssert(false);
return false;
}
};
template <>
struct is_valid_primary_key<short>
{
static inline bool get(const short &t) { return (t != 0); }
};
template <>
struct is_valid_primary_key<int>
{
static inline bool get(const int &t) { return (t != 0); }
};
template <>
struct is_valid_primary_key<long>
{
static inline bool get(const long &t) { return (t != 0); }
};
template <>
struct is_valid_primary_key<long long>
{
static inline bool get(const long long &t) { return (t != 0); }
};
template <>
struct is_valid_primary_key<QString>
{
static inline bool get(const QString &t) { return (!t.isEmpty()); }
};
template <>
struct is_valid_primary_key<QByteArray>
{
static inline bool get(const QByteArray &t) { return (!t.isEmpty()); }
};
template <>
struct is_valid_primary_key<std::string>
{
static inline bool get(const std::string &t) { return (!t.empty()); }
};
template <>
struct is_valid_primary_key<std::wstring>
{
static inline bool get(const std::wstring &t) { return (!t.empty()); }
};
template <>
struct is_valid_primary_key<QVariant>
{
static inline bool get(const QVariant &t)
{
if (t.type() == QVariant::ByteArray)
{
return qx::trait::detail::is_valid_primary_key<QByteArray>::get(t.toByteArray());
}
if (t.type() == QVariant::String)
{
return qx::trait::detail::is_valid_primary_key<QString>::get(t.toString());
}
return (!t.isNull() && (t.toLongLong() != 0));
}
};
} // namespace detail
template <typename T>
inline bool is_valid_primary_key(const T &t)
{
return qx::trait::detail::is_valid_primary_key<T>::get(t);
}
} // namespace trait
} // namespace qx
#endif // _QX_IS_VALID_PRIMARY_KEY_H_

View File

@@ -0,0 +1,90 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_QT_META_OBJECT_H_
#define _QX_QT_META_OBJECT_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file qt_meta_object.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::qt_meta_object<T>::get() : if T is based on QObject class, then return QMetaObject instance of Qt introspection engine, else return NULL
*/
#include <QtCore/qmetaobject.h>
#include <QtCore/qmetatype.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::qt_meta_object<T>::get() : if T is based on QObject class, then return QMetaObject instance of Qt introspection engine, else return NULL
*/
template <typename T>
class qt_meta_object
{
public:
enum
{
is_valid = (std::is_base_of<QObject, T>::value)
};
static const QMetaObject *get()
{
return qtMetaObject<qt_meta_object<T>::is_valid, 0>::get();
}
private:
template <bool isQObject /* = false */, int dummy>
struct qtMetaObject
{
static inline const QMetaObject *get() { return NULL; }
};
template <int dummy>
struct qtMetaObject<true, dummy>
{
static inline const QMetaObject *get() { return (&T::staticMetaObject); }
};
};
} // namespace trait
} // namespace qx
#endif // _QX_QT_META_OBJECT_H_

View File

@@ -0,0 +1,94 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_TRAITS_H_
#define _QX_TRAITS_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <QxTraits/get_base_class.h>
#include <QxTraits/get_primary_key.h>
#include <QxTraits/get_class_name.h>
#include <QxTraits/get_class_name_primitive.h>
#include <QxTraits/is_container.h>
#include <QxTraits/is_ptr_base_of.h>
#include <QxTraits/is_ptr_to_pod.h>
#include <QxTraits/is_qt_hash.h>
#include <QxTraits/is_qt_linked_list.h>
#include <QxTraits/is_qt_list.h>
#include <QxTraits/is_qt_map.h>
#include <QxTraits/is_qt_multi_hash.h>
#include <QxTraits/is_qt_multi_map.h>
#include <QxTraits/is_qt_set.h>
#include <QxTraits/is_qt_shared_data_ptr.h>
#include <QxTraits/is_qt_shared_ptr.h>
#include <QxTraits/is_qt_scoped_ptr.h>
#include <QxTraits/is_qt_vector.h>
#include <QxTraits/is_qt_weak_ptr.h>
#include <QxTraits/is_qt_variant_compatible.h>
#include <QxTraits/is_qx_collection.h>
#include <QxTraits/is_qx_pod.h>
#include <QxTraits/is_qx_registered.h>
#include <QxTraits/is_smart_ptr.h>
#include <QxTraits/is_std_list.h>
#include <QxTraits/is_std_map.h>
#include <QxTraits/is_std_set.h>
#include <QxTraits/is_std_vector.h>
#include <QxTraits/archive_wide_traits.h>
#include <QxTraits/archive_printable.h>
#include <QxTraits/remove_attr.h>
#include <QxTraits/remove_smart_ptr.h>
#include <QxTraits/construct_ptr.h>
#include <QxTraits/construct_null_qvariant.h>
#include <QxTraits/get_sql_type.h>
#include <QxTraits/generic_container.h>
#include <QxTraits/is_valid_primary_key.h>
#include <QxTraits/is_qx_dao_ptr.h>
#include <QxTraits/is_equal.h>
#include <QxTraits/qt_meta_object.h>
#include <QxTraits/is_std_shared_ptr.h>
#include <QxTraits/is_std_unique_ptr.h>
#include <QxTraits/is_std_unordered_map.h>
#include <QxTraits/is_std_unordered_set.h>
#include <QxTraits/is_std_weak_ptr.h>
#ifdef _QX_ENABLE_BOOST
#include <QxTraits/is_boost_intrusive_ptr.h>
#include <QxTraits/is_boost_scoped_ptr.h>
#include <QxTraits/is_boost_shared_ptr.h>
#include <QxTraits/is_boost_unordered_map.h>
#include <QxTraits/is_boost_unordered_set.h>
#include <QxTraits/is_boost_weak_ptr.h>
#endif // _QX_ENABLE_BOOST
#endif // _QX_TRAITS_H_

View File

@@ -0,0 +1,72 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_REMOVE_ATTR_H_
#define _QX_REMOVE_ATTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file remove_attr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::remove_attr<T>::type : return a type without pointer, const, reference and/or volatile attributes
*/
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::remove_attr<T>::type : return a type without pointer, const, reference and/or volatile attributes
*/
template <typename T, bool bRemovePtr = true, bool bRemoveConst = true, bool bRemoveRef = true, bool bRemoveVolatile = true>
class remove_attr
{
private:
typedef typename std::conditional<bRemovePtr, typename std::remove_pointer<T>::type, T>::type type_1;
typedef typename std::conditional<bRemoveConst, typename std::remove_const<type_1>::type, type_1>::type type_2;
typedef typename std::conditional<bRemoveRef, typename std::remove_reference<type_2>::type, type_2>::type type_3;
typedef typename std::conditional<bRemoveVolatile, typename std::remove_volatile<type_3>::type, type_3>::type type_4;
public:
typedef type_4 type;
};
} // namespace trait
} // namespace qx
#endif // _QX_REMOVE_ATTR_H_

View File

@@ -0,0 +1,126 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_REMOVE_SMART_PTR_H_
#define _QX_REMOVE_SMART_PTR_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file remove_smart_ptr.h
* \author XDL Team
* \ingroup QxTraits
* \brief qx::trait::remove_smart_ptr<T>::type : return a type without smart-pointer attribute from boost, Qt or QxOrm library
*/
#include <QtCore/qsharedpointer.h>
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QtCore/qscopedpointer.h>
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
#include <QxDao/QxDaoPointer.h>
namespace qx
{
namespace trait
{
/*!
* \ingroup QxTraits
* \brief qx::trait::remove_smart_ptr<T>::type : return a type without smart-pointer attribute from boost, Qt or QxOrm library
*/
template <typename T>
struct remove_smart_ptr
{
typedef T type;
};
#ifdef _QX_ENABLE_BOOST
template <typename T>
struct remove_smart_ptr<boost::scoped_ptr<T>>
{
typedef T type;
};
template <typename T>
struct remove_smart_ptr<boost::shared_ptr<T>>
{
typedef T type;
};
template <typename T>
struct remove_smart_ptr<boost::intrusive_ptr<T>>
{
typedef T type;
};
#endif // _QX_ENABLE_BOOST
template <typename T>
struct remove_smart_ptr<QSharedPointer<T>>
{
typedef T type;
};
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct remove_smart_ptr<QScopedPointer<T>>
{
typedef T type;
};
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
template <typename T>
struct remove_smart_ptr<qx::dao::ptr<T>>
{
typedef T type;
};
template <typename T>
struct remove_smart_ptr<std::unique_ptr<T>>
{
typedef T type;
};
template <typename T>
struct remove_smart_ptr<std::shared_ptr<T>>
{
typedef T type;
};
} // namespace trait
} // namespace qx
#endif // _QX_REMOVE_SMART_PTR_H_