first commit
This commit is contained in:
63
test/qxDllSample/dll2/CMakeLists.txt
Normal file
63
test/qxDllSample/dll2/CMakeLists.txt
Normal file
@@ -0,0 +1,63 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(dll2 LANGUAGES CXX)
|
||||
|
||||
include(../../../QxOrm.cmake)
|
||||
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Sql Gui REQUIRED)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
|
||||
set(HEADERS
|
||||
./include/precompiled.h
|
||||
./include/export.h
|
||||
./include/CUser.h
|
||||
./include/CTestAll.h
|
||||
./include/Bar.h
|
||||
./include/Foo.h
|
||||
./include/BaseClassTrigger.h
|
||||
)
|
||||
|
||||
set(SRCS
|
||||
./qx/CUser.qx.cpp
|
||||
./qx/CTestAll.qx.cpp
|
||||
./qx/Bar.qx.cpp
|
||||
./qx/Foo.qx.cpp
|
||||
./qx/BaseClassTrigger.qx.cpp
|
||||
./src/CUser.cpp
|
||||
./src/CTestAll.cpp
|
||||
./src/Bar.cpp
|
||||
./src/Foo.cpp
|
||||
./src/BaseClassTrigger.cpp
|
||||
./src/main.cpp
|
||||
)
|
||||
|
||||
add_library(dll2 SHARED ${SRCS} ${HEADERS})
|
||||
|
||||
target_compile_definitions(dll2 PRIVATE -D_QX_BUILDING_DLL2)
|
||||
|
||||
if(COMMAND target_precompile_headers)
|
||||
target_precompile_headers(dll2 PRIVATE ./include/precompiled.h)
|
||||
endif() # (COMMAND target_precompile_headers)
|
||||
|
||||
target_link_libraries(dll2 ${QX_LIBRARIES} Qt${QT_VERSION_MAJOR}::Gui QxOrm dll1)
|
||||
|
||||
set_target_properties(dll2 PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../_bin"
|
||||
)
|
||||
7
test/qxDllSample/dll2/debug/.gitignore
vendored
Normal file
7
test/qxDllSample/dll2/debug/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# git does not allow empty directories.
|
||||
# Yet, we need to add this empty directory on git.
|
||||
# To achieve that, we created this .gitignore file, so that the directory will not be empty thus enabling us to commit it.
|
||||
# Since we want all generated files/folders in this directory to be ignored by git, we add a rule for this.
|
||||
*
|
||||
# And then add an exception for this specifc file (so that we can commit it).
|
||||
!.gitignore
|
||||
50
test/qxDllSample/dll2/dll2.pro
Normal file
50
test/qxDllSample/dll2/dll2.pro
Normal file
@@ -0,0 +1,50 @@
|
||||
include(../../../QxOrm.pri)
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += dll
|
||||
DEFINES += _QX_BUILDING_DLL2
|
||||
INCLUDEPATH += ../../../../QxOrm/include/
|
||||
DESTDIR = ../../../../QxOrm/test/_bin/
|
||||
QT += gui
|
||||
|
||||
!contains(DEFINES, _QX_NO_PRECOMPILED_HEADER) {
|
||||
PRECOMPILED_HEADER = ./include/precompiled.h
|
||||
} # !contains(DEFINES, _QX_NO_PRECOMPILED_HEADER)
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
TARGET = dll2d
|
||||
} else {
|
||||
TARGET = dll2
|
||||
} # CONFIG(debug, debug|release)
|
||||
|
||||
LIBS += -L"../../../../QxOrm/lib"
|
||||
LIBS += -L"../../../../QxOrm/test/_bin"
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -l"QxOrmd"
|
||||
LIBS += -l"dll1d"
|
||||
} else {
|
||||
LIBS += -l"QxOrm"
|
||||
LIBS += -l"dll1"
|
||||
} # CONFIG(debug, debug|release)
|
||||
|
||||
HEADERS += ./include/precompiled.h
|
||||
HEADERS += ./include/export.h
|
||||
HEADERS += ./include/CUser.h
|
||||
HEADERS += ./include/CTestAll.h
|
||||
HEADERS += ./include/Bar.h
|
||||
HEADERS += ./include/Foo.h
|
||||
HEADERS += ./include/BaseClassTrigger.h
|
||||
|
||||
SOURCES += ./qx/CUser.qx.cpp
|
||||
SOURCES += ./qx/CTestAll.qx.cpp
|
||||
SOURCES += ./qx/Bar.qx.cpp
|
||||
SOURCES += ./qx/Foo.qx.cpp
|
||||
SOURCES += ./qx/BaseClassTrigger.qx.cpp
|
||||
|
||||
SOURCES += ./src/CUser.cpp
|
||||
SOURCES += ./src/CTestAll.cpp
|
||||
SOURCES += ./src/Bar.cpp
|
||||
SOURCES += ./src/Foo.cpp
|
||||
SOURCES += ./src/BaseClassTrigger.cpp
|
||||
SOURCES += ./src/main.cpp
|
||||
48
test/qxDllSample/dll2/include/Bar.h
Normal file
48
test/qxDllSample/dll2/include/Bar.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef _QX_BAR_H_
|
||||
#define _QX_BAR_H_
|
||||
|
||||
#include "../include/BaseClassTrigger.h"
|
||||
|
||||
class Foo;
|
||||
|
||||
class QX_DLL2_EXPORT Bar : public BaseClassTrigger
|
||||
{
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(Bar)
|
||||
QX_PERSISTABLE_HPP(Bar)
|
||||
|
||||
public:
|
||||
|
||||
typedef std::shared_ptr<Foo> Foo_ptr;
|
||||
|
||||
protected:
|
||||
|
||||
QString m_sCode;
|
||||
QString m_sValue;
|
||||
Foo_ptr m_pFoo;
|
||||
|
||||
public:
|
||||
|
||||
Bar() : BaseClassTrigger() { ; }
|
||||
virtual ~Bar() { ; }
|
||||
|
||||
virtual void makeAbstractClass() { ; }
|
||||
|
||||
QString getCode() const { return m_sCode; }
|
||||
QString getValue() const { return m_sValue; }
|
||||
Foo_ptr getFoo() const { return m_pFoo; }
|
||||
|
||||
void setCode(const QString & s) { m_sCode = s; }
|
||||
void setValue(const QString & s) { m_sValue = s; }
|
||||
void setFoo(Foo_ptr p) { m_pFoo = p; }
|
||||
void setFoo(long l);
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_DLL2(Bar, BaseClassTrigger, 0)
|
||||
|
||||
typedef std::shared_ptr<Bar> Bar_ptr;
|
||||
typedef std::vector<Bar_ptr> BarX;
|
||||
typedef std::shared_ptr<BarX> BarX_ptr;
|
||||
|
||||
#endif // _QX_BAR_H_
|
||||
67
test/qxDllSample/dll2/include/BaseClassTrigger.h
Normal file
67
test/qxDllSample/dll2/include/BaseClassTrigger.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef _QX_BASE_CLASS_TRIGGER_H_
|
||||
#define _QX_BASE_CLASS_TRIGGER_H_
|
||||
|
||||
class QX_DLL2_EXPORT BaseClassTrigger : public qx::IxPersistable
|
||||
{
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(BaseClassTrigger)
|
||||
|
||||
protected:
|
||||
|
||||
long m_id;
|
||||
QDateTime m_dateCreation;
|
||||
QDateTime m_dateModification;
|
||||
QString m_userCreation;
|
||||
QString m_userModification;
|
||||
|
||||
public:
|
||||
|
||||
BaseClassTrigger() : m_id(0) { ; }
|
||||
virtual ~BaseClassTrigger() { ; }
|
||||
|
||||
virtual void makeAbstractClass() = 0;
|
||||
|
||||
long getId() const { return m_id; }
|
||||
QDateTime getDateCreation() const { return m_dateCreation; }
|
||||
QDateTime getDateModification() const { return m_dateModification; }
|
||||
QString getUserCreation() const { return m_userCreation; }
|
||||
QString getUserModification() const { return m_userModification; }
|
||||
|
||||
void setId(long l) { m_id = l; }
|
||||
void setDateCreation(const QDateTime & dt) { m_dateCreation = dt; }
|
||||
void setDateModification(const QDateTime & dt) { m_dateModification = dt; }
|
||||
void setUserCreation(const QString & s) { m_userCreation = s; }
|
||||
void setUserModification(const QString & s) { m_userModification = s; }
|
||||
|
||||
void onBeforeInsert(qx::dao::detail::IxDao_Helper * dao);
|
||||
void onBeforeUpdate(qx::dao::detail::IxDao_Helper * dao);
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_ABSTRACT_CLASS(BaseClassTrigger)
|
||||
QX_REGISTER_HPP_QX_DLL2(BaseClassTrigger, qx::trait::no_base_class_defined, 0)
|
||||
|
||||
namespace qx {
|
||||
namespace dao {
|
||||
namespace detail {
|
||||
|
||||
template <>
|
||||
struct QxDao_Trigger<BaseClassTrigger>
|
||||
{
|
||||
|
||||
static inline void onBeforeInsert(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { if (t) { t->onBeforeInsert(dao); } }
|
||||
static inline void onBeforeUpdate(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { if (t) { t->onBeforeUpdate(dao); } }
|
||||
static inline void onBeforeDelete(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { Q_UNUSED(t); Q_UNUSED(dao); }
|
||||
static inline void onBeforeFetch(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { Q_UNUSED(t); Q_UNUSED(dao); }
|
||||
static inline void onAfterInsert(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { Q_UNUSED(t); Q_UNUSED(dao); }
|
||||
static inline void onAfterUpdate(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { Q_UNUSED(t); Q_UNUSED(dao); }
|
||||
static inline void onAfterDelete(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { Q_UNUSED(t); Q_UNUSED(dao); }
|
||||
static inline void onAfterFetch(BaseClassTrigger * t, qx::dao::detail::IxDao_Helper * dao) { Q_UNUSED(t); Q_UNUSED(dao); }
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_BASE_CLASS_TRIGGER_H_
|
||||
105
test/qxDllSample/dll2/include/CTestAll.h
Normal file
105
test/qxDllSample/dll2/include/CTestAll.h
Normal file
@@ -0,0 +1,105 @@
|
||||
#ifndef _QX_CLASS_TEST_ALL_H_
|
||||
#define _QX_CLASS_TEST_ALL_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QtGui/qcolor.h>
|
||||
#include <QtGui/qfont.h>
|
||||
#include <QtGui/qimage.h>
|
||||
#include <QtGui/qbrush.h>
|
||||
#include <QtGui/qpicture.h>
|
||||
#include <QtGui/qpixmap.h>
|
||||
#include <QtGui/qregion.h>
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QtGui/qmatrix.h>
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#include "../../dll1/include/CPerson.h"
|
||||
#include "../../dll2/include/CUser.h"
|
||||
|
||||
class QX_DLL2_EXPORT CTestAll
|
||||
{
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(CTestAll)
|
||||
|
||||
protected:
|
||||
|
||||
long m_lId;
|
||||
qx_bool m_oQxBool;
|
||||
|
||||
std::string m_oStdString;
|
||||
std::pair<QPoint, QRect> m_oStdPair;
|
||||
std::vector< QSharedPointer<qx::test::CPerson> > m_oStdVector;
|
||||
std::list<QDateTime> m_oStdList;
|
||||
std::map<std::string, QSharedPointer<CUser> > m_oStdMap;
|
||||
std::shared_ptr<QObject> m_oBoostSharedPtr;
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
boost::tuple<QTime, QPoint, QUrl> m_oBoostTuple;
|
||||
boost::scoped_ptr<QSize> m_oBoostScopedPtr;
|
||||
boost::weak_ptr<CTestAll> m_oBoostWeakPtr;
|
||||
boost::unordered_map<long, std::string> m_oBoostUnorderedMap;
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
|
||||
QString m_oQString;
|
||||
QObject m_oQObject;
|
||||
QBrush m_oQBrush;
|
||||
QByteArray m_oQByteArray;
|
||||
QColor m_oQColor;
|
||||
QDate m_oQDate;
|
||||
QDateTime m_oQDateTime;
|
||||
QTime m_oQTime;
|
||||
QFont m_oQFont;
|
||||
QImage m_oQImage;
|
||||
QPicture m_oQPicture;
|
||||
QPoint m_oQPoint;
|
||||
QRect m_oQRect;
|
||||
QSize m_oQSize;
|
||||
QRegion m_oQRegion;
|
||||
QUrl m_oQUrl;
|
||||
QVariant m_oQVariant;
|
||||
QStringList m_oQStringList;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QMatrix m_oQMatrix;
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QRegExp m_oQRegExp;
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
QHash<long, QString> m_oQHash;
|
||||
QMultiHash<QString, std::shared_ptr<qx::test::CPerson> > m_oQMultiHash;
|
||||
QMap<double, std::string> m_oQMap;
|
||||
QMultiMap<std::string, QSharedPointer<CUser> > m_oQMultiMap;
|
||||
qx::QxCollection<QString, std::tuple<long, qx::test::CPerson *> > m_oQxCollection;
|
||||
|
||||
QList<float> m_oQList;
|
||||
QVector<CUser *> m_oQVector;
|
||||
QSharedPointer<std::tuple<int, std::string, std::shared_ptr<qx::test::CPerson> > > m_oQSharedPointer;
|
||||
QPair<QString, QPoint> m_oQPair;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
QLinkedList<QString> m_oQLinkedList;
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
|
||||
public:
|
||||
|
||||
CTestAll() { init(); }
|
||||
virtual ~CTestAll() { terminate(); }
|
||||
|
||||
static void test();
|
||||
|
||||
private:
|
||||
|
||||
void init();
|
||||
void terminate();
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_DLL2(CTestAll, qx::trait::no_base_class_defined, 1)
|
||||
|
||||
#endif // _QX_CLASS_TEST_ALL_H_
|
||||
54
test/qxDllSample/dll2/include/CUser.h
Normal file
54
test/qxDllSample/dll2/include/CUser.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef _QX_CLASS_USER_H_
|
||||
#define _QX_CLASS_USER_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
|
||||
|
||||
#include "../../dll1/include/CPerson.h"
|
||||
|
||||
class QX_DLL2_EXPORT CUser : public qx::test::CPerson
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
QX_REGISTER_FRIEND_CLASS(CUser)
|
||||
|
||||
protected:
|
||||
|
||||
long m_lUserId;
|
||||
QString m_sProfil;
|
||||
qx_bool m_bIsAdmin;
|
||||
QDateTime m_dtModif;
|
||||
qx::test::CPerson * m_pBrother;
|
||||
|
||||
public:
|
||||
|
||||
CUser() : qx::test::CPerson(), m_lUserId(0), m_pBrother(NULL) { ; }
|
||||
CUser(long lId) : qx::test::CPerson(), m_lUserId(lId), m_pBrother(NULL) { ; }
|
||||
virtual ~CUser() { if (m_pBrother) { delete m_pBrother; m_pBrother = NULL; } }
|
||||
|
||||
void test();
|
||||
|
||||
long getUserId() const { return m_lUserId; }
|
||||
QString getProfil() const { return m_sProfil; }
|
||||
qx_bool getIsAdmin() const { return m_bIsAdmin; }
|
||||
QDateTime getDateModif() const { return m_dtModif; }
|
||||
qx::test::CPerson * getBrother() const { return m_pBrother; }
|
||||
|
||||
void setUserId(long l) { m_lUserId = l; }
|
||||
void setProfil(const QString & s) { m_sProfil = s; }
|
||||
void setIsAdmin(qx_bool b) { m_bIsAdmin = b; }
|
||||
void setDateModif(const QDateTime & dt) { m_dtModif = dt; }
|
||||
void setBrother(qx::test::CPerson * p) { if (m_pBrother) { delete m_pBrother; } m_pBrother = p; }
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_DLL2(CUser, qx::test::CPerson, 2)
|
||||
|
||||
#endif // _QX_CLASS_USER_H_
|
||||
67
test/qxDllSample/dll2/include/Foo.h
Normal file
67
test/qxDllSample/dll2/include/Foo.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef _QX_FOO_H_
|
||||
#define _QX_FOO_H_
|
||||
|
||||
#include "../include/BaseClassTrigger.h"
|
||||
#include "../include/Bar.h"
|
||||
|
||||
class QX_DLL2_EXPORT Foo : public BaseClassTrigger
|
||||
{
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(Foo)
|
||||
QX_PERSISTABLE_HPP(Foo)
|
||||
|
||||
protected:
|
||||
|
||||
QString m_sName;
|
||||
QVariant m_sDesc;
|
||||
BarX_ptr m_pBarX;
|
||||
|
||||
qx::QxDateNeutral m_oDateNeutral;
|
||||
qx::QxTimeNeutral m_oTimeNeutral;
|
||||
qx::QxDateTimeNeutral m_oDateTimeNeutral;
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
boost::optional<int> m_optInt;
|
||||
boost::optional<QString> m_optString;
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
|
||||
public:
|
||||
|
||||
Foo() : BaseClassTrigger() { ; }
|
||||
virtual ~Foo() { ; }
|
||||
|
||||
virtual void makeAbstractClass() { ; }
|
||||
|
||||
QString getName() const { return m_sName; }
|
||||
QVariant getDesc() const { return m_sDesc; }
|
||||
BarX * getBarX() const { return m_pBarX.get(); }
|
||||
QDate getDate() const { return m_oDateNeutral.toDate(); }
|
||||
QTime getTime() const { return m_oTimeNeutral.toTime(); }
|
||||
QDateTime getDateTime() const { return m_oDateTimeNeutral.toDateTime(); }
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
boost::optional<int> getOptInt() const { return m_optInt; }
|
||||
boost::optional<QString> getOptString() const { return m_optString; }
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
|
||||
void setName(const QString & s) { m_sName = s; }
|
||||
void setDesc(const QVariant & s) { m_sDesc = s; }
|
||||
void setBarX(BarX_ptr p) { m_pBarX = p; }
|
||||
void setDate(const QDate & d) { m_oDateNeutral.setDate(d); }
|
||||
void setTime(const QTime & t) { m_oTimeNeutral.setTime(t); }
|
||||
void setDateTime(const QDateTime & dt) { m_oDateTimeNeutral.setDateTime(dt); }
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
void setOptInt(const boost::optional<int> & opt) { m_optInt = opt; }
|
||||
void setOptString(const boost::optional<QString> & opt) { m_optString = opt; }
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_DLL2(Foo, BaseClassTrigger, 0)
|
||||
|
||||
typedef std::shared_ptr<Foo> Foo_ptr;
|
||||
typedef qx::QxCollection<long, Foo_ptr> FooX;
|
||||
typedef std::shared_ptr<FooX> FooX_ptr;
|
||||
|
||||
#endif // _QX_FOO_H_
|
||||
28
test/qxDllSample/dll2/include/export.h
Normal file
28
test/qxDllSample/dll2/include/export.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _QX_DLL2_EXPORT_H_
|
||||
#define _QX_DLL2_EXPORT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "../../dll1/include/export.h"
|
||||
|
||||
#ifdef _QX_BUILDING_DLL2
|
||||
#define QX_DLL2_EXPORT QX_DLL_EXPORT_HELPER
|
||||
#else // _QX_BUILDING_DLL2
|
||||
#define QX_DLL2_EXPORT QX_DLL_IMPORT_HELPER
|
||||
#endif // _QX_BUILDING_DLL2
|
||||
|
||||
#ifdef _QX_BUILDING_DLL2
|
||||
#define QX_REGISTER_HPP_QX_DLL2 QX_REGISTER_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_CPP_QX_DLL2 QX_REGISTER_CPP_EXPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_QX_DLL2 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_QX_DLL2 QX_REGISTER_COMPLEX_CLASS_NAME_CPP_EXPORT_DLL
|
||||
#else // _QX_BUILDING_DLL2
|
||||
#define QX_REGISTER_HPP_QX_DLL2 QX_REGISTER_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_CPP_QX_DLL2 QX_REGISTER_CPP_IMPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_HPP_QX_DLL2 QX_REGISTER_COMPLEX_CLASS_NAME_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_COMPLEX_CLASS_NAME_CPP_QX_DLL2 QX_REGISTER_COMPLEX_CLASS_NAME_CPP_IMPORT_DLL
|
||||
#endif // _QX_BUILDING_DLL2
|
||||
|
||||
#endif // _QX_DLL2_EXPORT_H_
|
||||
12
test/qxDllSample/dll2/include/precompiled.h
Normal file
12
test/qxDllSample/dll2/include/precompiled.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _QX_DLL2_PRECOMPILED_HEADER_H_
|
||||
#define _QX_DLL2_PRECOMPILED_HEADER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxOrm.h>
|
||||
|
||||
#include "../include/export.h"
|
||||
|
||||
#endif // _QX_DLL2_PRECOMPILED_HEADER_H_
|
||||
7
test/qxDllSample/dll2/qt/moc/.gitignore
vendored
Normal file
7
test/qxDllSample/dll2/qt/moc/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# git does not allow empty directories.
|
||||
# Yet, we need to add this empty directory on git.
|
||||
# To achieve that, we created this .gitignore file, so that the directory will not be empty thus enabling us to commit it.
|
||||
# Since we want all generated files/folders in this directory to be ignored by git, we add a rule for this.
|
||||
*
|
||||
# And then add an exception for this specifc file (so that we can commit it).
|
||||
!.gitignore
|
||||
7
test/qxDllSample/dll2/qt/rcc/src/.gitignore
vendored
Normal file
7
test/qxDllSample/dll2/qt/rcc/src/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# git does not allow empty directories.
|
||||
# Yet, we need to add this empty directory on git.
|
||||
# To achieve that, we created this .gitignore file, so that the directory will not be empty thus enabling us to commit it.
|
||||
# Since we want all generated files/folders in this directory to be ignored by git, we add a rule for this.
|
||||
*
|
||||
# And then add an exception for this specifc file (so that we can commit it).
|
||||
!.gitignore
|
||||
7
test/qxDllSample/dll2/qt/ui/include/.gitignore
vendored
Normal file
7
test/qxDllSample/dll2/qt/ui/include/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# git does not allow empty directories.
|
||||
# Yet, we need to add this empty directory on git.
|
||||
# To achieve that, we created this .gitignore file, so that the directory will not be empty thus enabling us to commit it.
|
||||
# Since we want all generated files/folders in this directory to be ignored by git, we add a rule for this.
|
||||
*
|
||||
# And then add an exception for this specifc file (so that we can commit it).
|
||||
!.gitignore
|
||||
7
test/qxDllSample/dll2/qt/ui/src/.gitignore
vendored
Normal file
7
test/qxDllSample/dll2/qt/ui/src/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# git does not allow empty directories.
|
||||
# Yet, we need to add this empty directory on git.
|
||||
# To achieve that, we created this .gitignore file, so that the directory will not be empty thus enabling us to commit it.
|
||||
# Since we want all generated files/folders in this directory to be ignored by git, we add a rule for this.
|
||||
*
|
||||
# And then add an exception for this specifc file (so that we can commit it).
|
||||
!.gitignore
|
||||
23
test/qxDllSample/dll2/qx/Bar.qx.cpp
Normal file
23
test/qxDllSample/dll2/qx/Bar.qx.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/Bar.h"
|
||||
#include "../include/Foo.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
QX_REGISTER_CPP_QX_DLL2(Bar)
|
||||
QX_PERSISTABLE_CPP(Bar)
|
||||
|
||||
namespace qx {
|
||||
template <> void register_class(QxClass<Bar> & t)
|
||||
{
|
||||
IxDataMember * pData = NULL;
|
||||
IxSqlRelation * pRelation = NULL;
|
||||
|
||||
t.setSoftDelete(qx::QxSoftDelete("deleted_at"));
|
||||
|
||||
pData = t.data(& Bar::m_sCode, "code");
|
||||
pData = t.data(& Bar::m_sValue, "value");
|
||||
|
||||
pRelation = t.relationManyToOne(& Bar::m_pFoo, "foo_id");
|
||||
}}
|
||||
20
test/qxDllSample/dll2/qx/BaseClassTrigger.qx.cpp
Normal file
20
test/qxDllSample/dll2/qx/BaseClassTrigger.qx.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/BaseClassTrigger.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
QX_REGISTER_CPP_QX_DLL2(BaseClassTrigger)
|
||||
|
||||
namespace qx {
|
||||
template <> void register_class(QxClass<BaseClassTrigger> & t)
|
||||
{
|
||||
IxDataMember * pData = NULL;
|
||||
|
||||
pData = t.id(& BaseClassTrigger::m_id, "id");
|
||||
|
||||
pData = t.data(& BaseClassTrigger::m_dateCreation, "date_creation");
|
||||
pData = t.data(& BaseClassTrigger::m_dateModification, "date_modification");
|
||||
pData = t.data(& BaseClassTrigger::m_userCreation, "user_creation");
|
||||
pData = t.data(& BaseClassTrigger::m_userModification, "user_modification");
|
||||
}}
|
||||
75
test/qxDllSample/dll2/qx/CTestAll.qx.cpp
Normal file
75
test/qxDllSample/dll2/qx/CTestAll.qx.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/CTestAll.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
QX_REGISTER_CPP_QX_DLL2(CTestAll)
|
||||
|
||||
namespace qx {
|
||||
template <> void register_class(QxClass<CTestAll> & t)
|
||||
{
|
||||
IxDataMember * pData = NULL;
|
||||
|
||||
pData = t.id(& CTestAll::m_lId, "m_lId");
|
||||
|
||||
pData = t.data(& CTestAll::m_oQxBool, "m_oQxBool");
|
||||
pData = t.data(& CTestAll::m_oStdString, "m_oStdString");
|
||||
pData = t.data(& CTestAll::m_oStdPair, "m_oStdPair");
|
||||
pData = t.data(& CTestAll::m_oStdVector, "m_oStdVector");
|
||||
pData = t.data(& CTestAll::m_oStdList, "m_oStdList");
|
||||
pData = t.data(& CTestAll::m_oStdMap, "m_oStdMap");
|
||||
pData = t.data(& CTestAll::m_oQString, "m_oQString");
|
||||
pData = t.data(& CTestAll::m_oQObject, "m_oQObject");
|
||||
pData = t.data(& CTestAll::m_oQByteArray, "m_oQByteArray");
|
||||
pData = t.data(& CTestAll::m_oQDate, "m_oQDate");
|
||||
pData = t.data(& CTestAll::m_oQDateTime, "m_oQDateTime");
|
||||
pData = t.data(& CTestAll::m_oQTime, "m_oQTime");
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
pData = t.data(& CTestAll::m_oBoostTuple, "m_oBoostTuple");
|
||||
pData = t.data(& CTestAll::m_oBoostScopedPtr, "m_oBoostScopedPtr", 1);
|
||||
pData = t.data(& CTestAll::m_oBoostUnorderedMap, "m_oBoostUnorderedMap", 1);
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
|
||||
#ifdef _QX_ENABLE_QT_GUI
|
||||
pData = t.data(& CTestAll::m_oQBrush, "m_oQBrush");
|
||||
pData = t.data(& CTestAll::m_oQColor, "m_oQColor");
|
||||
pData = t.data(& CTestAll::m_oQFont, "m_oQFont", 0);
|
||||
pData = t.data(& CTestAll::m_oQImage, "m_oQImage", 0);
|
||||
pData = t.data(& CTestAll::m_oQPicture, "m_oQPicture", 0);
|
||||
pData = t.data(& CTestAll::m_oQRegion, "m_oQRegion", 0);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
pData = t.data(& CTestAll::m_oQMatrix, "m_oQMatrix", 1);
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif // _QX_ENABLE_QT_GUI
|
||||
|
||||
#if (0) /* ((! defined(Q_OS_WIN)) || (! defined(__GNUC__))) // MinGW memory bug ? */
|
||||
pData = t.data(& CTestAll::m_oQPoint, "m_oQPoint", 0);
|
||||
pData = t.data(& CTestAll::m_oQRect, "m_oQRect", 0);
|
||||
pData = t.data(& CTestAll::m_oQUrl, "m_oQUrl", 0);
|
||||
pData = t.data(& CTestAll::m_oQVariant, "m_oQVariant", 0);
|
||||
pData = t.data(& CTestAll::m_oQStringList, "m_oQStringList", 0);
|
||||
pData = t.data(& CTestAll::m_oQHash, "m_oQHash", 0);
|
||||
pData = t.data(& CTestAll::m_oQMultiHash, "m_oQMultiHash", 0);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
pData = t.data(& CTestAll::m_oQRegExp, "m_oQRegExp", 0);
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
pData = t.data(& CTestAll::m_oQMap, "m_oQMap", 1);
|
||||
pData = t.data(& CTestAll::m_oQMultiMap, "m_oQMultiMap", 1);
|
||||
pData = t.data(& CTestAll::m_oQxCollection, "m_oQxCollection", 1);
|
||||
pData = t.data(& CTestAll::m_oQList, "m_oQList", 1);
|
||||
pData = t.data(& CTestAll::m_oQVector, "m_oQVector", 1);
|
||||
pData = t.data(& CTestAll::m_oQPair, "m_oQPair", 1);
|
||||
pData = t.data(& CTestAll::m_oBoostSharedPtr, "m_oBoostSharedPtr", 1);
|
||||
pData = t.data(& CTestAll::m_oQSharedPointer, "m_oQSharedPointer", 1);
|
||||
pData = t.data(& CTestAll::m_oQSize, "m_oQSize", 1);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
pData = t.data(& CTestAll::m_oQLinkedList, "m_oQLinkedList", 1);
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
|
||||
#endif // ((! defined(Q_OS_WIN)) || (! defined(__GNUC__)))
|
||||
}}
|
||||
26
test/qxDllSample/dll2/qx/CUser.qx.cpp
Normal file
26
test/qxDllSample/dll2/qx/CUser.qx.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/CUser.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
QX_REGISTER_CPP_QX_DLL2(CUser)
|
||||
|
||||
namespace qx {
|
||||
template <> void register_class(QxClass<CUser> & t)
|
||||
{
|
||||
IxDataMember * pData = NULL;
|
||||
IxSqlRelation * pRelation = NULL;
|
||||
IxValidator * pValidator = NULL;
|
||||
|
||||
pData = t.data(& CUser::m_lUserId, "idUser", 0);
|
||||
pData = t.data(& CUser::m_sProfil, "profil", 0); pData->setSqlAlias("profil");
|
||||
pData = t.data(& CUser::m_bIsAdmin, "isAdmin", 1);
|
||||
pData = t.data(& CUser::m_dtModif, "dtModif", 1);
|
||||
|
||||
pRelation = t.relationManyToOne(& CUser::m_pBrother, "brother", 2);
|
||||
|
||||
QxValidatorX<CUser> * pAllValidator = t.getAllValidator();
|
||||
if (! pAllValidator) { qAssert(false); return; }
|
||||
pValidator = pAllValidator->add_RecursiveValidator<qx::test::CPerson *>("brother");
|
||||
}}
|
||||
28
test/qxDllSample/dll2/qx/Foo.qx.cpp
Normal file
28
test/qxDllSample/dll2/qx/Foo.qx.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/Foo.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
QX_REGISTER_CPP_QX_DLL2(Foo)
|
||||
QX_PERSISTABLE_CPP(Foo)
|
||||
|
||||
namespace qx {
|
||||
template <> void register_class(QxClass<Foo> & t)
|
||||
{
|
||||
IxDataMember * pData = NULL;
|
||||
IxSqlRelation * pRelation = NULL;
|
||||
|
||||
pData = t.data(& Foo::m_sName, "name");
|
||||
pData = t.data(& Foo::m_sDesc, "desc");
|
||||
pData = t.data(& Foo::m_oDateNeutral, "date_neutral");
|
||||
pData = t.data(& Foo::m_oTimeNeutral, "time_neutral");
|
||||
pData = t.data(& Foo::m_oDateTimeNeutral, "dt_neutral");
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST
|
||||
pData = t.data(& Foo::m_optInt, "optional_int");
|
||||
pData = t.data(& Foo::m_optString, "optional_string");
|
||||
#endif // _QX_ENABLE_BOOST
|
||||
|
||||
pRelation = t.relationOneToMany(& Foo::m_pBarX, "lstBar", "foo_id");
|
||||
}}
|
||||
7
test/qxDllSample/dll2/release/.gitignore
vendored
Normal file
7
test/qxDllSample/dll2/release/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# git does not allow empty directories.
|
||||
# Yet, we need to add this empty directory on git.
|
||||
# To achieve that, we created this .gitignore file, so that the directory will not be empty thus enabling us to commit it.
|
||||
# Since we want all generated files/folders in this directory to be ignored by git, we add a rule for this.
|
||||
*
|
||||
# And then add an exception for this specifc file (so that we can commit it).
|
||||
!.gitignore
|
||||
12
test/qxDllSample/dll2/src/Bar.cpp
Normal file
12
test/qxDllSample/dll2/src/Bar.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/Bar.h"
|
||||
#include "../include/Foo.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
void Bar::setFoo(long l)
|
||||
{
|
||||
m_pFoo.reset(new Foo());
|
||||
m_pFoo->setId(l);
|
||||
}
|
||||
21
test/qxDllSample/dll2/src/BaseClassTrigger.cpp
Normal file
21
test/qxDllSample/dll2/src/BaseClassTrigger.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/BaseClassTrigger.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
void BaseClassTrigger::onBeforeInsert(qx::dao::detail::IxDao_Helper * dao)
|
||||
{
|
||||
Q_UNUSED(dao);
|
||||
m_dateCreation = QDateTime::currentDateTime();
|
||||
m_dateModification = QDateTime::currentDateTime();
|
||||
m_userCreation = "current_user_1";
|
||||
m_userModification = "current_user_1";
|
||||
}
|
||||
|
||||
void BaseClassTrigger::onBeforeUpdate(qx::dao::detail::IxDao_Helper * dao)
|
||||
{
|
||||
Q_UNUSED(dao);
|
||||
m_dateModification = QDateTime::currentDateTime();
|
||||
m_userModification = "current_user_2";
|
||||
}
|
||||
89
test/qxDllSample/dll2/src/CTestAll.cpp
Normal file
89
test/qxDllSample/dll2/src/CTestAll.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/CTestAll.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
void CTestAll::init()
|
||||
{
|
||||
m_lId = 56;
|
||||
m_oQxBool = qx_bool(true, "qx_bool description");
|
||||
m_oStdString = "std::string text";
|
||||
|
||||
m_oQString = "QString text\nwith a new line";
|
||||
m_oQDate = QDate::currentDate();
|
||||
m_oQDateTime = QDateTime::currentDateTime();
|
||||
m_oQTime = QTime::currentTime();
|
||||
m_oQColor = QColor(255, 200, 200);
|
||||
m_oQFont.setBold(true);
|
||||
m_oQFont.setFamily("font family from qx test");
|
||||
m_oQPoint = QPoint(8, 11);
|
||||
m_oQRect = QRect(QPoint(52, 3), QPoint(574, 1112));
|
||||
m_oQSize = QSize(1024, 768);
|
||||
m_oQUrl = QUrl("www.qxorm.com");
|
||||
m_oQStringList << "str1" << "str2" << "str3" << "str4";
|
||||
m_oQByteArray = QByteArray("QByteArray t\0ext\nwith a new line\0and null multi\0ple null char\0", 55);
|
||||
m_oQVariant = QVariant(0.437);
|
||||
m_oQObject.setProperty("prop_1", 1);
|
||||
m_oQObject.setProperty("prop_2", 2);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
m_oQRegExp = QRegExp("qt reg exp");
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
QSharedPointer<CUser> u1(new CUser());
|
||||
QSharedPointer<CUser> u2(new CUser());
|
||||
|
||||
m_oStdPair = std::make_pair(QPoint(2, 6), QRect(99, 55, 44, 22));
|
||||
m_oStdList.push_back(QDateTime());
|
||||
m_oStdList.push_back(QDateTime::currentDateTime());
|
||||
m_oStdList.push_back(QDateTime());
|
||||
m_oStdMap.insert(std::make_pair("1", u1));
|
||||
m_oStdMap.insert(std::make_pair("2", u2));
|
||||
|
||||
m_oStdVector.push_back(QSharedPointer<qx::test::CPerson>(new qx::test::CPerson()));
|
||||
m_oStdVector.push_back(QSharedPointer<qx::test::CPerson>(new CUser()));
|
||||
}
|
||||
|
||||
void CTestAll::terminate()
|
||||
{
|
||||
Q_FOREACH(CUser * p2, m_oQVector) { if (p2) { delete p2; } }
|
||||
}
|
||||
|
||||
void CTestAll::test()
|
||||
{
|
||||
std::shared_ptr<CTestAll> o1; o1.reset(new CTestAll());
|
||||
std::shared_ptr<CTestAll> o2; o2.reset(new CTestAll());
|
||||
|
||||
qx::QxCollection<long, std::shared_ptr<CTestAll> > coll;
|
||||
coll.insert(0, o1);
|
||||
coll.insert(1, o2);
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
qx::serialization::polymorphic_xml::to_file(coll, "test_all.xml");
|
||||
qx::serialization::polymorphic_xml::from_file(coll, "test_all.xml");
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
qx::serialization::binary::to_file(coll, "test_all.bin");
|
||||
qx::serialization::binary::from_file(coll, "test_all.bin");
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
qx::serialization::xml::to_file(coll, "test_all.xml");
|
||||
qx::serialization::xml::from_file(coll, "test_all.xml");
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
qx::serialization::portable_binary::to_file(coll, "test_all.bin2", 0);
|
||||
qx::serialization::portable_binary::from_file(coll, "test_all.bin2", 0);
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
|
||||
#ifndef _QX_NO_JSON
|
||||
qx::serialization::json::to_file(coll, "test_all.json");
|
||||
qx::serialization::json::from_file(coll, "test_all.json");
|
||||
#endif // _QX_NO_JSON
|
||||
|
||||
qx::clone(coll);
|
||||
qx::create("CTestAll");
|
||||
}
|
||||
126
test/qxDllSample/dll2/src/CUser.cpp
Normal file
126
test/qxDllSample/dll2/src/CUser.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/CUser.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
|
||||
void CUser::test()
|
||||
{
|
||||
std::shared_ptr<QObject> ptrTmp;
|
||||
ptrTmp.reset(new CUser());
|
||||
qx::clone(ptrTmp);
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
qx::serialization::polymorphic_xml::to_file(ptrTmp, "pointer_from_CUser.xml");
|
||||
qx::serialization::polymorphic_xml::from_file(ptrTmp, "pointer_from_CUser.xml");
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
qx::serialization::xml::to_file(ptrTmp, "pointer_from_CUser.xml");
|
||||
qx::serialization::xml::from_file(ptrTmp, "pointer_from_CUser.xml");
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#ifndef _QX_NO_JSON
|
||||
qx::serialization::json::to_file(ptrTmp, "pointer_from_CUser.json");
|
||||
qx::serialization::json::from_file(ptrTmp, "pointer_from_CUser.json");
|
||||
#endif // _QX_NO_JSON
|
||||
|
||||
qx::test::CPerson person;
|
||||
qx::clone(person);
|
||||
qx::create("qx::test::CPerson");
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
qx::serialization::polymorphic_binary::to_file(person, "person.bin");
|
||||
qx::serialization::polymorphic_binary::from_file(person, "person.bin");
|
||||
qx::serialization::polymorphic_xml::to_file(person, "person.xml");
|
||||
qx::serialization::polymorphic_xml::from_file(person, "person.xml");
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
qx::serialization::binary::to_file(person, "person.bin");
|
||||
qx::serialization::binary::from_file(person, "person.bin");
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
qx::serialization::text::to_file(person, "person.txt");
|
||||
qx::serialization::text::from_file(person, "person.txt");
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
qx::serialization::xml::to_file(person, "person.xml");
|
||||
qx::serialization::xml::from_file(person, "person.xml");
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#ifndef _QX_NO_JSON
|
||||
qx::serialization::json::to_file(person, "person.json");
|
||||
qx::serialization::json::from_file(person, "person.json");
|
||||
#endif // _QX_NO_JSON
|
||||
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
qx::serialization::portable_binary::to_file(person, "person.bin2", 0);
|
||||
qx::serialization::portable_binary::from_file(person, "person.bin2", 0);
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
qx::serialization::to_string(person);
|
||||
qx::serialization::to_file_compressed(person, "person.zip");
|
||||
qx::serialization::from_file_compressed(person, "person.zip");
|
||||
#else // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
qx::serialization::qt::to_string(person);
|
||||
qx::serialization::qt::to_file_compressed(person, "person.zip");
|
||||
qx::serialization::qt::from_file_compressed(person, "person.zip");
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
|
||||
//--------------------------------
|
||||
|
||||
CUser user;
|
||||
qx::clone(user);
|
||||
qx::create("CUser");
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
qx::serialization::polymorphic_binary::to_file(user, "user.bin");
|
||||
qx::serialization::polymorphic_binary::from_file(user, "user.bin");
|
||||
qx::serialization::polymorphic_xml::to_file(user, "user.xml");
|
||||
qx::serialization::polymorphic_xml::from_file(user, "user.xml");
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
qx::serialization::binary::to_file(user, "user.bin");
|
||||
qx::serialization::binary::from_file(user, "user.bin");
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
qx::serialization::text::to_file(user, "user.txt");
|
||||
qx::serialization::text::from_file(user, "user.txt");
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
qx::serialization::xml::to_file(user, "user.xml");
|
||||
qx::serialization::xml::from_file(user, "user.xml");
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#ifndef _QX_NO_JSON
|
||||
qx::serialization::json::to_file(user, "user.json");
|
||||
qx::serialization::json::from_file(user, "user.json");
|
||||
#endif // _QX_NO_JSON
|
||||
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
qx::serialization::portable_binary::to_file(user, "user.bin2", 0);
|
||||
qx::serialization::portable_binary::from_file(user, "user.bin2", 0);
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
qx::serialization::to_string(user);
|
||||
qx::serialization::to_file_compressed(user, "user.zip");
|
||||
qx::serialization::from_file_compressed(user, "user.zip");
|
||||
#else // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
qx::serialization::qt::to_string(user);
|
||||
qx::serialization::qt::to_file_compressed(user, "user.zip");
|
||||
qx::serialization::qt::from_file_compressed(user, "user.zip");
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
|
||||
//--------------------------------
|
||||
|
||||
qx::test::CPerson * pPerson = new qx::test::CPerson(); // You find a memory leak !!!
|
||||
Q_UNUSED(pPerson);
|
||||
}
|
||||
5
test/qxDllSample/dll2/src/Foo.cpp
Normal file
5
test/qxDllSample/dll2/src/Foo.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "../include/precompiled.h"
|
||||
|
||||
#include "../include/Foo.h"
|
||||
|
||||
#include <QxOrm_Impl.h>
|
||||
20
test/qxDllSample/dll2/src/main.cpp
Normal file
20
test/qxDllSample/dll2/src/main.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
extern "C"
|
||||
int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /* lpReservedt */)
|
||||
{
|
||||
(void)hInstance;
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH: ::OutputDebugStringA("dll2.DllMain() ---> DLL_PROCESS_ATTACH\n"); break;
|
||||
case DLL_PROCESS_DETACH: ::OutputDebugStringA("dll2.DllMain() ---> DLL_PROCESS_DETACH\n"); break;
|
||||
case DLL_THREAD_ATTACH: ::OutputDebugStringA("dll2.DllMain() ---> DLL_THREAD_ATTACH\n"); break;
|
||||
case DLL_THREAD_DETACH: ::OutputDebugStringA("dll2.DllMain() ---> DLL_THREAD_DETACH\n"); break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // _MSC_VER
|
||||
Reference in New Issue
Block a user