first commit
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_QFLAGS_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_QFLAGS_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_QFlags.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type QFlags<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 9, 0))
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const QFlags<T> &t)
|
||||
{
|
||||
qint64 iFlags = static_cast<qint64>(t);
|
||||
stream << iFlags;
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, QFlags<T> &t)
|
||||
{
|
||||
qint64 iFlags = 0;
|
||||
stream >> iFlags;
|
||||
t = QFlags<T>(QFlag(static_cast<int>(iFlags)));
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 9, 0))
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_QFLAGS_H_
|
||||
@@ -0,0 +1,52 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_QOBJECT_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_QOBJECT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_QObject.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type QObject (serialize dynamic properties)
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
#include <QtCore/qobject.h>
|
||||
|
||||
QX_DLL_EXPORT QDataStream &operator<<(QDataStream &stream, const QObject &t) QX_USED;
|
||||
QX_DLL_EXPORT QDataStream &operator>>(QDataStream &stream, QObject &t) QX_USED;
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_QOBJECT_H_
|
||||
@@ -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
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
|
||||
#ifndef _QX_SERIALIZE_QDATASTREAM_QSCOPEDPOINTER_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_QSCOPEDPOINTER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_QScopedPointer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type QScopedPointer<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const QScopedPointer<T> &t)
|
||||
{
|
||||
qint8 iIsNull = (t ? 0 : 1);
|
||||
stream << iIsNull;
|
||||
if (t)
|
||||
{
|
||||
stream << (*t);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, QScopedPointer<T> &t)
|
||||
{
|
||||
qint8 iIsNull = 0;
|
||||
stream >> iIsNull;
|
||||
if (!iIsNull)
|
||||
{
|
||||
t.reset(new T());
|
||||
stream >> (*t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t.reset();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_QSCOPEDPOINTER_H_
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
|
||||
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_QSHAREDPOINTER_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_QSHAREDPOINTER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_QSharedPointer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type QSharedPointer<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
#include <QtCore/qsharedpointer.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const QSharedPointer<T> &t)
|
||||
{
|
||||
qint8 iIsNull = (t ? 0 : 1);
|
||||
stream << iIsNull;
|
||||
if (t)
|
||||
{
|
||||
stream << (*t);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, QSharedPointer<T> &t)
|
||||
{
|
||||
qint8 iIsNull = 0;
|
||||
stream >> iIsNull;
|
||||
if (!iIsNull)
|
||||
{
|
||||
t = QSharedPointer<T>(new T());
|
||||
stream >> (*t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = QSharedPointer<T>();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_QSHAREDPOINTER_H_
|
||||
@@ -0,0 +1,53 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_QSQLERROR_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_QSQLERROR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_QSqlError.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type QSqlError
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <QtSql/qsqlerror.h>
|
||||
|
||||
QX_DLL_EXPORT QDataStream &operator<<(QDataStream &stream, const QSqlError &t) QX_USED;
|
||||
QX_DLL_EXPORT QDataStream &operator>>(QDataStream &stream, QSqlError &t) QX_USED;
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_QSQLERROR_H_
|
||||
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_QWEAKPOINTER_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_QWEAKPOINTER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_QWeakPointer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type QWeakPointer<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
#include <QtCore/QWeakPointer>
|
||||
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_QSharedPointer.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const QWeakPointer<T> &t)
|
||||
{
|
||||
QSharedPointer<T> ptr = t.toStrongRef();
|
||||
stream << ptr;
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, QWeakPointer<T> &t)
|
||||
{
|
||||
QSharedPointer<T> ptr;
|
||||
stream >> ptr;
|
||||
t = QWeakPointer<T>(ptr);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_QWEAKPOINTER_H_
|
||||
@@ -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_SERIALIZE_QDATASTREAM_ALL_INCLUDE_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_ALL_INCLUDE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_all_include.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Include all Qt QDataStream serialization method (save/load) provided by QxOrm library
|
||||
*/
|
||||
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_boost_optional.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_boost_scoped_ptr.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_boost_shared_ptr.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_boost_tuple.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_boost_unordered_map.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_boost_unordered_set.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_primitive_type.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_QFlags.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_QObject.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_QScopedPointer.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_QSharedPointer.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_QSqlError.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_QWeakPointer.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_list.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_map.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_pair.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_set.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_shared_ptr.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_string.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_tuple.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_unique_ptr.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_unordered_map.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_unordered_set.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_std_vector.h>
|
||||
#include <QxSerialize/QDataStream/QxSerializeQDataStream_qx_registered_class.h>
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_ALL_INCLUDE_H_
|
||||
@@ -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
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QDATASTREAM_BOOST_OPTIONAL_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_BOOST_OPTIONAL_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_boost_optional.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type boost::optional<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::optional<T> &t)
|
||||
{
|
||||
qint8 iHasData = (t ? 1 : 0);
|
||||
stream << iHasData;
|
||||
if (t)
|
||||
{
|
||||
stream << (*t);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::optional<T> &t)
|
||||
{
|
||||
qint8 iHasData = 0;
|
||||
stream >> iHasData;
|
||||
if (iHasData)
|
||||
{
|
||||
t = T();
|
||||
stream >> (*t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = boost::none;
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_BOOST_OPTIONAL_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
@@ -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
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QDATASTREAM_BOOST_SCOPED_PTR_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_BOOST_SCOPED_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_boost_scoped_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type boost::scoped_ptr<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::scoped_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = (t ? 0 : 1);
|
||||
stream << iIsNull;
|
||||
if (t)
|
||||
{
|
||||
stream << (*t);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::scoped_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = 0;
|
||||
stream >> iIsNull;
|
||||
if (!iIsNull)
|
||||
{
|
||||
t.reset(new T());
|
||||
stream >> (*t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t.reset();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_BOOST_SCOPED_PTR_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
@@ -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
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QDATASTREAM_BOOST_SHARED_PTR_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_BOOST_SHARED_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_boost_shared_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type boost::shared_ptr<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::shared_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = (t ? 0 : 1);
|
||||
stream << iIsNull;
|
||||
if (t)
|
||||
{
|
||||
stream << (*t);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::shared_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = 0;
|
||||
stream >> iIsNull;
|
||||
if (!iIsNull)
|
||||
{
|
||||
t.reset(new T());
|
||||
stream >> (*t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t.reset();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_BOOST_SHARED_PTR_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
@@ -0,0 +1,266 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_BOOST_TUPLE_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_BOOST_TUPLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_boost_tuple.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type boost::tuple<T0, T1, ..., T9>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T0, typename T1>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2, T3> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
stream << boost::get<3>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2, T3, T4> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
stream << boost::get<3>(t);
|
||||
stream << boost::get<4>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2, T3, T4, T5> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
stream << boost::get<3>(t);
|
||||
stream << boost::get<4>(t);
|
||||
stream << boost::get<5>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2, T3, T4, T5, T6> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
stream << boost::get<3>(t);
|
||||
stream << boost::get<4>(t);
|
||||
stream << boost::get<5>(t);
|
||||
stream << boost::get<6>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
stream << boost::get<3>(t);
|
||||
stream << boost::get<4>(t);
|
||||
stream << boost::get<5>(t);
|
||||
stream << boost::get<6>(t);
|
||||
stream << boost::get<7>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
stream << boost::get<3>(t);
|
||||
stream << boost::get<4>(t);
|
||||
stream << boost::get<5>(t);
|
||||
stream << boost::get<6>(t);
|
||||
stream << boost::get<7>(t);
|
||||
stream << boost::get<8>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t)
|
||||
{
|
||||
stream << boost::get<0>(t);
|
||||
stream << boost::get<1>(t);
|
||||
stream << boost::get<2>(t);
|
||||
stream << boost::get<3>(t);
|
||||
stream << boost::get<4>(t);
|
||||
stream << boost::get<5>(t);
|
||||
stream << boost::get<6>(t);
|
||||
stream << boost::get<7>(t);
|
||||
stream << boost::get<8>(t);
|
||||
stream << boost::get<9>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2, T3> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
stream >> boost::get<3>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2, T3, T4> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
stream >> boost::get<3>(t);
|
||||
stream >> boost::get<4>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2, T3, T4, T5> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
stream >> boost::get<3>(t);
|
||||
stream >> boost::get<4>(t);
|
||||
stream >> boost::get<5>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2, T3, T4, T5, T6> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
stream >> boost::get<3>(t);
|
||||
stream >> boost::get<4>(t);
|
||||
stream >> boost::get<5>(t);
|
||||
stream >> boost::get<6>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
stream >> boost::get<3>(t);
|
||||
stream >> boost::get<4>(t);
|
||||
stream >> boost::get<5>(t);
|
||||
stream >> boost::get<6>(t);
|
||||
stream >> boost::get<7>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
stream >> boost::get<3>(t);
|
||||
stream >> boost::get<4>(t);
|
||||
stream >> boost::get<5>(t);
|
||||
stream >> boost::get<6>(t);
|
||||
stream >> boost::get<7>(t);
|
||||
stream >> boost::get<8>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t)
|
||||
{
|
||||
stream >> boost::get<0>(t);
|
||||
stream >> boost::get<1>(t);
|
||||
stream >> boost::get<2>(t);
|
||||
stream >> boost::get<3>(t);
|
||||
stream >> boost::get<4>(t);
|
||||
stream >> boost::get<5>(t);
|
||||
stream >> boost::get<6>(t);
|
||||
stream >> boost::get<7>(t);
|
||||
stream >> boost::get<8>(t);
|
||||
stream >> boost::get<9>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_BOOST_TUPLE_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
@@ -0,0 +1,122 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_BOOST_UNORDERED_MAP_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_BOOST_UNORDERED_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_boost_unordered_map.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type boost::unordered_map<Key, Value> and boost::unordered_multimap<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::unordered_map<Key, Value> &t)
|
||||
{
|
||||
typedef typename boost::unordered_map<Key, Value>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << itr->first;
|
||||
stream << itr->second;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::unordered_map<Key, Value> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename boost::unordered_map<Key, Value>::size_type>(uiSize));
|
||||
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
Key key;
|
||||
stream >> key;
|
||||
Value value;
|
||||
stream >> value;
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::unordered_multimap<Key, Value> &t)
|
||||
{
|
||||
typedef typename boost::unordered_multimap<Key, Value>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << itr->first;
|
||||
stream << itr->second;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::unordered_multimap<Key, Value> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename boost::unordered_multimap<Key, Value>::size_type>(uiSize));
|
||||
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
Key key;
|
||||
stream >> key;
|
||||
Value value;
|
||||
stream >> value;
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_BOOST_UNORDERED_MAP_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
@@ -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
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QDATASTREAM_BOOST_UNORDERED_SET_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_BOOST_UNORDERED_SET_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_boost_unordered_set.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type boost::unordered_set<T> and boost::unordered_multiset<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::unordered_set<T> &t)
|
||||
{
|
||||
typedef typename boost::unordered_set<T>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << (*itr);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::unordered_set<T> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename boost::unordered_set<T>::size_type>(uiSize));
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
T tmp;
|
||||
stream >> tmp;
|
||||
t.insert(tmp);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const boost::unordered_multiset<T> &t)
|
||||
{
|
||||
typedef typename boost::unordered_multiset<T>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << (*itr);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, boost::unordered_multiset<T> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename boost::unordered_multiset<T>::size_type>(uiSize));
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
T tmp;
|
||||
stream >> tmp;
|
||||
t.insert(tmp);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_BOOST_UNORDERED_SET_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
@@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_PRIMITIVE_TYPE_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_PRIMITIVE_TYPE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_primitive_type.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for primitive types (long, etc...)
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
QX_DLL_EXPORT QDataStream &operator<<(QDataStream &stream, const long &t) QX_USED;
|
||||
QX_DLL_EXPORT QDataStream &operator>>(QDataStream &stream, long &t) QX_USED;
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_PRIMITIVE_TYPE_H_
|
||||
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_QX_REGISTERED_CLASS_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_QX_REGISTERED_CLASS_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_qx_registered_class.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a generic Qt QDataStream serialization method (save/load) for classes registered into QxOrm context (void qx::register_class<MyClass>() function), it is possible to specialize qx::QxSerializeRegistered<T> template to implement your own serialization method for a specific class
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <QxTraits/is_qx_registered.h>
|
||||
|
||||
#include <QxRegister/IxClass.h>
|
||||
#include <QxRegister/QxClass.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
struct QX_DLL_EXPORT QxSerializeRegistered_Helper
|
||||
{
|
||||
|
||||
static QDataStream &save(QDataStream &stream, IxClass *pClass, const void *pOwner);
|
||||
static QDataStream &load(QDataStream &stream, IxClass *pClass, void *pOwner);
|
||||
|
||||
private:
|
||||
static void saveHelper(QDataStream &stream, IxClass *pClass, const void *pOwner);
|
||||
static void loadHelper(QDataStream &stream, IxClass *pClass, void *pOwner);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxSerializeRegistered
|
||||
{
|
||||
|
||||
enum
|
||||
{
|
||||
is_valid = qx::trait::is_qx_registered<T>::value
|
||||
};
|
||||
|
||||
static QDataStream &save(QDataStream &stream, const T &t)
|
||||
{
|
||||
static_assert(is_valid, "is_valid");
|
||||
return qx::QxSerializeRegistered_Helper::save(stream, qx::QxClass<T>::getSingleton(), (&t));
|
||||
}
|
||||
|
||||
static QDataStream &load(QDataStream &stream, T &t)
|
||||
{
|
||||
static_assert(is_valid, "is_valid");
|
||||
return qx::QxSerializeRegistered_Helper::load(stream, qx::QxClass<T>::getSingleton(), (&t));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_QX_REGISTERED_CLASS_H_
|
||||
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_LIST_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_LIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_list.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::list<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::list<T> &t)
|
||||
{
|
||||
typedef typename std::list<T>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << (*itr);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, std::list<T> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
T tmp;
|
||||
stream >> tmp;
|
||||
t.push_back(tmp);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_LIST_H_
|
||||
@@ -0,0 +1,85 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_MAP_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_map.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::map<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::map<Key, Value> &t)
|
||||
{
|
||||
typedef typename std::map<Key, Value>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << itr->first;
|
||||
stream << itr->second;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator>>(QDataStream &stream, std::map<Key, Value> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
Key key;
|
||||
stream >> key;
|
||||
Value value;
|
||||
stream >> value;
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_MAP_H_
|
||||
@@ -0,0 +1,66 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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(6, 0, 0))
|
||||
#ifndef _QX_SERIALIZE_QDATASTREAM_STD_PAIR_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_PAIR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_pair.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::pair<T0, T1>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T0, typename T1>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::pair<T0, T1> &t)
|
||||
{
|
||||
stream << t.first;
|
||||
stream << t.second;
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1>
|
||||
QDataStream &operator>>(QDataStream &stream, std::pair<T0, T1> &t)
|
||||
{
|
||||
stream >> t.first;
|
||||
stream >> t.second;
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_PAIR_H_
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_SET_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_SET_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_set.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::set<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <set>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::set<T> &t)
|
||||
{
|
||||
typedef typename std::set<T>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << (*itr);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, std::set<T> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
T tmp;
|
||||
stream >> tmp;
|
||||
t.insert(tmp);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_SET_H_
|
||||
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_SHARED_PTR_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_SHARED_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_shared_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::shared_ptr<T> (C++11 compilation option _QX_CPP_11_SMART_PTR must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::shared_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = (t ? 0 : 1);
|
||||
stream << iIsNull;
|
||||
if (t)
|
||||
{
|
||||
stream << (*t);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, std::shared_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = 0;
|
||||
stream >> iIsNull;
|
||||
if (!iIsNull)
|
||||
{
|
||||
t = std::make_shared<T>();
|
||||
stream >> (*t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t.reset();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_SHARED_PTR_H_
|
||||
@@ -0,0 +1,56 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_STRING_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_STRING_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_string.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::string and std::wstring
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
QX_DLL_EXPORT QDataStream &operator<<(QDataStream &stream, const std::string &t) QX_USED;
|
||||
QX_DLL_EXPORT QDataStream &operator>>(QDataStream &stream, std::string &t) QX_USED;
|
||||
|
||||
QX_DLL_EXPORT QDataStream &operator<<(QDataStream &stream, const std::wstring &t) QX_USED;
|
||||
QX_DLL_EXPORT QDataStream &operator>>(QDataStream &stream, std::wstring &t) QX_USED;
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_STRING_H_
|
||||
@@ -0,0 +1,264 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_TUPLE_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_TUPLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_tuple.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::tuple<T0, T1, ..., T9> (C++11 compilation option _QX_CPP_11_TUPLE must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T0, typename T1>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2, T3> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
stream << std::get<3>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2, T3, T4> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
stream << std::get<3>(t);
|
||||
stream << std::get<4>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2, T3, T4, T5> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
stream << std::get<3>(t);
|
||||
stream << std::get<4>(t);
|
||||
stream << std::get<5>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2, T3, T4, T5, T6> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
stream << std::get<3>(t);
|
||||
stream << std::get<4>(t);
|
||||
stream << std::get<5>(t);
|
||||
stream << std::get<6>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
stream << std::get<3>(t);
|
||||
stream << std::get<4>(t);
|
||||
stream << std::get<5>(t);
|
||||
stream << std::get<6>(t);
|
||||
stream << std::get<7>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
stream << std::get<3>(t);
|
||||
stream << std::get<4>(t);
|
||||
stream << std::get<5>(t);
|
||||
stream << std::get<6>(t);
|
||||
stream << std::get<7>(t);
|
||||
stream << std::get<8>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t)
|
||||
{
|
||||
stream << std::get<0>(t);
|
||||
stream << std::get<1>(t);
|
||||
stream << std::get<2>(t);
|
||||
stream << std::get<3>(t);
|
||||
stream << std::get<4>(t);
|
||||
stream << std::get<5>(t);
|
||||
stream << std::get<6>(t);
|
||||
stream << std::get<7>(t);
|
||||
stream << std::get<8>(t);
|
||||
stream << std::get<9>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2, T3> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
stream >> std::get<3>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2, T3, T4> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
stream >> std::get<3>(t);
|
||||
stream >> std::get<4>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2, T3, T4, T5> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
stream >> std::get<3>(t);
|
||||
stream >> std::get<4>(t);
|
||||
stream >> std::get<5>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2, T3, T4, T5, T6> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
stream >> std::get<3>(t);
|
||||
stream >> std::get<4>(t);
|
||||
stream >> std::get<5>(t);
|
||||
stream >> std::get<6>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
stream >> std::get<3>(t);
|
||||
stream >> std::get<4>(t);
|
||||
stream >> std::get<5>(t);
|
||||
stream >> std::get<6>(t);
|
||||
stream >> std::get<7>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
stream >> std::get<3>(t);
|
||||
stream >> std::get<4>(t);
|
||||
stream >> std::get<5>(t);
|
||||
stream >> std::get<6>(t);
|
||||
stream >> std::get<7>(t);
|
||||
stream >> std::get<8>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
QDataStream &operator>>(QDataStream &stream, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t)
|
||||
{
|
||||
stream >> std::get<0>(t);
|
||||
stream >> std::get<1>(t);
|
||||
stream >> std::get<2>(t);
|
||||
stream >> std::get<3>(t);
|
||||
stream >> std::get<4>(t);
|
||||
stream >> std::get<5>(t);
|
||||
stream >> std::get<6>(t);
|
||||
stream >> std::get<7>(t);
|
||||
stream >> std::get<8>(t);
|
||||
stream >> std::get<9>(t);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_TUPLE_H_
|
||||
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_UNIQUE_PTR_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_UNIQUE_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_unique_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::unique_ptr<T> (C++11 compilation option _QX_CPP_11_SMART_PTR must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::unique_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = (t ? 0 : 1);
|
||||
stream << iIsNull;
|
||||
if (t)
|
||||
{
|
||||
stream << (*t);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, std::unique_ptr<T> &t)
|
||||
{
|
||||
qint8 iIsNull = 0;
|
||||
stream >> iIsNull;
|
||||
if (!iIsNull)
|
||||
{
|
||||
t.reset(new T());
|
||||
stream >> (*t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t.reset();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_UNIQUE_PTR_H_
|
||||
@@ -0,0 +1,122 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZE_QDATASTREAM_STD_UNORDERED_MAP_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_UNORDERED_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_unordered_map.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::unordered_map<Key, Value> and std::unordered_multimap<Key, Value> (C++11 compilation option _QX_CPP_11_CONTAINER must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::unordered_map<Key, Value> &t)
|
||||
{
|
||||
typedef typename std::unordered_map<Key, Value>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << itr->first;
|
||||
stream << itr->second;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator>>(QDataStream &stream, std::unordered_map<Key, Value> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename std::unordered_map<Key, Value>::size_type>(uiSize));
|
||||
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
Key key;
|
||||
stream >> key;
|
||||
Value value;
|
||||
stream >> value;
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::unordered_multimap<Key, Value> &t)
|
||||
{
|
||||
typedef typename std::unordered_multimap<Key, Value>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << itr->first;
|
||||
stream << itr->second;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
QDataStream &operator>>(QDataStream &stream, std::unordered_multimap<Key, Value> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename std::unordered_multimap<Key, Value>::size_type>(uiSize));
|
||||
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
Key key;
|
||||
stream >> key;
|
||||
Value value;
|
||||
stream >> value;
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_UNORDERED_MAP_H_
|
||||
@@ -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_SERIALIZE_QDATASTREAM_STD_UNORDERED_SET_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_UNORDERED_SET_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_unordered_set.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::unordered_set<T> and std::unordered_multiset<T> (C++11 compilation option _QX_CPP_11_CONTAINER must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::unordered_set<T> &t)
|
||||
{
|
||||
typedef typename std::unordered_set<T>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << (*itr);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, std::unordered_set<T> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename std::unordered_set<T>::size_type>(uiSize));
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
T tmp;
|
||||
stream >> tmp;
|
||||
t.insert(tmp);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::unordered_multiset<T> &t)
|
||||
{
|
||||
typedef typename std::unordered_multiset<T>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << (*itr);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, std::unordered_multiset<T> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename std::unordered_multiset<T>::size_type>(uiSize));
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
T tmp;
|
||||
stream >> tmp;
|
||||
t.insert(tmp);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_UNORDERED_SET_H_
|
||||
@@ -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_SERIALIZE_QDATASTREAM_STD_VECTOR_H_
|
||||
#define _QX_SERIALIZE_QDATASTREAM_STD_VECTOR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQDataStream_std_vector.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QDataStream serialization method (save/load) for type std::vector<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qdatastream.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::vector<T> &t)
|
||||
{
|
||||
typedef typename std::vector<T>::const_iterator type_itr;
|
||||
quint64 uiSize = static_cast<quint64>(t.size());
|
||||
stream << uiSize;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
stream << (*itr);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &stream, std::vector<T> &t)
|
||||
{
|
||||
quint64 uiSize = 0;
|
||||
stream >> uiSize;
|
||||
t.clear();
|
||||
t.reserve(static_cast<typename std::vector<T>::size_type>(uiSize));
|
||||
for (quint64 i = 0; i < uiSize; ++i)
|
||||
{
|
||||
T tmp;
|
||||
stream >> tmp;
|
||||
t.push_back(tmp);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATASTREAM_STD_VECTOR_H_
|
||||
93
include/QxSerialize/QJson/QxSerializeQJson_IxParameter.h
Normal file
93
include/QxSerialize/QJson/QxSerializeQJson_IxParameter.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_NETWORK
|
||||
#ifndef _QX_SERIALIZE_QJSON_IX_PARAMETER_H_
|
||||
#define _QX_SERIALIZE_QJSON_IX_PARAMETER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_IxParameter.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::service::IxParameter
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxService/IxParameter.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::service::IxParameter>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::service::IxParameter &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(t);
|
||||
Q_UNUSED(format);
|
||||
return QJsonValue();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::service::IxParameter>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::service::IxParameter &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(j);
|
||||
Q_UNUSED(t);
|
||||
Q_UNUSED(format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_IX_PARAMETER_H_
|
||||
#endif // _QX_ENABLE_QT_NETWORK
|
||||
#endif // _QX_NO_JSON
|
||||
95
include/QxSerialize/QJson/QxSerializeQJson_IxPersistable.h
Normal file
95
include/QxSerialize/QJson/QxSerializeQJson_IxPersistable.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_IX_PERSISTABLE_H_
|
||||
#define _QX_SERIALIZE_QJSON_IX_PERSISTABLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_IxPersistable.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::IxPersistable
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxDao/IxPersistable.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::IxPersistable>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::IxPersistable &t, const QString &format)
|
||||
{
|
||||
QJsonParseError err;
|
||||
QString json = t.toJson(format);
|
||||
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8(), (&err));
|
||||
if (err.error != QJsonParseError::NoError)
|
||||
{
|
||||
return QJsonValue();
|
||||
}
|
||||
return (doc.isArray() ? QJsonValue(doc.array()) : QJsonValue(doc.object()));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::IxPersistable>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::IxPersistable &t, const QString &format)
|
||||
{
|
||||
QJsonDocument doc = (j.isArray() ? QJsonDocument(j.toArray()) : QJsonDocument(j.toObject()));
|
||||
QString json = QString::fromUtf8(doc.toJson());
|
||||
return t.fromJson(json, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_IX_PERSISTABLE_H_
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_IxService.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_IxService.h
Normal 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_NETWORK
|
||||
#ifndef _QX_SERIALIZE_QJSON_IX_SERVICE_H_
|
||||
#define _QX_SERIALIZE_QJSON_IX_SERVICE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_IxService.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::service::IxService
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxService/IxService.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::service::IxService>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::service::IxService &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::service::IxService>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::service::IxService &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_IX_SERVICE_H_
|
||||
#endif // _QX_ENABLE_QT_NETWORK
|
||||
#endif // _QX_NO_JSON
|
||||
86
include/QxSerialize/QJson/QxSerializeQJson_IxSqlElement.h
Normal file
86
include/QxSerialize/QJson/QxSerializeQJson_IxSqlElement.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_IX_SQL_ELEMENT_H_
|
||||
#define _QX_SERIALIZE_QJSON_IX_SQL_ELEMENT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_IxSqlElement.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::dao::detail::IxSqlElement
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxDao/QxSqlElement/IxSqlElement.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::dao::detail::IxSqlElement>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::dao::detail::IxSqlElement &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::dao::detail::IxSqlElement>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::dao::detail::IxSqlElement &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_IX_SQL_ELEMENT_H_
|
||||
#endif // _QX_NO_JSON
|
||||
91
include/QxSerialize/QJson/QxSerializeQJson_QBrush.h
Normal file
91
include/QxSerialize/QJson/QxSerializeQJson_QBrush.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QBRUSH_H_
|
||||
#define _QX_SERIALIZE_QJSON_QBRUSH_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QBrush.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QBrush
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QtGui/qbrush.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QBrush &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QBrush &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QBrush>
|
||||
{
|
||||
static inline QJsonValue toJson(const QBrush &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QBrush>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QBrush &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QBRUSH_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
91
include/QxSerialize/QJson/QxSerializeQJson_QColor.h
Normal file
91
include/QxSerialize/QJson/QxSerializeQJson_QColor.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QCOLOR_H_
|
||||
#define _QX_SERIALIZE_QJSON_QCOLOR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QColor.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QColor
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QtGui/qcolor.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QColor &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QColor &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QColor>
|
||||
{
|
||||
static inline QJsonValue toJson(const QColor &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QColor>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QColor &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QCOLOR_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QFlags.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QFlags.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QFLAGS_H_
|
||||
#define _QX_SERIALIZE_QJSON_QFLAGS_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QFlags.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QFlags<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<QFlags<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QFlags<T> &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
return QJsonValue(static_cast<int>(t));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<QFlags<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QFlags<T> &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
t = QFlags<T>(QFlag(qRound(j.toDouble())));
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QFLAGS_H_
|
||||
#endif // _QX_NO_JSON
|
||||
91
include/QxSerialize/QJson/QxSerializeQJson_QFont.h
Normal file
91
include/QxSerialize/QJson/QxSerializeQJson_QFont.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QFONT_H_
|
||||
#define _QX_SERIALIZE_QJSON_QFONT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QFont.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QFont
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QtGui/qfont.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QFont &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QFont &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QFont>
|
||||
{
|
||||
static inline QJsonValue toJson(const QFont &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QFont>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QFont &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QFONT_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
282
include/QxSerialize/QJson/QxSerializeQJson_QHash.h
Normal file
282
include/QxSerialize/QJson/QxSerializeQJson_QHash.h
Normal file
@@ -0,0 +1,282 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QHASH_H_
|
||||
#define _QX_SERIALIZE_QJSON_QHASH_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QHash.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QHash<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<QHash<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QHash<Key, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
QHashIterator<Key, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr.key(), format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<QHash<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QHash<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
t.reserve(arr.count());
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<QHash<QString, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QHash<QString, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
QHashIterator<QString, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert(itr.key(), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<QHash<QString, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QHash<QString, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(obj.count());
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<QHash<std::string, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QHash<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
QHashIterator<std::string, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
QString key = QString::fromStdString(itr.key());
|
||||
#else // QT_NO_STL
|
||||
std::string s = itr.key();
|
||||
QString key = QString::fromLatin1(s.data(), int(s.size()));
|
||||
#endif // QT_NO_STL
|
||||
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert(key, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<QHash<std::string, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QHash<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(obj.count());
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
std::string s = key.toStdString();
|
||||
#else // QT_NO_STL
|
||||
std::string s = key.toLatin1().constData();
|
||||
#endif // QT_NO_STL
|
||||
|
||||
t.insert(s, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<QHash<std::wstring, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QHash<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
QHashIterator<std::wstring, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert(QString::fromStdWString(itr.key()), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<QHash<std::wstring, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QHash<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(obj.count());
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(key.toStdWString(), value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QHASH_H_
|
||||
#endif // _QX_NO_JSON
|
||||
93
include/QxSerialize/QJson/QxSerializeQJson_QImage.h
Normal file
93
include/QxSerialize/QJson/QxSerializeQJson_QImage.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QIMAGE_H_
|
||||
#define _QX_SERIALIZE_QJSON_QIMAGE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QImage.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QImage
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qbuffer.h>
|
||||
|
||||
#include <QtGui/qimage.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QImage &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QImage &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QImage>
|
||||
{
|
||||
static inline QJsonValue toJson(const QImage &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QImage>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QImage &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QIMAGE_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
105
include/QxSerialize/QJson/QxSerializeQJson_QLinkedList.h
Normal file
105
include/QxSerialize/QJson/QxSerializeQJson_QLinkedList.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QLINKEDLIST_H_
|
||||
#define _QX_SERIALIZE_QJSON_QLINKEDLIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QLinkedList.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QLinkedList<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qlinkedlist.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<QLinkedList<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QLinkedList<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QLinkedListIterator<T> itr(t);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
arr.append(qx::cvt::to_json(itr.next(), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<QLinkedList<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QLinkedList<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.append(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QLINKEDLIST_H_
|
||||
#endif // _QX_NO_JSON
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
107
include/QxSerialize/QJson/QxSerializeQJson_QList.h
Normal file
107
include/QxSerialize/QJson/QxSerializeQJson_QList.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QLIST_H_
|
||||
#define _QX_SERIALIZE_QJSON_QLIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QList.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QList<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qlist.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<QList<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QList<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (int i = 0; i < t.count(); i++)
|
||||
{
|
||||
arr.append(qx::cvt::to_json(t.at(i), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<QList<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QList<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
||||
t.reserve(arr.count());
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.append(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QLIST_H_
|
||||
#endif // _QX_NO_JSON
|
||||
278
include/QxSerialize/QJson/QxSerializeQJson_QMap.h
Normal file
278
include/QxSerialize/QJson/QxSerializeQJson_QMap.h
Normal file
@@ -0,0 +1,278 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QMAP_H_
|
||||
#define _QX_SERIALIZE_QJSON_QMAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QMap.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QMap<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qmap.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<QMap<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QMap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
QMapIterator<Key, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr.key(), format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<QMap<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QMap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<QMap<QString, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QMap<QString, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
QMapIterator<QString, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert(itr.key(), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<QMap<QString, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QMap<QString, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<QMap<std::string, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QMap<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
QMapIterator<std::string, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
QString key = QString::fromStdString(itr.key());
|
||||
#else // QT_NO_STL
|
||||
std::string s = itr.key();
|
||||
QString key = QString::fromLatin1(s.data(), int(s.size()));
|
||||
#endif // QT_NO_STL
|
||||
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert(key, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<QMap<std::string, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QMap<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
std::string s = key.toStdString();
|
||||
#else // QT_NO_STL
|
||||
std::string s = key.toLatin1().constData();
|
||||
#endif // QT_NO_STL
|
||||
|
||||
t.insert(s, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<QMap<std::wstring, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QMap<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
QMapIterator<std::wstring, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert(QString::fromStdWString(itr.key()), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<QMap<std::wstring, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QMap<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(key.toStdWString(), value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QMAP_H_
|
||||
#endif // _QX_NO_JSON
|
||||
93
include/QxSerialize/QJson/QxSerializeQJson_QMatrix.h
Normal file
93
include/QxSerialize/QJson/QxSerializeQJson_QMatrix.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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(6, 0, 0))
|
||||
#ifndef _QX_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QMATRIX_H_
|
||||
#define _QX_SERIALIZE_QJSON_QMATRIX_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QMatrix.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QMatrix
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QtGui/qmatrix.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QMatrix &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QMatrix &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QMatrix>
|
||||
{
|
||||
static inline QJsonValue toJson(const QMatrix &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QMatrix>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QMatrix &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QMATRIX_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
125
include/QxSerialize/QJson/QxSerializeQJson_QMultiHash.h
Normal file
125
include/QxSerialize/QJson/QxSerializeQJson_QMultiHash.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QMULTIHASH_H_
|
||||
#define _QX_SERIALIZE_QJSON_QMULTIHASH_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QMultiHash.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QMultiHash<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<QMultiHash<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QMultiHash<Key, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
QHashIterator<Key, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr.key(), format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<QMultiHash<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QMultiHash<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
t.reserve(arr.count());
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QMULTIHASH_H_
|
||||
#endif // _QX_NO_JSON
|
||||
124
include/QxSerialize/QJson/QxSerializeQJson_QMultiMap.h
Normal file
124
include/QxSerialize/QJson/QxSerializeQJson_QMultiMap.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QMULTIMAP_H_
|
||||
#define _QX_SERIALIZE_QJSON_QMULTIMAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QMultiMap.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QMultiMap<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qmap.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<QMultiMap<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QMultiMap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
QMapIterator<Key, Value> itr(t);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr.key(), format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr.value(), format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<QMultiMap<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QMultiMap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QMULTIMAP_H_
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QObject.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QObject.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QOBJECT_H_
|
||||
#define _QX_SERIALIZE_QJSON_QOBJECT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QObject.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QObject (serialize dynamic properties)
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qobject.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QObject &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QObject &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QObject>
|
||||
{
|
||||
static inline QJsonValue toJson(const QObject &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QObject>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QObject &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QOBJECT_H_
|
||||
#endif // _QX_NO_JSON
|
||||
105
include/QxSerialize/QJson/QxSerializeQJson_QPair.h
Normal file
105
include/QxSerialize/QJson/QxSerializeQJson_QPair.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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(6, 0, 0))
|
||||
#ifndef _QX_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QPAIR_H_
|
||||
#define _QX_SERIALIZE_QJSON_QPAIR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QPair.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QPair<T1, T2>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qpair.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct QxConvert_ToJson<QPair<T1, T2>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QPair<T1, T2> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
arr.append(qx::cvt::to_json(t.first, format));
|
||||
arr.append(qx::cvt::to_json(t.second, format));
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct QxConvert_FromJson<QPair<T1, T2>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QPair<T1, T2> &t, const QString &format)
|
||||
{
|
||||
t = QPair<T1, T2>();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
if (arr.count() != 2)
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
T1 tmp1;
|
||||
qx::cvt::from_json(arr.at(0), tmp1, format);
|
||||
T2 tmp2;
|
||||
qx::cvt::from_json(arr.at(1), tmp2, format);
|
||||
t = qMakePair(tmp1, tmp2);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QPAIR_H_
|
||||
#endif // _QX_NO_JSON
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
93
include/QxSerialize/QJson/QxSerializeQJson_QPicture.h
Normal file
93
include/QxSerialize/QJson/QxSerializeQJson_QPicture.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QPICTURE_H_
|
||||
#define _QX_SERIALIZE_QJSON_QPICTURE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QPicture.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QPicture
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qbuffer.h>
|
||||
|
||||
#include <QtGui/qpicture.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QPicture &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QPicture &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QPicture>
|
||||
{
|
||||
static inline QJsonValue toJson(const QPicture &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QPicture>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QPicture &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QPICTURE_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
93
include/QxSerialize/QJson/QxSerializeQJson_QPixmap.h
Normal file
93
include/QxSerialize/QJson/QxSerializeQJson_QPixmap.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QPIXMAP_H_
|
||||
#define _QX_SERIALIZE_QJSON_QPIXMAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QPixmap.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QPixmap
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qbuffer.h>
|
||||
|
||||
#include <QtGui/qpixmap.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QPixmap &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QPixmap &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QPixmap>
|
||||
{
|
||||
static inline QJsonValue toJson(const QPixmap &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QPixmap>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QPixmap &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QPIXMAP_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QPoint.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QPoint.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QPOINT_H_
|
||||
#define _QX_SERIALIZE_QJSON_QPOINT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QPoint.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QPoint
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qpoint.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QPoint &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QPoint &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QPoint>
|
||||
{
|
||||
static inline QJsonValue toJson(const QPoint &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QPoint>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QPoint &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QPOINT_H_
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QRect.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QRect.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QRECT_H_
|
||||
#define _QX_SERIALIZE_QJSON_QRECT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QRect.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QRect
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qrect.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QRect &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QRect &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QRect>
|
||||
{
|
||||
static inline QJsonValue toJson(const QRect &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QRect>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QRect &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QRECT_H_
|
||||
#endif // _QX_NO_JSON
|
||||
90
include/QxSerialize/QJson/QxSerializeQJson_QRegExp.h
Normal file
90
include/QxSerialize/QJson/QxSerializeQJson_QRegExp.h
Normal 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
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#ifndef _QX_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QREGEXP_H_
|
||||
#define _QX_SERIALIZE_QJSON_QREGEXP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QRegExp.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QRegExp
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qregexp.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QRegExp &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QRegExp &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QRegExp>
|
||||
{
|
||||
static inline QJsonValue toJson(const QRegExp &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QRegExp>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QRegExp &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QREGEXP_H_
|
||||
#endif // _QX_NO_JSON
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
91
include/QxSerialize/QJson/QxSerializeQJson_QRegion.h
Normal file
91
include/QxSerialize/QJson/QxSerializeQJson_QRegion.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QJSON_QREGION_H_
|
||||
#define _QX_SERIALIZE_QJSON_QREGION_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QRegion.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QRegion
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QtGui/qregion.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QRegion &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QRegion &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QRegion>
|
||||
{
|
||||
static inline QJsonValue toJson(const QRegion &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QRegion>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QRegion &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QREGION_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_NO_JSON
|
||||
97
include/QxSerialize/QJson/QxSerializeQJson_QScopedPointer.h
Normal file
97
include/QxSerialize/QJson/QxSerializeQJson_QScopedPointer.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
|
||||
#ifndef _QX_SERIALIZE_QJSON_QSCOPEDPOINTER_H_
|
||||
#define _QX_SERIALIZE_QJSON_QSCOPEDPOINTER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QScopedPointer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QScopedPointer<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<QScopedPointer<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QScopedPointer<T> &t, const QString &format)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
return qx::cvt::to_json((*t), format);
|
||||
}
|
||||
return QJsonValue();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<QScopedPointer<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QScopedPointer<T> &t, const QString &format)
|
||||
{
|
||||
if (j.isNull())
|
||||
{
|
||||
t.reset();
|
||||
return qx_bool(true);
|
||||
}
|
||||
t.reset(new T());
|
||||
return qx::cvt::from_json(j, (*t), format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QSCOPEDPOINTER_H_
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
|
||||
#endif // _QX_NO_JSON
|
||||
95
include/QxSerialize/QJson/QxSerializeQJson_QSharedPointer.h
Normal file
95
include/QxSerialize/QJson/QxSerializeQJson_QSharedPointer.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QSHAREDPOINTER_H_
|
||||
#define _QX_SERIALIZE_QJSON_QSHAREDPOINTER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QSharedPointer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QSharedPointer<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qsharedpointer.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<QSharedPointer<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QSharedPointer<T> &t, const QString &format)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
return qx::cvt::to_json((*t), format);
|
||||
}
|
||||
return QJsonValue();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<QSharedPointer<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QSharedPointer<T> &t, const QString &format)
|
||||
{
|
||||
if (j.isNull())
|
||||
{
|
||||
t.clear();
|
||||
return qx_bool(true);
|
||||
}
|
||||
t = QSharedPointer<T>(new T());
|
||||
return qx::cvt::from_json(j, (*t), format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QSHAREDPOINTER_H_
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QSize.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QSize.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QSIZE_H_
|
||||
#define _QX_SERIALIZE_QJSON_QSIZE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QSize.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QSize
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qsize.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QSize &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QSize &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QSize>
|
||||
{
|
||||
static inline QJsonValue toJson(const QSize &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QSize>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QSize &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QSIZE_H_
|
||||
#endif // _QX_NO_JSON
|
||||
89
include/QxSerialize/QJson/QxSerializeQJson_QSqlError.h
Normal file
89
include/QxSerialize/QJson/QxSerializeQJson_QSqlError.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QSQLERROR_H_
|
||||
#define _QX_SERIALIZE_QJSON_QSQLERROR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QSqlError.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QSqlError
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QtSql/qsqlerror.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QSqlError &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QSqlError &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QSqlError>
|
||||
{
|
||||
static inline QJsonValue toJson(const QSqlError &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QSqlError>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QSqlError &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QSQLERROR_H_
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QStringList.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QStringList.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QSTRINGLIST_H_
|
||||
#define _QX_SERIALIZE_QJSON_QSTRINGLIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QStringList.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QStringList
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const QStringList &t, const QString &format) QX_USED;
|
||||
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, QStringList &t, const QString &format) QX_USED;
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QStringList>
|
||||
{
|
||||
static inline QJsonValue toJson(const QStringList &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QStringList>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QStringList &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QSTRINGLIST_H_
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QUrl.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QUrl.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QURL_H_
|
||||
#define _QX_SERIALIZE_QJSON_QURL_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QUrl.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QUrl
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qurl.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QUrl>
|
||||
{
|
||||
static inline QJsonValue toJson(const QUrl &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
return QJsonValue(t.toString());
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QUrl>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QUrl &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
t = QUrl(j.toString());
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QURL_H_
|
||||
#endif // _QX_NO_JSON
|
||||
90
include/QxSerialize/QJson/QxSerializeQJson_QVariantHash.h
Normal file
90
include/QxSerialize/QJson/QxSerializeQJson_QVariantHash.h
Normal 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_NO_JSON
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
||||
#ifndef _QX_SERIALIZE_QJSON_QVARIANTHASH_H_
|
||||
#define _QX_SERIALIZE_QJSON_QVARIANTHASH_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QVariantHash.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QVariantHash
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QVariantHash>
|
||||
{
|
||||
static inline QJsonValue toJson(const QVariantHash &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
return QJsonValue(QJsonObject::fromVariantHash(t));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QVariantHash>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QVariantHash &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
t = j.toObject().toVariantHash();
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QVARIANTHASH_H_
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QVariantMap.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QVariantMap.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QVARIANTMAP_H_
|
||||
#define _QX_SERIALIZE_QJSON_QVARIANTMAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QVariantMap.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QVariantMap
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<QVariantMap>
|
||||
{
|
||||
static inline QJsonValue toJson(const QVariantMap &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
return QJsonValue(QJsonObject::fromVariantMap(t));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<QVariantMap>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QVariantMap &t, const QString &format)
|
||||
{
|
||||
Q_UNUSED(format);
|
||||
t = j.toObject().toVariantMap();
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QVARIANTMAP_H_
|
||||
#endif // _QX_NO_JSON
|
||||
105
include/QxSerialize/QJson/QxSerializeQJson_QVector.h
Normal file
105
include/QxSerialize/QJson/QxSerializeQJson_QVector.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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(6, 0, 0))
|
||||
#ifndef _QX_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QVECTOR_H_
|
||||
#define _QX_SERIALIZE_QJSON_QVECTOR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QVector.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QVector<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/qvector.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<QVector<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QVector<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (int i = 0; i < t.count(); i++)
|
||||
{
|
||||
arr.append(qx::cvt::to_json(t.at(i), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<QVector<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QVector<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
t.reserve(arr.count());
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.append(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QVECTOR_H_
|
||||
#endif // _QX_NO_JSON
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
91
include/QxSerialize/QJson/QxSerializeQJson_QWeakPointer.h
Normal file
91
include/QxSerialize/QJson/QxSerializeQJson_QWeakPointer.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QWEAKPOINTER_H_
|
||||
#define _QX_SERIALIZE_QJSON_QWEAKPOINTER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QWeakPointer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type QWeakPointer<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
#include <QtCore/QWeakPointer>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QSharedPointer.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<QWeakPointer<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const QWeakPointer<T> &t, const QString &format)
|
||||
{
|
||||
QSharedPointer<T> ptr = t.toStrongRef();
|
||||
return qx::cvt::to_json(ptr, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<QWeakPointer<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, QWeakPointer<T> &t, const QString &format)
|
||||
{
|
||||
QSharedPointer<T> ptr;
|
||||
qx::cvt::from_json(j, ptr, format);
|
||||
t = QWeakPointer<T>(ptr);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QWEAKPOINTER_H_
|
||||
#endif // _QX_NO_JSON
|
||||
274
include/QxSerialize/QJson/QxSerializeQJson_QxCollection.h
Normal file
274
include/QxSerialize/QJson/QxSerializeQJson_QxCollection.h
Normal file
@@ -0,0 +1,274 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QX_COLLECTION_H_
|
||||
#define _QX_SERIALIZE_QJSON_QX_COLLECTION_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QxCollection.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::QxCollection<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxCollection/QxCollection.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<qx::QxCollection<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::QxCollection<Key, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
|
||||
for (long l = 0; l < t.count(); l++)
|
||||
{
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(t.getKeyByIndex(l), format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(t.getByIndex(l), format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<qx::QxCollection<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::QxCollection<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
t.reserve(static_cast<long>(arr.count()));
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<qx::QxCollection<QString, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::QxCollection<QString, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (long l = 0; l < t.count(); l++)
|
||||
{
|
||||
val = qx::cvt::to_json(t.getByIndex(l), format);
|
||||
obj.insert(t.getKeyByIndex(l), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<qx::QxCollection<QString, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::QxCollection<QString, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<long>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(key, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<qx::QxCollection<std::string, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::QxCollection<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (long l = 0; l < t.count(); l++)
|
||||
{
|
||||
#ifndef QT_NO_STL
|
||||
QString key = QString::fromStdString(t.getKeyByIndex(l));
|
||||
#else // QT_NO_STL
|
||||
std::string s = t.getKeyByIndex(l);
|
||||
QString key = QString::fromLatin1(s.data(), int(s.size()));
|
||||
#endif // QT_NO_STL
|
||||
|
||||
val = qx::cvt::to_json(t.getByIndex(l), format);
|
||||
obj.insert(key, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<qx::QxCollection<std::string, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::QxCollection<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<long>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
std::string s = key.toStdString();
|
||||
#else // QT_NO_STL
|
||||
std::string s = key.toLatin1().constData();
|
||||
#endif // QT_NO_STL
|
||||
|
||||
t.insert(s, value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<qx::QxCollection<std::wstring, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::QxCollection<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (long l = 0; l < t.count(); l++)
|
||||
{
|
||||
val = qx::cvt::to_json(t.getByIndex(l), format);
|
||||
obj.insert(QString::fromStdWString(t.getKeyByIndex(l)), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<qx::QxCollection<std::wstring, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::QxCollection<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<long>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(key.toStdWString(), value);
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QX_COLLECTION_H_
|
||||
#endif // _QX_NO_JSON
|
||||
104
include/QxSerialize/QJson/QxSerializeQJson_QxDaoPointer.h
Normal file
104
include/QxSerialize/QJson/QxSerializeQJson_QxDaoPointer.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QX_DAO_POINTER_H_
|
||||
#define _QX_SERIALIZE_QJSON_QX_DAO_POINTER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QxDaoPointer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::dao::ptr<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxDao/QxDaoPointer.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<qx::dao::ptr<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::dao::ptr<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
arr.append(qx::cvt::to_json(t.data(), format));
|
||||
arr.append(qx::cvt::to_json(t.dataOriginal(), format));
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<qx::dao::ptr<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::dao::ptr<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
if (arr.count() != 2)
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
T *ptr = NULL;
|
||||
T *original = NULL;
|
||||
qx::cvt::from_json(arr.at(0), ptr, format);
|
||||
qx::cvt::from_json(arr.at(1), original, format);
|
||||
t = qx::dao::ptr<T>(ptr, original);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QX_DAO_POINTER_H_
|
||||
#endif // _QX_NO_JSON
|
||||
86
include/QxSerialize/QJson/QxSerializeQJson_QxInvalidValue.h
Normal file
86
include/QxSerialize/QJson/QxSerializeQJson_QxInvalidValue.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QX_INVALID_VALUE_H_
|
||||
#define _QX_SERIALIZE_QJSON_QX_INVALID_VALUE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QxInvalidValue.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::QxInvalidValue
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxValidator/QxInvalidValue.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::QxInvalidValue>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::QxInvalidValue &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::QxInvalidValue>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::QxInvalidValue &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QX_INVALID_VALUE_H_
|
||||
#endif // _QX_NO_JSON
|
||||
86
include/QxSerialize/QJson/QxSerializeQJson_QxInvalidValueX.h
Normal file
86
include/QxSerialize/QJson/QxSerializeQJson_QxInvalidValueX.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QX_INVALID_VALUE_X_H_
|
||||
#define _QX_SERIALIZE_QJSON_QX_INVALID_VALUE_X_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QxInvalidValueX.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::QxInvalidValueX
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxValidator/QxInvalidValueX.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::QxInvalidValueX>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::QxInvalidValueX &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::QxInvalidValueX>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::QxInvalidValueX &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QX_INVALID_VALUE_X_H_
|
||||
#endif // _QX_NO_JSON
|
||||
86
include/QxSerialize/QJson/QxSerializeQJson_QxSqlQuery.h
Normal file
86
include/QxSerialize/QJson/QxSerializeQJson_QxSqlQuery.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QX_SQL_QUERY_H_
|
||||
#define _QX_SERIALIZE_QJSON_QX_SQL_QUERY_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QxSqlQuery.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::QxSqlQuery
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxDao/QxSqlQuery.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::QxSqlQuery>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::QxSqlQuery &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::QxSqlQuery>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::QxSqlQuery &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QX_SQL_QUERY_H_
|
||||
#endif // _QX_NO_JSON
|
||||
88
include/QxSerialize/QJson/QxSerializeQJson_QxTransaction.h
Normal file
88
include/QxSerialize/QJson/QxSerializeQJson_QxTransaction.h
Normal 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_QT_NETWORK
|
||||
#ifndef _QX_SERIALIZE_QJSON_QX_TRANSACTION_H_
|
||||
#define _QX_SERIALIZE_QJSON_QX_TRANSACTION_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_QxTransaction.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type qx::service::QxTransaction
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxService/QxTransaction.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxConvert_ToJson<qx::service::QxTransaction>
|
||||
{
|
||||
static inline QJsonValue toJson(const qx::service::QxTransaction &t, const QString &format)
|
||||
{
|
||||
return QxConvert_ToJson_Helper(t, format);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct QxConvert_FromJson<qx::service::QxTransaction>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, qx::service::QxTransaction &t, const QString &format)
|
||||
{
|
||||
return QxConvert_FromJson_Helper(j, t, format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QX_TRANSACTION_H_
|
||||
#endif // _QX_ENABLE_QT_NETWORK
|
||||
#endif // _QX_NO_JSON
|
||||
108
include/QxSerialize/QJson/QxSerializeQJson_all_include.h
Normal file
108
include/QxSerialize/QJson/QxSerializeQJson_all_include.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_ALL_INCLUDE_H_
|
||||
#define _QX_SERIALIZE_QJSON_ALL_INCLUDE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_all_include.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Include all Qt QJson serialization method (save/load) provided by QxOrm library
|
||||
*/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_boost_scoped_ptr.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_boost_shared_ptr.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_boost_tuple.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_boost_unordered_map.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_boost_unordered_set.h>
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QBrush.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QColor.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QFlags.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QFont.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QHash.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QImage.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QLinkedList.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QList.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QMap.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QMatrix.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QMultiHash.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QMultiMap.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QObject.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QPair.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QPicture.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QPixmap.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QPoint.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QRect.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QRegExp.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QRegion.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QScopedPointer.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QSharedPointer.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QSize.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QSqlError.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QStringList.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QUrl.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QVector.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QWeakPointer.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QVariantHash.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QVariantMap.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_list.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_map.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_pair.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_set.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_shared_ptr.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_tuple.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_unique_ptr.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_unordered_map.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_unordered_set.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_std_vector.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_qx_registered_class.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_IxParameter.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_IxService.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_IxSqlElement.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_IxPersistable.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QxCollection.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QxDaoPointer.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QxInvalidValue.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QxInvalidValueX.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QxSqlQuery.h>
|
||||
#include <QxSerialize/QJson/QxSerializeQJson_QxTransaction.h>
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_ALL_INCLUDE_H_
|
||||
#endif // _QX_NO_JSON
|
||||
@@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QJSON_BOOST_SCOPED_PTR_H_
|
||||
#define _QX_SERIALIZE_QJSON_BOOST_SCOPED_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_boost_scoped_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type boost::scoped_ptr<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<boost::scoped_ptr<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::scoped_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
return qx::cvt::to_json((*t), format);
|
||||
}
|
||||
return QJsonValue();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<boost::scoped_ptr<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::scoped_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (j.isNull())
|
||||
{
|
||||
t.reset();
|
||||
return qx_bool(true);
|
||||
}
|
||||
t.reset(new T());
|
||||
return qx::cvt::from_json(j, (*t), format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_BOOST_SCOPED_PTR_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
#endif // _QX_NO_JSON
|
||||
@@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QJSON_BOOST_SHARED_PTR_H_
|
||||
#define _QX_SERIALIZE_QJSON_BOOST_SHARED_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_boost_shared_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type boost::shared_ptr<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<boost::shared_ptr<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::shared_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
return qx::cvt::to_json((*t), format);
|
||||
}
|
||||
return QJsonValue();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<boost::shared_ptr<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::shared_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (j.isNull())
|
||||
{
|
||||
t.reset();
|
||||
return qx_bool(true);
|
||||
}
|
||||
t.reset(new T());
|
||||
return qx::cvt::from_json(j, (*t), format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_BOOST_SHARED_PTR_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
#endif // _QX_NO_JSON
|
||||
455
include/QxSerialize/QJson/QxSerializeQJson_boost_tuple.h
Normal file
455
include/QxSerialize/QJson/QxSerializeQJson_boost_tuple.h
Normal file
@@ -0,0 +1,455 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QJSON_BOOST_TUPLE_H_
|
||||
#define _QX_SERIALIZE_QJSON_BOOST_TUPLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_boost_tuple.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type boost::tuple<T0, T1, ..., T9>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2, T3>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2, T3> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<3>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2, T3, T4>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2, T3, T4> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<4>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2, T3, T4, T5>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2, T3, T4, T5> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<5>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2, T3, T4, T5, T6> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<6>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<6>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<7>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<6>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<7>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<8>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct QxConvert_ToJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(boost::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<6>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<7>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<8>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(boost::get<9>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2, T3>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2, T3> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), boost::get<3>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2, T3, T4>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2, T3, T4> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), boost::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), boost::get<4>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2, T3, T4, T5>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2, T3, T4, T5> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), boost::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), boost::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), boost::get<5>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2, T3, T4, T5, T6> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), boost::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), boost::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), boost::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), boost::get<6>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), boost::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), boost::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), boost::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), boost::get<6>(t), format);
|
||||
qx::cvt::from_json(arr.at(7), boost::get<7>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), boost::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), boost::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), boost::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), boost::get<6>(t), format);
|
||||
qx::cvt::from_json(arr.at(7), boost::get<7>(t), format);
|
||||
qx::cvt::from_json(arr.at(8), boost::get<8>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct QxConvert_FromJson<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), boost::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), boost::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), boost::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), boost::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), boost::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), boost::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), boost::get<6>(t), format);
|
||||
qx::cvt::from_json(arr.at(7), boost::get<7>(t), format);
|
||||
qx::cvt::from_json(arr.at(8), boost::get<8>(t), format);
|
||||
qx::cvt::from_json(arr.at(9), boost::get<9>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_BOOST_TUPLE_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
#endif // _QX_NO_JSON
|
||||
334
include/QxSerialize/QJson/QxSerializeQJson_boost_unordered_map.h
Normal file
334
include/QxSerialize/QJson/QxSerializeQJson_boost_unordered_map.h
Normal file
@@ -0,0 +1,334 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QJSON_BOOST_UNORDERED_MAP_H_
|
||||
#define _QX_SERIALIZE_QJSON_BOOST_UNORDERED_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_boost_unordered_map.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type boost::unordered_map<Key, Value> and boost::unordered_multimap<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<boost::unordered_map<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::unordered_map<Key, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename boost::unordered_map<Key, Value>::const_iterator type_itr;
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr->first, format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<boost::unordered_map<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::unordered_map<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
t.reserve(static_cast<typename boost::unordered_map<Key, Value>::size_type>(arr.count()));
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<boost::unordered_multimap<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::unordered_multimap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename boost::unordered_multimap<Key, Value>::const_iterator type_itr;
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr->first, format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<boost::unordered_multimap<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::unordered_multimap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
t.reserve(static_cast<typename boost::unordered_multimap<Key, Value>::size_type>(arr.count()));
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<boost::unordered_map<QString, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::unordered_map<QString, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename boost::unordered_map<QString, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(itr->first, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<boost::unordered_map<QString, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::unordered_map<QString, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<typename boost::unordered_map<QString, Value>::size_type>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<boost::unordered_map<std::string, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::unordered_map<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename boost::unordered_map<std::string, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
#ifndef QT_NO_STL
|
||||
QString key = QString::fromStdString(itr->first);
|
||||
#else // QT_NO_STL
|
||||
QString key = QString::fromLatin1(itr->first.data(), int(itr->first.size()));
|
||||
#endif // QT_NO_STL
|
||||
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(key, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<boost::unordered_map<std::string, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::unordered_map<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<typename boost::unordered_map<std::string, Value>::size_type>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
std::string s = key.toStdString();
|
||||
#else // QT_NO_STL
|
||||
std::string s = key.toLatin1().constData();
|
||||
#endif // QT_NO_STL
|
||||
|
||||
t.insert(std::make_pair(s, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<boost::unordered_map<std::wstring, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::unordered_map<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename boost::unordered_map<std::wstring, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(QString::fromStdWString(itr->first), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<boost::unordered_map<std::wstring, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::unordered_map<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<typename boost::unordered_map<std::wstring, Value>::size_type>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(std::make_pair(key.toStdWString(), value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_BOOST_UNORDERED_MAP_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
#endif // _QX_NO_JSON
|
||||
142
include/QxSerialize/QJson/QxSerializeQJson_boost_unordered_set.h
Normal file
142
include/QxSerialize/QJson/QxSerializeQJson_boost_unordered_set.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
#ifndef _QX_SERIALIZE_QJSON_BOOST_UNORDERED_SET_H_
|
||||
#define _QX_SERIALIZE_QJSON_BOOST_UNORDERED_SET_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_boost_unordered_set.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type boost::unordered_set<T> and boost::unordered_multiset<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<boost::unordered_set<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::unordered_set<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
typedef typename boost::unordered_set<T>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
arr.append(qx::cvt::to_json((*itr), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<boost::unordered_set<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::unordered_set<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
t.reserve(static_cast<typename boost::unordered_set<T>::size_type>(arr.count()));
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.insert(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<boost::unordered_multiset<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const boost::unordered_multiset<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
typedef typename boost::unordered_multiset<T>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
arr.append(qx::cvt::to_json((*itr), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<boost::unordered_multiset<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, boost::unordered_multiset<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
t.reserve(static_cast<typename boost::unordered_multiset<T>::size_type>(arr.count()));
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.insert(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_BOOST_UNORDERED_SET_H_
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
#endif // _QX_NO_JSON
|
||||
@@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_QX_REGISTERED_CLASS_H_
|
||||
#define _QX_SERIALIZE_QJSON_QX_REGISTERED_CLASS_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_qx_registered_class.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a generic Qt QJson serialization method (save/load) for classes registered into QxOrm context (void qx::register_class<MyClass>() function), it is possible to specialize qx::cvt::detail::QxSerializeJsonRegistered<T> template to implement your own serialization method for a specific class
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxTraits/is_qx_registered.h>
|
||||
|
||||
#include <QxRegister/IxClass.h>
|
||||
#include <QxRegister/QxClass.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct QX_DLL_EXPORT QxSerializeJsonRegistered_Helper
|
||||
{
|
||||
|
||||
static QJsonValue save(IxClass *pClass, const void *pOwner, const QString &format);
|
||||
static qx_bool load(const QJsonValue &j, IxClass *pClass, void *pOwner, const QString &format);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxSerializeJsonRegistered
|
||||
{
|
||||
|
||||
enum
|
||||
{
|
||||
is_valid = qx::trait::is_qx_registered<T>::value
|
||||
};
|
||||
|
||||
static QJsonValue save(const T &t, const QString &format)
|
||||
{
|
||||
static_assert(is_valid, "is_valid");
|
||||
return qx::cvt::detail::QxSerializeJsonRegistered_Helper::save(qx::QxClass<T>::getSingleton(), (&t), format);
|
||||
}
|
||||
|
||||
static qx_bool load(const QJsonValue &j, T &t, const QString &format)
|
||||
{
|
||||
static_assert(is_valid, "is_valid");
|
||||
return qx::cvt::detail::QxSerializeJsonRegistered_Helper::load(j, qx::QxClass<T>::getSingleton(), (&t), format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#define QX_JSON_SERIALIZE_ONLY_ID "QX_JSON_SERIALIZE_ONLY_ID"
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_QX_REGISTERED_CLASS_H_
|
||||
#endif // _QX_NO_JSON
|
||||
104
include/QxSerialize/QJson/QxSerializeQJson_std_list.h
Normal file
104
include/QxSerialize/QJson/QxSerializeQJson_std_list.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_LIST_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_LIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_list.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::list<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<std::list<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::list<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
typedef typename std::list<T>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
arr.append(qx::cvt::to_json((*itr), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<std::list<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::list<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.push_back(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_LIST_H_
|
||||
#endif // _QX_NO_JSON
|
||||
274
include/QxSerialize/QJson/QxSerializeQJson_std_map.h
Normal file
274
include/QxSerialize/QJson/QxSerializeQJson_std_map.h
Normal file
@@ -0,0 +1,274 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_MAP_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_map.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::map<Key, Value>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<std::map<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::map<Key, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::map<Key, Value>::const_iterator type_itr;
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr->first, format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<std::map<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::map<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<std::map<QString, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::map<QString, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::map<QString, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(itr->first, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<std::map<QString, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::map<QString, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<std::map<std::string, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::map<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::map<std::string, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
#ifndef QT_NO_STL
|
||||
QString key = QString::fromStdString(itr->first);
|
||||
#else // QT_NO_STL
|
||||
std::string s = itr->first;
|
||||
QString key = QString::fromLatin1(s.data(), int(s.size()));
|
||||
#endif // QT_NO_STL
|
||||
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(key, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<std::map<std::string, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::map<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
std::string s = key.toStdString();
|
||||
#else // QT_NO_STL
|
||||
std::string s = key.toLatin1().constData();
|
||||
#endif // QT_NO_STL
|
||||
|
||||
t.insert(std::make_pair(s, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<std::map<std::wstring, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::map<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::map<std::wstring, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(QString::fromStdWString(itr->first), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<std::map<std::wstring, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::map<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(std::make_pair(key.toStdWString(), value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_MAP_H_
|
||||
#endif // _QX_NO_JSON
|
||||
102
include/QxSerialize/QJson/QxSerializeQJson_std_pair.h
Normal file
102
include/QxSerialize/QJson/QxSerializeQJson_std_pair.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_PAIR_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_PAIR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_pair.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::pair<T1, T2>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct QxConvert_ToJson<std::pair<T1, T2>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::pair<T1, T2> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
arr.append(qx::cvt::to_json(t.first, format));
|
||||
arr.append(qx::cvt::to_json(t.second, format));
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct QxConvert_FromJson<std::pair<T1, T2>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::pair<T1, T2> &t, const QString &format)
|
||||
{
|
||||
t = std::pair<T1, T2>();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
if (arr.count() != 2)
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
T1 tmp1;
|
||||
qx::cvt::from_json(arr.at(0), tmp1, format);
|
||||
T2 tmp2;
|
||||
qx::cvt::from_json(arr.at(1), tmp2, format);
|
||||
t = std::make_pair(tmp1, tmp2);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_PAIR_H_
|
||||
#endif // _QX_NO_JSON
|
||||
104
include/QxSerialize/QJson/QxSerializeQJson_std_set.h
Normal file
104
include/QxSerialize/QJson/QxSerializeQJson_std_set.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_SET_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_SET_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_set.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::set<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<std::set<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::set<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
typedef typename std::set<T>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
arr.append(qx::cvt::to_json((*itr), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<std::set<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::set<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.insert(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_SET_H_
|
||||
#endif // _QX_NO_JSON
|
||||
94
include/QxSerialize/QJson/QxSerializeQJson_std_shared_ptr.h
Normal file
94
include/QxSerialize/QJson/QxSerializeQJson_std_shared_ptr.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_SHARED_PTR_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_SHARED_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_shared_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::shared_ptr<T> (C++11 compilation option _QX_CPP_11_SMART_PTR must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<std::shared_ptr<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::shared_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
return qx::cvt::to_json((*t), format);
|
||||
}
|
||||
return QJsonValue();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<std::shared_ptr<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::shared_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (j.isNull())
|
||||
{
|
||||
t.reset();
|
||||
return qx_bool(true);
|
||||
}
|
||||
t = std::make_shared<T>();
|
||||
return qx::cvt::from_json(j, (*t), format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_SHARED_PTR_H_
|
||||
#endif // _QX_NO_JSON
|
||||
453
include/QxSerialize/QJson/QxSerializeQJson_std_tuple.h
Normal file
453
include/QxSerialize/QJson/QxSerializeQJson_std_tuple.h
Normal file
@@ -0,0 +1,453 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_TUPLE_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_TUPLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_tuple.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::tuple<T0, T1, ..., T9> (C++11 compilation option _QX_CPP_11_TUPLE must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2, T3>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2, T3> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<3>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2, T3, T4>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2, T3, T4> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<4>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2, T3, T4, T5>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2, T3, T4, T5> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<5>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2, T3, T4, T5, T6>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2, T3, T4, T5, T6> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<6>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2, T3, T4, T5, T6, T7>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<6>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<7>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<6>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<7>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<8>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct QxConvert_ToJson<std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
val = qx::cvt::to_json(std::get<0>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<1>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<2>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<3>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<4>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<5>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<6>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<7>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<8>(t), format);
|
||||
arr.append(val);
|
||||
val = qx::cvt::to_json(std::get<9>(t), format);
|
||||
arr.append(val);
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2, T3>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2, T3> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), std::get<3>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2, T3, T4>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2, T3, T4> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), std::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), std::get<4>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2, T3, T4, T5>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2, T3, T4, T5> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), std::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), std::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), std::get<5>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2, T3, T4, T5, T6>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2, T3, T4, T5, T6> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), std::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), std::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), std::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), std::get<6>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2, T3, T4, T5, T6, T7>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), std::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), std::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), std::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), std::get<6>(t), format);
|
||||
qx::cvt::from_json(arr.at(7), std::get<7>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), std::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), std::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), std::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), std::get<6>(t), format);
|
||||
qx::cvt::from_json(arr.at(7), std::get<7>(t), format);
|
||||
qx::cvt::from_json(arr.at(8), std::get<8>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct QxConvert_FromJson<std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t, const QString &format)
|
||||
{
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
qx::cvt::from_json(arr.at(0), std::get<0>(t), format);
|
||||
qx::cvt::from_json(arr.at(1), std::get<1>(t), format);
|
||||
qx::cvt::from_json(arr.at(2), std::get<2>(t), format);
|
||||
qx::cvt::from_json(arr.at(3), std::get<3>(t), format);
|
||||
qx::cvt::from_json(arr.at(4), std::get<4>(t), format);
|
||||
qx::cvt::from_json(arr.at(5), std::get<5>(t), format);
|
||||
qx::cvt::from_json(arr.at(6), std::get<6>(t), format);
|
||||
qx::cvt::from_json(arr.at(7), std::get<7>(t), format);
|
||||
qx::cvt::from_json(arr.at(8), std::get<8>(t), format);
|
||||
qx::cvt::from_json(arr.at(9), std::get<9>(t), format);
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_TUPLE_H_
|
||||
#endif // _QX_NO_JSON
|
||||
94
include/QxSerialize/QJson/QxSerializeQJson_std_unique_ptr.h
Normal file
94
include/QxSerialize/QJson/QxSerializeQJson_std_unique_ptr.h
Normal 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_UNIQUE_PTR_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_UNIQUE_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_unique_ptr.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::unique_ptr<T> (C++11 compilation option _QX_CPP_11_SMART_PTR must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<std::unique_ptr<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unique_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
return qx::cvt::to_json((*t), format);
|
||||
}
|
||||
return QJsonValue();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<std::unique_ptr<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unique_ptr<T> &t, const QString &format)
|
||||
{
|
||||
if (j.isNull())
|
||||
{
|
||||
t.reset();
|
||||
return qx_bool(true);
|
||||
}
|
||||
t.reset(new T());
|
||||
return qx::cvt::from_json(j, (*t), format);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_UNIQUE_PTR_H_
|
||||
#endif // _QX_NO_JSON
|
||||
334
include/QxSerialize/QJson/QxSerializeQJson_std_unordered_map.h
Normal file
334
include/QxSerialize/QJson/QxSerializeQJson_std_unordered_map.h
Normal file
@@ -0,0 +1,334 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_UNORDERED_MAP_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_UNORDERED_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_unordered_map.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::unordered_map<Key, Value> and std::unordered_multimap<Key, Value> (C++11 compilation option _QX_CPP_11_CONTAINER must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<std::unordered_map<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unordered_map<Key, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::unordered_map<Key, Value>::const_iterator type_itr;
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr->first, format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<std::unordered_map<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unordered_map<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
t.reserve(static_cast<typename std::unordered_map<Key, Value>::size_type>(arr.count()));
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_ToJson<std::unordered_multimap<Key, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unordered_multimap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::unordered_multimap<Key, Value>::const_iterator type_itr;
|
||||
QJsonArray arr;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
QJsonObject obj;
|
||||
val = qx::cvt::to_json(itr->first, format);
|
||||
obj.insert("key", val);
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert("value", val);
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct QxConvert_FromJson<std::unordered_multimap<Key, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unordered_multimap<Key, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
QJsonValue val;
|
||||
QJsonObject obj;
|
||||
t.reserve(static_cast<typename std::unordered_multimap<Key, Value>::size_type>(arr.count()));
|
||||
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
val = arr.at(i);
|
||||
if (!val.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = val.toObject();
|
||||
Key key;
|
||||
Value value;
|
||||
qx::cvt::from_json(obj.value("key"), key, format);
|
||||
qx::cvt::from_json(obj.value("value"), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<std::unordered_map<QString, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unordered_map<QString, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::unordered_map<QString, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(itr->first, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<std::unordered_map<QString, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unordered_map<QString, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<typename std::unordered_map<QString, Value>::size_type>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<std::unordered_map<std::string, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unordered_map<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::unordered_map<std::string, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
#ifndef QT_NO_STL
|
||||
QString key = QString::fromStdString(itr->first);
|
||||
#else // QT_NO_STL
|
||||
QString key = QString::fromLatin1(itr->first.data(), int(itr->first.size()));
|
||||
#endif // QT_NO_STL
|
||||
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(key, val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<std::unordered_map<std::string, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unordered_map<std::string, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<typename std::unordered_map<std::string, Value>::size_type>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
std::string s = key.toStdString();
|
||||
#else // QT_NO_STL
|
||||
std::string s = key.toLatin1().constData();
|
||||
#endif // QT_NO_STL
|
||||
|
||||
t.insert(std::make_pair(s, value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#if ((!defined(QT_NO_STL)) && (!defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_ToJson<std::unordered_map<std::wstring, Value>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unordered_map<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
typedef typename std::unordered_map<std::wstring, Value>::const_iterator type_itr;
|
||||
QJsonObject obj;
|
||||
QJsonValue val;
|
||||
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
val = qx::cvt::to_json(itr->second, format);
|
||||
obj.insert(QString::fromStdWString(itr->first), val);
|
||||
}
|
||||
|
||||
return QJsonValue(obj);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Value>
|
||||
struct QxConvert_FromJson<std::unordered_map<std::wstring, Value>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unordered_map<std::wstring, Value> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isObject())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonObject obj = j.toObject();
|
||||
QJsonValue val;
|
||||
t.reserve(static_cast<typename std::unordered_map<std::wstring, Value>::size_type>(obj.count()));
|
||||
|
||||
for (QJsonObject::const_iterator itr = obj.constBegin(); itr != obj.constEnd(); ++itr)
|
||||
{
|
||||
QString key = itr.key();
|
||||
Value value;
|
||||
qx::cvt::from_json(itr.value(), value, format);
|
||||
t.insert(std::make_pair(key.toStdWString(), value));
|
||||
}
|
||||
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_UNORDERED_MAP_H_
|
||||
#endif // _QX_NO_JSON
|
||||
142
include/QxSerialize/QJson/QxSerializeQJson_std_unordered_set.h
Normal file
142
include/QxSerialize/QJson/QxSerializeQJson_std_unordered_set.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_UNORDERED_SET_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_UNORDERED_SET_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_unordered_set.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::unordered_set<T> and std::unordered_multiset<T> (C++11 compilation option _QX_CPP_11_CONTAINER must be defined)
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<std::unordered_set<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unordered_set<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
typedef typename std::unordered_set<T>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
arr.append(qx::cvt::to_json((*itr), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<std::unordered_set<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unordered_set<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
t.reserve(static_cast<typename std::unordered_set<T>::size_type>(arr.count()));
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.insert(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<std::unordered_multiset<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::unordered_multiset<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
typedef typename std::unordered_multiset<T>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
arr.append(qx::cvt::to_json((*itr), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<std::unordered_multiset<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::unordered_multiset<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
t.reserve(static_cast<typename std::unordered_multiset<T>::size_type>(arr.count()));
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.insert(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_UNORDERED_SET_H_
|
||||
#endif // _QX_NO_JSON
|
||||
105
include/QxSerialize/QJson/QxSerializeQJson_std_vector.h
Normal file
105
include/QxSerialize/QJson/QxSerializeQJson_std_vector.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_NO_JSON
|
||||
#ifndef _QX_SERIALIZE_QJSON_STD_VECTOR_H_
|
||||
#define _QX_SERIALIZE_QJSON_STD_VECTOR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSerializeQJson_std_vector.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxSerialize
|
||||
* \brief Provide a Qt QJson serialization method (save/load) for type std::vector<T>
|
||||
*/
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtCore/qjsonarray.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
#include <QxConvert/QxConvert_Impl.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace cvt
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_ToJson<std::vector<T>>
|
||||
{
|
||||
static inline QJsonValue toJson(const std::vector<T> &t, const QString &format)
|
||||
{
|
||||
QJsonArray arr;
|
||||
typedef typename std::vector<T>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
arr.append(qx::cvt::to_json((*itr), format));
|
||||
}
|
||||
return QJsonValue(arr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QxConvert_FromJson<std::vector<T>>
|
||||
{
|
||||
static inline qx_bool fromJson(const QJsonValue &j, std::vector<T> &t, const QString &format)
|
||||
{
|
||||
t.clear();
|
||||
if (!j.isArray())
|
||||
{
|
||||
return qx_bool(true);
|
||||
}
|
||||
QJsonArray arr = j.toArray();
|
||||
t.reserve(static_cast<typename std::vector<T>::size_type>(arr.count()));
|
||||
for (int i = 0; i < arr.count(); i++)
|
||||
{
|
||||
T tmp;
|
||||
qx::cvt::from_json(arr.at(i), tmp, format);
|
||||
t.push_back(tmp);
|
||||
}
|
||||
return qx_bool(true);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace cvt
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SERIALIZE_QJSON_STD_VECTOR_H_
|
||||
#endif // _QX_NO_JSON
|
||||
59
include/QxSerialize/Qt/QxSerialize_QBrush.h
Normal file
59
include/QxSerialize/Qt/QxSerialize_QBrush.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QBRUSH_H_
|
||||
#define _QX_SERIALIZE_QBRUSH_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtGui/qbrush.h>
|
||||
|
||||
#include <QxSerialize/Qt/QxSerialize_QColor.h>
|
||||
#include <QxSerialize/Qt/QxSerialize_QPixmap.h>
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
QX_CLASS_VERSION(QBrush, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QBrush)
|
||||
|
||||
#endif // _QX_SERIALIZE_QBRUSH_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
56
include/QxSerialize/Qt/QxSerialize_QByteArray.h
Normal file
56
include/QxSerialize/Qt/QxSerialize_QByteArray.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QBYTEARRAY_H_
|
||||
#define _QX_SERIALIZE_QBYTEARRAY_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <QtCore/qbytearray.h>
|
||||
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
QX_CLASS_VERSION(QByteArray, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QByteArray)
|
||||
|
||||
#endif // _QX_SERIALIZE_QBYTEARRAY_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
57
include/QxSerialize/Qt/QxSerialize_QColor.h
Normal file
57
include/QxSerialize/Qt/QxSerialize_QColor.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QCOLOR_H_
|
||||
#define _QX_SERIALIZE_QCOLOR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtGui/qcolor.h>
|
||||
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
QX_CLASS_VERSION(QColor, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QColor)
|
||||
|
||||
#endif // _QX_SERIALIZE_QCOLOR_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
58
include/QxSerialize/Qt/QxSerialize_QDate.h
Normal file
58
include/QxSerialize/Qt/QxSerialize_QDate.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QDATE_H_
|
||||
#define _QX_SERIALIZE_QDATE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtCore/qdatetime.h>
|
||||
|
||||
#include <QxSerialize/Qt/QxSerialize_QString.h>
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
#define QX_SERIALIZE_QDATE_FORMAT "yyyyMMdd"
|
||||
|
||||
QX_CLASS_VERSION(QDate, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QDate)
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATE_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
58
include/QxSerialize/Qt/QxSerialize_QDateTime.h
Normal file
58
include/QxSerialize/Qt/QxSerialize_QDateTime.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QDATETIME_H_
|
||||
#define _QX_SERIALIZE_QDATETIME_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtCore/qdatetime.h>
|
||||
|
||||
#include <QxSerialize/Qt/QxSerialize_QString.h>
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
#define QX_SERIALIZE_QDATETIME_FORMAT "yyyyMMddhhmmsszzz"
|
||||
|
||||
QX_CLASS_VERSION(QDateTime, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QDateTime)
|
||||
|
||||
#endif // _QX_SERIALIZE_QDATETIME_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
78
include/QxSerialize/Qt/QxSerialize_QFlags.h
Normal file
78
include/QxSerialize/Qt/QxSerialize_QFlags.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QFLAGS_H_
|
||||
#define _QX_SERIALIZE_QFLAGS_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void save(Archive &ar, const QFlags<T> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
int iValue = static_cast<int>(t);
|
||||
ar << boost::serialization::make_nvp("value", iValue);
|
||||
}
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void load(Archive &ar, QFlags<T> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
int iValue = 0;
|
||||
ar >> boost::serialization::make_nvp("value", iValue);
|
||||
t = QFlags<T>(QFlag(iValue));
|
||||
}
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void serialize(Archive &ar, QFlags<T> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QFLAGS_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
58
include/QxSerialize/Qt/QxSerialize_QFont.h
Normal file
58
include/QxSerialize/Qt/QxSerialize_QFont.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QFONT_H_
|
||||
#define _QX_SERIALIZE_QFONT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtGui/qfont.h>
|
||||
|
||||
#include <QxSerialize/Qt/QxSerialize_QString.h>
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
QX_CLASS_VERSION(QFont, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QFont)
|
||||
|
||||
#endif // _QX_SERIALIZE_QFONT_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
96
include/QxSerialize/Qt/QxSerialize_QHash.h
Normal file
96
include/QxSerialize/Qt/QxSerialize_QHash.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QHASH_H_
|
||||
#define _QX_SERIALIZE_QHASH_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void save(Archive &ar, const QHash<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = t.count();
|
||||
ar << boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
QHashIterator<Key, Value> itr(t);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
std::pair<Key, Value> pair_key_value = std::make_pair(itr.key(), itr.value());
|
||||
ar << boost::serialization::make_nvp("item", pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void load(Archive &ar, QHash<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = 0;
|
||||
ar >> boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
t.clear();
|
||||
t.reserve(lCount);
|
||||
std::pair<Key, Value> pair_key_value;
|
||||
|
||||
for (long l = 0; l < lCount; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", pair_key_value);
|
||||
t.insert(pair_key_value.first, pair_key_value.second);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void serialize(Archive &ar, QHash<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QHASH_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
62
include/QxSerialize/Qt/QxSerialize_QImage.h
Normal file
62
include/QxSerialize/Qt/QxSerialize_QImage.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QIMAGE_H_
|
||||
#define _QX_SERIALIZE_QIMAGE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtGui/qimage.h>
|
||||
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qbuffer.h>
|
||||
|
||||
#include <QxSerialize/Qt/QxSerialize_QByteArray.h>
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
QX_CLASS_VERSION(QImage, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QImage)
|
||||
QX_BOOST_EXPORT_SERIALIZATION_FAST_COMPIL_HPP(QImage)
|
||||
|
||||
#endif // _QX_SERIALIZE_QIMAGE_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
92
include/QxSerialize/Qt/QxSerialize_QLinkedList.h
Normal file
92
include/QxSerialize/Qt/QxSerialize_QLinkedList.h
Normal 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))
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QLINKEDLIST_H_
|
||||
#define _QX_SERIALIZE_QLINKEDLIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtCore/qlinkedlist.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void save(Archive &ar, const QLinkedList<T> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = t.count();
|
||||
ar << boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
QLinkedListIterator<T> itr(t);
|
||||
while (itr.hasNext())
|
||||
ar << boost::serialization::make_nvp("item", itr.next());
|
||||
}
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void load(Archive &ar, QLinkedList<T> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = 0;
|
||||
ar >> boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
t.clear();
|
||||
T item;
|
||||
|
||||
for (long l = 0; l < lCount; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", item);
|
||||
t.append(item);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void serialize(Archive &ar, QLinkedList<T> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QLINKEDLIST_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
89
include/QxSerialize/Qt/QxSerialize_QList.h
Normal file
89
include/QxSerialize/Qt/QxSerialize_QList.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QLIST_H_
|
||||
#define _QX_SERIALIZE_QLIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtCore/qlist.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void save(Archive &ar, const QList<T> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = t.count();
|
||||
ar << boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
for (long l = 0; l < lCount; l++)
|
||||
ar << boost::serialization::make_nvp("item", t.at(l));
|
||||
}
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void load(Archive &ar, QList<T> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = 0;
|
||||
ar >> boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
t.clear();
|
||||
T item;
|
||||
|
||||
for (long l = 0; l < lCount; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", item);
|
||||
t.append(item);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename T>
|
||||
inline void serialize(Archive &ar, QList<T> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QLIST_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
95
include/QxSerialize/Qt/QxSerialize_QMap.h
Normal file
95
include/QxSerialize/Qt/QxSerialize_QMap.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QMAP_H_
|
||||
#define _QX_SERIALIZE_QMAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
#include <QtCore/qmap.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void save(Archive &ar, const QMap<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = t.count();
|
||||
ar << boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
QMapIterator<Key, Value> itr(t);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
std::pair<Key, Value> pair_key_value = std::make_pair(itr.key(), itr.value());
|
||||
ar << boost::serialization::make_nvp("item", pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void load(Archive &ar, QMap<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = 0;
|
||||
ar >> boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
t.clear();
|
||||
std::pair<Key, Value> pair_key_value;
|
||||
|
||||
for (long l = 0; l < lCount; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", pair_key_value);
|
||||
t.insert(pair_key_value.first, pair_key_value.second);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void serialize(Archive &ar, QMap<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QMAP_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
59
include/QxSerialize/Qt/QxSerialize_QMatrix.h
Normal file
59
include/QxSerialize/Qt/QxSerialize_QMatrix.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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(6, 0, 0))
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
#ifndef _QX_SERIALIZE_QMATRIX_H_
|
||||
#define _QX_SERIALIZE_QMATRIX_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtGui/qmatrix.h>
|
||||
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
QX_CLASS_VERSION(QMatrix, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QMatrix)
|
||||
|
||||
#endif // _QX_SERIALIZE_QMATRIX_H_
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
96
include/QxSerialize/Qt/QxSerialize_QMultiHash.h
Normal file
96
include/QxSerialize/Qt/QxSerialize_QMultiHash.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QMULTIHASH_H_
|
||||
#define _QX_SERIALIZE_QMULTIHASH_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void save(Archive &ar, const QMultiHash<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = t.count();
|
||||
ar << boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
QHashIterator<Key, Value> itr(t);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
std::pair<Key, Value> pair_key_value = std::make_pair(itr.key(), itr.value());
|
||||
ar << boost::serialization::make_nvp("item", pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void load(Archive &ar, QMultiHash<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = 0;
|
||||
ar >> boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
t.clear();
|
||||
t.reserve(lCount);
|
||||
std::pair<Key, Value> pair_key_value;
|
||||
|
||||
for (long l = 0; l < lCount; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", pair_key_value);
|
||||
t.insert(pair_key_value.first, pair_key_value.second);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void serialize(Archive &ar, QMultiHash<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QMULTIHASH_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
95
include/QxSerialize/Qt/QxSerialize_QMultiMap.h
Normal file
95
include/QxSerialize/Qt/QxSerialize_QMultiMap.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QMULTIMAP_H_
|
||||
#define _QX_SERIALIZE_QMULTIMAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
#include <QtCore/qmap.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void save(Archive &ar, const QMultiMap<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = t.count();
|
||||
ar << boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
QMapIterator<Key, Value> itr(t);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
std::pair<Key, Value> pair_key_value = std::make_pair(itr.key(), itr.value());
|
||||
ar << boost::serialization::make_nvp("item", pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void load(Archive &ar, QMultiMap<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
long lCount = 0;
|
||||
ar >> boost::serialization::make_nvp("count", lCount);
|
||||
|
||||
t.clear();
|
||||
std::pair<Key, Value> pair_key_value;
|
||||
|
||||
for (long l = 0; l < lCount; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", pair_key_value);
|
||||
t.insert(pair_key_value.first, pair_key_value.second);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename Key, typename Value>
|
||||
inline void serialize(Archive &ar, QMultiMap<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QMULTIMAP_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
59
include/QxSerialize/Qt/QxSerialize_QObject.h
Normal file
59
include/QxSerialize/Qt/QxSerialize_QObject.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QOBJECT_H_
|
||||
#define _QX_SERIALIZE_QOBJECT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
#include <QtCore/qobject.h>
|
||||
|
||||
#include <QxSerialize/Qt/QxSerialize_QVariant.h>
|
||||
#include <QxSerialize/QxSerializeFastCompil.h>
|
||||
|
||||
#include <QxRegister/QxVersion.h>
|
||||
|
||||
QX_CLASS_VERSION(QObject, 0)
|
||||
|
||||
QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, QObject)
|
||||
QX_BOOST_EXPORT_SERIALIZATION_FAST_COMPIL_HPP(QObject)
|
||||
QX_REGISTER_BOOST_SERIALIZE_HELPER(QObject)
|
||||
|
||||
#endif // _QX_SERIALIZE_QOBJECT_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
63
include/QxSerialize/Qt/QxSerialize_QPair.h
Normal file
63
include/QxSerialize/Qt/QxSerialize_QPair.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_QPAIR_H_
|
||||
#define _QX_SERIALIZE_QPAIR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include <QtCore/qpair.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename T1, typename T2>
|
||||
inline void serialize(Archive &ar, QPair<T1, T2> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("first", t.first);
|
||||
ar &boost::serialization::make_nvp("second", t.second);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_QPAIR_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user