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_
|
||||
Reference in New Issue
Block a user