first commit

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

View File

@@ -0,0 +1,82 @@
/****************************************************************************
**
** 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 _IX_SINGLETON_H_
#define _IX_SINGLETON_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file IxSingleton.h
* \author XDL Team
* \ingroup QxSingleton
* \brief Common interface for all singleton of QxOrm library
*/
namespace qx
{
class QxSingletonX;
/*!
* \ingroup QxSingleton
* \brief qx::IxSingleton : common interface for all singleton of QxOrm library
*/
class QX_DLL_EXPORT IxSingleton
{
friend class QxSingletonX;
protected:
QString m_sKeySingleton; //!< Singleton key used by 'QxSingletonX' container
protected:
IxSingleton(const QString &sKey);
virtual ~IxSingleton();
virtual void deleteInstance() = 0;
static void initQxSingletonX();
private:
IxSingleton(const IxSingleton &other) { Q_UNUSED(other); }
IxSingleton &operator=(const IxSingleton &other)
{
Q_UNUSED(other);
return (*this);
}
};
} // namespace qx
#endif // _IX_SINGLETON_H_

View File

@@ -0,0 +1,84 @@
/****************************************************************************
**
** 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_SINGLETON_H_
#define _QX_SINGLETON_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSingleton.h
* \author XDL Team
* \ingroup QxSingleton
* \brief Concrete class to define a thread-safe singleton of QxOrm library
*/
#include <QtCore/qmutex.h>
#include <QtCore/qcoreapplication.h>
#include <QxSingleton/IxSingleton.h>
namespace qx
{
/*!
* \ingroup QxSingleton
* \brief qx::QxSingleton<T> : concrete class to define a thread-safe singleton of type T
*/
template <class T>
class QxSingleton : public IxSingleton
{
private:
static T *m_pSingleton; //!< Singleton -> only 1 instance allowed
static QMutex m_oMutexSingleton; //!< Mutex -> 'QxSingleton' is thread-safe
protected:
QxSingleton(const QString &sKey) : IxSingleton(sKey) { ; }
virtual ~QxSingleton() { ; }
public:
static T *getSingleton();
static void deleteSingleton();
protected:
static bool isSingletonNull() { return (m_pSingleton == NULL); }
virtual void deleteInstance() { QxSingleton<T>::deleteSingleton(); }
};
} // namespace qx
#include "../../inl/QxSingleton/QxSingleton.inl"
#endif // _QX_SINGLETON_H_

View File

@@ -0,0 +1,79 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SINGLETON_INIT_H_
#define _QX_SINGLETON_INIT_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSingletonInit.h
* \author XDL Team
* \ingroup QxSingleton
* \brief Initialize some singletons hosted by QxOrm shared library
*/
#include <QxSingleton/QxSingleton.h>
#include <QxRegister/QxClass.h>
#include <QxDataMember/QxDataMemberX.h>
#ifdef _QX_ENABLE_QT_NETWORK
#include <QxService/IxParameter.h>
#include <QxService/IxService.h>
#include <QxService/QxTransaction.h>
#endif // _QX_ENABLE_QT_NETWORK
#include <QxTraits/get_base_class.h>
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxClass<qx::trait::no_base_class_defined>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxDataMemberX<qx::trait::no_base_class_defined>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxClass<QObject>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxDataMemberX<QObject>)
#ifdef _QX_ENABLE_QT_NETWORK
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxClass<qx::service::IxParameter>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxDataMemberX<qx::service::IxParameter>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxClass<qx::service::IxService>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxDataMemberX<qx::service::IxService>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxClass<qx::service::QxTransaction>)
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxDataMemberX<qx::service::QxTransaction>)
#endif // _QX_ENABLE_QT_NETWORK
#endif // _QX_SINGLETON_INIT_H_

View File

@@ -0,0 +1,83 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SINGLETON_X_H_
#define _QX_SINGLETON_X_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSingletonX.h
* \author XDL Team
* \ingroup QxSingleton
* \brief List of all singleton defined by QxOrm library
*/
#include <QtCore/qhash.h>
#include <QxSingleton/QxSingleton.h>
#include <QxCollection/QxForeach.h>
namespace qx
{
/*!
* \ingroup QxSingleton
* \brief qx::QxSingletonX : list of all singleton defined by QxOrm library (this container is also a singleton)
*/
class QX_DLL_EXPORT QxSingletonX : public QxSingleton<QxSingletonX>
{
friend class QxSingleton<QxSingletonX>;
friend class IxSingleton;
private:
static QHash<QString, IxSingleton *> &getMapSingletonX(); //!< Collection of all 'IxSingleton' pointer
static QMutex *getMutexSingletonX(); //!< Mutex -> 'QxSingletonX' is thread-safe
static bool &getOnClearSingletonX(); //!< Clear collection of 'IxSingleton' in event
private:
QxSingletonX();
virtual ~QxSingletonX() { ; }
static bool addSingleton(const QString &sKey, IxSingleton *pSingleton);
static bool removeSingleton(const QString &sKey);
static void deleteAllSingleton();
};
} // namespace qx
QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::QxSingletonX)
#endif // _QX_SINGLETON_X_H_