first commit
This commit is contained in:
66
test/qxDllSample/dll1/include/CPerson.h
Normal file
66
test/qxDllSample/dll1/include/CPerson.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#ifndef _QX_CLASS_PERSON_H_
|
||||
#define _QX_CLASS_PERSON_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef _QX_NO_PRECOMPILED_HEADER
|
||||
#ifndef Q_MOC_RUN
|
||||
#include "../include/precompiled.h" // Need to include precompiled header for the generated moc file
|
||||
#endif // Q_MOC_RUN
|
||||
#endif // _QX_NO_PRECOMPILED_HEADER
|
||||
|
||||
namespace qx {
|
||||
namespace test {
|
||||
|
||||
class QX_DLL1_EXPORT CPerson : public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
QX_REGISTER_FRIEND_CLASS(qx::test::CPerson)
|
||||
|
||||
public:
|
||||
|
||||
enum sex { male, female, unknown };
|
||||
|
||||
protected:
|
||||
|
||||
long m_lPersonId;
|
||||
QString m_sFirstName;
|
||||
QString m_sLastName;
|
||||
double m_dDouble;
|
||||
sex m_eSex;
|
||||
|
||||
public:
|
||||
|
||||
CPerson() : QObject(), m_lPersonId(0), m_sFirstName("toto"), m_dDouble(4.5678), m_eSex(unknown) { ; }
|
||||
CPerson(long lId) : QObject(), m_lPersonId(lId), m_sFirstName("toto"), m_dDouble(4.5678), m_eSex(unknown) { ; }
|
||||
virtual ~CPerson() { ; }
|
||||
|
||||
long getPersonId() const { return m_lPersonId; }
|
||||
QString getFirstName() const { return m_sFirstName; }
|
||||
QString getLastName() const { return m_sLastName; }
|
||||
double getDouble() const { return m_dDouble; }
|
||||
sex getSex() const { return m_eSex; }
|
||||
|
||||
void setPersonId(long l) { m_lPersonId = l; }
|
||||
void setFirstName(const QString & s) { m_sFirstName = s; }
|
||||
void setLastName(const QString & s) { m_sLastName = s; }
|
||||
void setDouble(double d) { m_dDouble = d; }
|
||||
void setSex(sex e) { m_eSex = e; }
|
||||
|
||||
static int testStaticFct(const QString & s);
|
||||
|
||||
private:
|
||||
|
||||
void isValid(qx::QxInvalidValueX & invalidValues);
|
||||
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace qx
|
||||
|
||||
QX_REGISTER_COMPLEX_CLASS_NAME_HPP_QX_DLL1(qx::test::CPerson, QObject, 0, qx_test_CPerson)
|
||||
|
||||
#endif // _QX_CLASS_PERSON_H_
|
||||
225
test/qxDllSample/dll1/include/QxPersistable.h
Normal file
225
test/qxDllSample/dll1/include/QxPersistable.h
Normal file
@@ -0,0 +1,225 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_PERSISTABLE_H_
|
||||
#define _QX_PERSISTABLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef _QX_NO_PRECOMPILED_HEADER
|
||||
#ifndef Q_MOC_RUN
|
||||
#include "../include/precompiled.h" // Need to include precompiled header for the generated moc file
|
||||
#endif // Q_MOC_RUN
|
||||
#endif // _QX_NO_PRECOMPILED_HEADER
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
class QxPersistable;
|
||||
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxDao_Trigger<qx::QxPersistable>;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
|
||||
/*!
|
||||
* \brief qx::QxPersistable : super base class for persistent classes with many features and methods to override (be careful, don't forget to use QX_PERSISTABLE_HPP() and QX_PERSISTABLE_CPP() macros for each derived class)
|
||||
*/
|
||||
class QX_DLL1_EXPORT QxPersistable : public QObject, public qx::IxPersistable
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
QX_REGISTER_FRIEND_CLASS(qx::QxPersistable)
|
||||
QX_PERSISTABLE_HPP(qx::QxPersistable)
|
||||
|
||||
Q_PROPERTY(long qxId READ qxGetId WRITE qxSetId)
|
||||
Q_PROPERTY(QDateTime qxDateCreation READ qxGetDateCreation WRITE qxSetDateCreation)
|
||||
Q_PROPERTY(QDateTime qxDateModification READ qxGetDateModification WRITE qxSetDateModification)
|
||||
|
||||
friend struct qx::dao::detail::QxDao_Trigger<qx::QxPersistable>;
|
||||
|
||||
protected:
|
||||
long m_qxId; //!< Id of current instance stored into database
|
||||
qx::QxDateTimeNeutral m_qxDateCreation; //!< Creation date-time automatically calculated before INSERT query
|
||||
qx::QxDateTimeNeutral m_qxDateModification; //!< Modification date-time automatically calculated before INSERT and UPDATE queries
|
||||
|
||||
public:
|
||||
QxPersistable();
|
||||
virtual ~QxPersistable();
|
||||
|
||||
long qxGetId() const;
|
||||
QDateTime qxGetDateCreation() const;
|
||||
QDateTime qxGetDateModification() const;
|
||||
|
||||
void qxSetId(long l);
|
||||
void qxSetDateCreation(const QDateTime &dt);
|
||||
void qxSetDateModification(const QDateTime &dt);
|
||||
|
||||
protected:
|
||||
// -- List of useful protected methods to override into derived class -- //
|
||||
|
||||
virtual void qxIsValid(qx::QxInvalidValueX &invalidValues);
|
||||
|
||||
virtual void qxOnBeforeInsert(qx::dao::detail::IxDao_Helper *dao);
|
||||
virtual void qxOnBeforeUpdate(qx::dao::detail::IxDao_Helper *dao);
|
||||
virtual void qxOnBeforeDelete(qx::dao::detail::IxDao_Helper *dao);
|
||||
virtual void qxOnBeforeFetch(qx::dao::detail::IxDao_Helper *dao);
|
||||
virtual void qxOnAfterInsert(qx::dao::detail::IxDao_Helper *dao);
|
||||
virtual void qxOnAfterUpdate(qx::dao::detail::IxDao_Helper *dao);
|
||||
virtual void qxOnAfterDelete(qx::dao::detail::IxDao_Helper *dao);
|
||||
virtual void qxOnAfterFetch(qx::dao::detail::IxDao_Helper *dao);
|
||||
|
||||
private:
|
||||
void qxIsValidInternal(qx::QxInvalidValueX &invalidValues);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
void qxOnBeforeInsert(qx::QxPersistable *p);
|
||||
void qxOnBeforeUpdate(qx::QxPersistable *p);
|
||||
void qxOnBeforeDelete(qx::QxPersistable *p);
|
||||
void qxOnBeforeFetch(qx::QxPersistable *p);
|
||||
void qxOnAfterInsert(qx::QxPersistable *p);
|
||||
void qxOnAfterUpdate(qx::QxPersistable *p);
|
||||
void qxOnAfterDelete(qx::QxPersistable *p);
|
||||
void qxOnAfterFetch(qx::QxPersistable *p);
|
||||
|
||||
public:
|
||||
// -- List of useful public methods available from 'qx::IxPersistable' interface (using QX_PERSISTABLE_HPP() and QX_PERSISTABLE_CPP() macros) -- //
|
||||
|
||||
/*
|
||||
virtual long qxCount(const qx::QxSqlQuery & query = qx::QxSqlQuery(), QSqlDatabase * pDatabase = NULL, const QStringList & relation = QStringList());
|
||||
virtual QSqlError qxFetchById(const QVariant & id = QVariant(), const QStringList & columns = QStringList(), const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL);
|
||||
virtual QSqlError qxFetchAll(qx::IxCollection & list, const QStringList & columns = QStringList(), const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL);
|
||||
virtual QSqlError qxFetchByQuery(const qx::QxSqlQuery & query, qx::IxCollection & list, const QStringList & columns = QStringList(), const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL);
|
||||
virtual QSqlError qxInsert(const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL, bool bUseExecBatch = false);
|
||||
virtual QSqlError qxUpdate(const qx::QxSqlQuery & query = qx::QxSqlQuery(), const QStringList & columns = QStringList(), const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL, bool bUseExecBatch = false);
|
||||
virtual QSqlError qxSave(const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL);
|
||||
virtual QSqlError qxDeleteById(const QVariant & id = QVariant(), QSqlDatabase * pDatabase = NULL, bool bUseExecBatch = false);
|
||||
virtual QSqlError qxDeleteAll(QSqlDatabase * pDatabase = NULL);
|
||||
virtual QSqlError qxDeleteByQuery(const qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL);
|
||||
virtual QSqlError qxDestroyById(const QVariant & id = QVariant(), QSqlDatabase * pDatabase = NULL, bool bUseExecBatch = false);
|
||||
virtual QSqlError qxDestroyAll(QSqlDatabase * pDatabase = NULL);
|
||||
virtual QSqlError qxDestroyByQuery(const qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL);
|
||||
virtual qx_bool qxExist(const QVariant & id = QVariant(), QSqlDatabase * pDatabase = NULL);
|
||||
virtual qx::QxInvalidValueX qxValidate(const QStringList & groups = QStringList());
|
||||
virtual qx::IxPersistableCollection_ptr qxNewPersistableCollection(bool bAsList = false) const;
|
||||
virtual qx::IxClass * qxClass() const;
|
||||
*/
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<qx::QxPersistable> QxPersistable_ptr;
|
||||
|
||||
} // namespace qx
|
||||
|
||||
QX_REGISTER_COMPLEX_CLASS_NAME_HPP_QX_DLL1(qx::QxPersistable, QObject, 0, qx_QxPersistable)
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <>
|
||||
struct QxDao_Trigger<qx::QxPersistable>
|
||||
{
|
||||
|
||||
static inline void onBeforeInsert(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnBeforeInsert(dao);
|
||||
}
|
||||
}
|
||||
static inline void onBeforeUpdate(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnBeforeUpdate(dao);
|
||||
}
|
||||
}
|
||||
static inline void onBeforeDelete(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnBeforeDelete(dao);
|
||||
}
|
||||
}
|
||||
static inline void onBeforeFetch(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnBeforeFetch(dao);
|
||||
}
|
||||
}
|
||||
static inline void onAfterInsert(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnAfterInsert(dao);
|
||||
}
|
||||
}
|
||||
static inline void onAfterUpdate(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnAfterUpdate(dao);
|
||||
}
|
||||
}
|
||||
static inline void onAfterDelete(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnAfterDelete(dao);
|
||||
}
|
||||
}
|
||||
static inline void onAfterFetch(qx::QxPersistable *t, qx::dao::detail::IxDao_Helper *dao)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->qxOnAfterFetch(dao);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_PERSISTABLE_H_
|
||||
53
test/qxDllSample/dll1/include/TestQtProperty.h
Normal file
53
test/qxDllSample/dll1/include/TestQtProperty.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef _QX_TEST_QT_META_PROPERTY_H_
|
||||
#define _QX_TEST_QT_META_PROPERTY_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef _QX_NO_PRECOMPILED_HEADER
|
||||
#ifndef Q_MOC_RUN
|
||||
#include "../include/precompiled.h" // Need to include precompiled header for the generated moc file
|
||||
#endif // Q_MOC_RUN
|
||||
#endif // _QX_NO_PRECOMPILED_HEADER
|
||||
|
||||
class QX_DLL1_EXPORT TestQtProperty : public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int id READ id WRITE setId)
|
||||
Q_PROPERTY(long number READ number WRITE setNumber)
|
||||
Q_PROPERTY(QString desc READ desc WRITE setDesc)
|
||||
Q_PROPERTY(QDateTime birthDate READ birthDate WRITE setBirthDate)
|
||||
Q_PROPERTY(QVariant photo READ photo WRITE setPhoto)
|
||||
|
||||
protected:
|
||||
|
||||
int m_id;
|
||||
long m_number;
|
||||
QString m_desc;
|
||||
QDateTime m_birthDate;
|
||||
QVariant m_photo;
|
||||
|
||||
public:
|
||||
|
||||
TestQtProperty() : QObject(), m_id(0), m_number(0) { ; }
|
||||
virtual ~TestQtProperty() { ; }
|
||||
|
||||
int id() const { return m_id; }
|
||||
long number() const { return m_number; }
|
||||
QString desc() const { return m_desc; }
|
||||
QDateTime birthDate() const { return m_birthDate; }
|
||||
QVariant photo() const { return m_photo; }
|
||||
|
||||
void setId(int i) { m_id = i; }
|
||||
void setNumber(long l) { m_number = l; }
|
||||
void setDesc(const QString & s) { m_desc = s; }
|
||||
void setBirthDate(const QDateTime & dt) { m_birthDate = dt; }
|
||||
void setPhoto(const QVariant & v) { m_photo = v; }
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_DLL1(TestQtProperty, QObject, 0)
|
||||
|
||||
#endif // _QX_TEST_QT_META_PROPERTY_H_
|
||||
26
test/qxDllSample/dll1/include/export.h
Normal file
26
test/qxDllSample/dll1/include/export.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _QX_DLL1_EXPORT_H_
|
||||
#define _QX_DLL1_EXPORT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef _QX_BUILDING_DLL1
|
||||
#define QX_DLL1_EXPORT QX_DLL_EXPORT_HELPER
|
||||
#else // _QX_BUILDING_DLL1
|
||||
#define QX_DLL1_EXPORT QX_DLL_IMPORT_HELPER
|
||||
#endif // _QX_BUILDING_DLL1
|
||||
|
||||
#ifdef _QX_BUILDING_DLL1
|
||||
#define QX_REGISTER_HPP_QX_DLL1 QX_REGISTER_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_CPP_QX_DLL1 QX_REGISTER_CPP_EXPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_QX_DLL1 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_QX_DLL1 QX_REGISTER_COMPLEX_CLASS_NAME_CPP_EXPORT_DLL
|
||||
#else // _QX_BUILDING_DLL1
|
||||
#define QX_REGISTER_HPP_QX_DLL1 QX_REGISTER_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_CPP_QX_DLL1 QX_REGISTER_CPP_IMPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_QX_DLL1 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_QX_DLL1 QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL
|
||||
#endif // _QX_BUILDING_DLL1
|
||||
|
||||
#endif // _QX_DLL1_EXPORT_H_
|
||||
12
test/qxDllSample/dll1/include/precompiled.h
Normal file
12
test/qxDllSample/dll1/include/precompiled.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _QX_DLL1_PRECOMPILED_HEADER_H_
|
||||
#define _QX_DLL1_PRECOMPILED_HEADER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxOrm.h>
|
||||
|
||||
#include "../include/export.h"
|
||||
|
||||
#endif // _QX_DLL1_PRECOMPILED_HEADER_H_
|
||||
Reference in New Issue
Block a user