first commit
This commit is contained in:
49
test/qxBlogModelView/include/author.h
Normal file
49
test/qxBlogModelView/include/author.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef _QX_BLOG_AUTHOR_H_
|
||||
#define _QX_BLOG_AUTHOR_H_
|
||||
|
||||
class blog;
|
||||
|
||||
class QX_BLOG_DLL_EXPORT author
|
||||
{
|
||||
public:
|
||||
// -- typedef
|
||||
typedef std::shared_ptr<blog> blog_ptr;
|
||||
typedef std::vector<blog_ptr> list_blog;
|
||||
typedef std::vector<blog_ptr> type_list_of_blog;
|
||||
// -- enum
|
||||
enum enum_sex { male, female, unknown };
|
||||
// -- properties
|
||||
QString m_id;
|
||||
QString m_name;
|
||||
QDate m_birthdate;
|
||||
enum_sex m_sex;
|
||||
list_blog m_blogX;
|
||||
// -- contructor, virtual destructor
|
||||
author() : m_id("0"), m_sex(unknown) { ; }
|
||||
virtual ~author() { ; }
|
||||
// -- methods
|
||||
int age() const;
|
||||
|
||||
QString getauthor_id() const;
|
||||
QString getname() const;
|
||||
QDate getbirthdate() const;
|
||||
enum_sex getsex() const;
|
||||
type_list_of_blog getlist_of_blog() const;
|
||||
type_list_of_blog & list_of_blog();
|
||||
const type_list_of_blog & list_of_blog() const;
|
||||
|
||||
void setauthor_id(const QString & val);
|
||||
void setname(const QString & val);
|
||||
void setbirthdate(const QDate & val);
|
||||
void setsex(const enum_sex & val);
|
||||
void setlist_of_blog(const type_list_of_blog & val);
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_PRIMARY_KEY(author, QString)
|
||||
QX_REGISTER_HPP_QX_BLOG(author, qx::trait::no_base_class_defined, 0)
|
||||
|
||||
typedef std::shared_ptr<author> author_ptr;
|
||||
typedef qx::QxCollection<QString, author_ptr> list_author;
|
||||
|
||||
#endif // _QX_BLOG_AUTHOR_H_
|
||||
53
test/qxBlogModelView/include/blog.h
Normal file
53
test/qxBlogModelView/include/blog.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef _QX_BLOG_BLOG_H_
|
||||
#define _QX_BLOG_BLOG_H_
|
||||
|
||||
#include "author.h"
|
||||
#include "comment.h"
|
||||
#include "category.h"
|
||||
|
||||
class QX_BLOG_DLL_EXPORT blog
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::shared_ptr<author> type_author;
|
||||
typedef QList<comment_ptr> type_list_of_comment;
|
||||
typedef qx::QxCollection<long, category_ptr> type_list_of_category;
|
||||
|
||||
// -- properties
|
||||
long m_id;
|
||||
QString m_title;
|
||||
QString m_text;
|
||||
QDateTime m_dt_creation;
|
||||
author_ptr m_author;
|
||||
list_comment m_commentX;
|
||||
list_category m_categoryX;
|
||||
// -- contructor, virtual destructor
|
||||
blog() : m_id(0) { ; }
|
||||
virtual ~blog() { ; }
|
||||
|
||||
long getblog_id() const;
|
||||
QString gettitle() const;
|
||||
QString gettext() const;
|
||||
type_author getauthor() const;
|
||||
type_list_of_comment getlist_of_comment() const;
|
||||
type_list_of_comment & list_of_comment();
|
||||
const type_list_of_comment & list_of_comment() const;
|
||||
type_list_of_category getlist_of_category() const;
|
||||
type_list_of_category & list_of_category();
|
||||
const type_list_of_category & list_of_category() const;
|
||||
|
||||
void setblog_id(const long & val);
|
||||
void settitle(const QString & val);
|
||||
void settext(const QString & val);
|
||||
void setauthor(const type_author & val);
|
||||
void setlist_of_comment(const type_list_of_comment & val);
|
||||
void setlist_of_category(const type_list_of_category & val);
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_BLOG(blog, qx::trait::no_base_class_defined, 0)
|
||||
|
||||
typedef std::shared_ptr<blog> blog_ptr;
|
||||
typedef std::vector<blog_ptr> list_blog;
|
||||
|
||||
#endif // _QX_BLOG_BLOG_H_
|
||||
41
test/qxBlogModelView/include/category.h
Normal file
41
test/qxBlogModelView/include/category.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _QX_BLOG_CATEGORY_H_
|
||||
#define _QX_BLOG_CATEGORY_H_
|
||||
|
||||
class blog;
|
||||
|
||||
class QX_BLOG_DLL_EXPORT category
|
||||
{
|
||||
public:
|
||||
// -- typedef
|
||||
typedef std::shared_ptr<blog> blog_ptr;
|
||||
typedef qx::QxCollection<long, blog_ptr> list_blog;
|
||||
typedef qx::QxCollection<long, blog_ptr> type_list_of_blog;
|
||||
// -- properties
|
||||
long m_id;
|
||||
QString m_name;
|
||||
QString m_desc;
|
||||
list_blog m_blogX;
|
||||
// -- contructor, virtual destructor
|
||||
category() : m_id(0) { ; }
|
||||
virtual ~category() { ; }
|
||||
|
||||
long getcategory_id() const;
|
||||
QString getname() const;
|
||||
QString getdescription() const;
|
||||
type_list_of_blog getlist_of_blog() const;
|
||||
type_list_of_blog & list_of_blog();
|
||||
const type_list_of_blog & list_of_blog() const;
|
||||
|
||||
void setcategory_id(const long & val);
|
||||
void setname(const QString & val);
|
||||
void setdescription(const QString & val);
|
||||
void setlist_of_blog(const type_list_of_blog & val);
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_BLOG(category, qx::trait::no_base_class_defined, 0)
|
||||
|
||||
typedef QSharedPointer<category> category_ptr;
|
||||
typedef qx::QxCollection<long, category_ptr> list_category;
|
||||
|
||||
#endif // _QX_BLOG_CATEGORY_H_
|
||||
39
test/qxBlogModelView/include/comment.h
Normal file
39
test/qxBlogModelView/include/comment.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef _QX_BLOG_COMMENT_H_
|
||||
#define _QX_BLOG_COMMENT_H_
|
||||
|
||||
class blog;
|
||||
|
||||
class QX_BLOG_DLL_EXPORT comment
|
||||
{
|
||||
public:
|
||||
// -- typedef
|
||||
typedef std::shared_ptr<blog> blog_ptr;
|
||||
typedef std::shared_ptr<blog> type_blog_id;
|
||||
// -- properties
|
||||
long m_id;
|
||||
QString m_title;
|
||||
QString m_text;
|
||||
QDateTime m_dt_create;
|
||||
blog_ptr m_blog;
|
||||
// -- contructor, virtual destructor
|
||||
comment() : m_id(0) { ; }
|
||||
virtual ~comment() { ; }
|
||||
|
||||
long getcomment_id() const;
|
||||
QString gettitle() const;
|
||||
QString gettext() const;
|
||||
type_blog_id getblog_id() const;
|
||||
|
||||
void setcomment_id(const long & val);
|
||||
void settitle(const QString & val);
|
||||
void settext(const QString & val);
|
||||
void setblog_id(const type_blog_id & val);
|
||||
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_QX_BLOG(comment, qx::trait::no_base_class_defined, 0)
|
||||
|
||||
typedef std::shared_ptr<comment> comment_ptr;
|
||||
typedef QList<comment_ptr> list_comment;
|
||||
|
||||
#endif // _QX_BLOG_COMMENT_H_
|
||||
18
test/qxBlogModelView/include/export.h
Normal file
18
test/qxBlogModelView/include/export.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _QX_BLOG_EXPORT_H_
|
||||
#define _QX_BLOG_EXPORT_H_
|
||||
|
||||
#ifdef _BUILDING_QX_BLOG
|
||||
#define QX_BLOG_DLL_EXPORT QX_DLL_EXPORT_HELPER
|
||||
#else // _BUILDING_QX_BLOG
|
||||
#define QX_BLOG_DLL_EXPORT QX_DLL_IMPORT_HELPER
|
||||
#endif // _BUILDING_QX_BLOG
|
||||
|
||||
#ifdef _BUILDING_QX_BLOG
|
||||
#define QX_REGISTER_HPP_QX_BLOG QX_REGISTER_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_CPP_QX_BLOG QX_REGISTER_CPP_EXPORT_DLL
|
||||
#else // _BUILDING_QX_BLOG
|
||||
#define QX_REGISTER_HPP_QX_BLOG QX_REGISTER_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_CPP_QX_BLOG QX_REGISTER_CPP_IMPORT_DLL
|
||||
#endif // _BUILDING_QX_BLOG
|
||||
|
||||
#endif // _QX_BLOG_EXPORT_H_
|
||||
@@ -0,0 +1,50 @@
|
||||
/************************************************************************************************
|
||||
** File created by QxEntityEditor 1.1.9 (2016/05/04 10:05) : please, do NOT modify this file ! **
|
||||
************************************************************************************************/
|
||||
|
||||
#ifndef _QXBLOG_AUTHOR_MODEL_VIEW_H_
|
||||
#define _QXBLOG_AUTHOR_MODEL_VIEW_H_
|
||||
|
||||
#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 "../../include/author.h"
|
||||
|
||||
namespace model_view {
|
||||
|
||||
typedef qx::QxModel<author> author_model_base_class;
|
||||
|
||||
class QX_BLOG_DLL_EXPORT author_model : public author_model_base_class
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
author_model(QObject * parent = 0);
|
||||
author_model(qx::IxModel * other, QObject * parent);
|
||||
virtual ~author_model();
|
||||
|
||||
Q_INVOKABLE QObject * list_of_blog(int row, bool bLoadFromDatabase = false, const QString & sAppendRelations = QString());
|
||||
|
||||
/* List of properties exposed by the model (5) :
|
||||
- author_id
|
||||
- firstname
|
||||
- lastname
|
||||
- birthdate
|
||||
- sex
|
||||
*/
|
||||
|
||||
protected:
|
||||
|
||||
virtual void syncNestedModel(int row, const QStringList & relation);
|
||||
virtual void syncAllNestedModel(const QStringList & relation);
|
||||
|
||||
};
|
||||
|
||||
} // namespace model_view
|
||||
|
||||
#endif // _QXBLOG_AUTHOR_MODEL_VIEW_H_
|
||||
@@ -0,0 +1,50 @@
|
||||
/************************************************************************************************
|
||||
** File created by QxEntityEditor 1.1.9 (2016/05/04 10:05) : please, do NOT modify this file ! **
|
||||
************************************************************************************************/
|
||||
|
||||
#ifndef _QXBLOG_BLOG_MODEL_VIEW_H_
|
||||
#define _QXBLOG_BLOG_MODEL_VIEW_H_
|
||||
|
||||
#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 "../../include/blog.h"
|
||||
|
||||
namespace model_view {
|
||||
|
||||
typedef qx::QxModel<blog> blog_model_base_class;
|
||||
|
||||
class QX_BLOG_DLL_EXPORT blog_model : public blog_model_base_class
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
blog_model(QObject * parent = 0);
|
||||
blog_model(qx::IxModel * other, QObject * parent);
|
||||
virtual ~blog_model();
|
||||
|
||||
Q_INVOKABLE QObject * author_id(int row, bool bLoadFromDatabase = false, const QString & sAppendRelations = QString());
|
||||
Q_INVOKABLE QObject * list_of_comment(int row, bool bLoadFromDatabase = false, const QString & sAppendRelations = QString());
|
||||
Q_INVOKABLE QObject * list_of_category(int row, bool bLoadFromDatabase = false, const QString & sAppendRelations = QString());
|
||||
|
||||
/* List of properties exposed by the model (3) :
|
||||
- blog_id
|
||||
- title
|
||||
- text
|
||||
*/
|
||||
|
||||
protected:
|
||||
|
||||
virtual void syncNestedModel(int row, const QStringList & relation);
|
||||
virtual void syncAllNestedModel(const QStringList & relation);
|
||||
|
||||
};
|
||||
|
||||
} // namespace model_view
|
||||
|
||||
#endif // _QXBLOG_BLOG_MODEL_VIEW_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
/************************************************************************************************
|
||||
** File created by QxEntityEditor 1.1.9 (2016/05/04 10:05) : please, do NOT modify this file ! **
|
||||
************************************************************************************************/
|
||||
|
||||
#ifndef _QXBLOG_CATEGORY_MODEL_VIEW_H_
|
||||
#define _QXBLOG_CATEGORY_MODEL_VIEW_H_
|
||||
|
||||
#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 "../../include/category.h"
|
||||
|
||||
namespace model_view {
|
||||
|
||||
typedef qx::QxModel<category> category_model_base_class;
|
||||
|
||||
class QX_BLOG_DLL_EXPORT category_model : public category_model_base_class
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
category_model(QObject * parent = 0);
|
||||
category_model(qx::IxModel * other, QObject * parent);
|
||||
virtual ~category_model();
|
||||
|
||||
Q_INVOKABLE QObject * list_of_blog(int row, bool bLoadFromDatabase = false, const QString & sAppendRelations = QString());
|
||||
|
||||
/* List of properties exposed by the model (3) :
|
||||
- category_id
|
||||
- name
|
||||
- description
|
||||
*/
|
||||
|
||||
protected:
|
||||
|
||||
virtual void syncNestedModel(int row, const QStringList & relation);
|
||||
virtual void syncAllNestedModel(const QStringList & relation);
|
||||
|
||||
};
|
||||
|
||||
} // namespace model_view
|
||||
|
||||
#endif // _QXBLOG_CATEGORY_MODEL_VIEW_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
/************************************************************************************************
|
||||
** File created by QxEntityEditor 1.1.9 (2016/05/04 10:05) : please, do NOT modify this file ! **
|
||||
************************************************************************************************/
|
||||
|
||||
#ifndef _QXBLOG_COMMENT_MODEL_VIEW_H_
|
||||
#define _QXBLOG_COMMENT_MODEL_VIEW_H_
|
||||
|
||||
#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 "../../include/comment.h"
|
||||
|
||||
namespace model_view {
|
||||
|
||||
typedef qx::QxModel<comment> comment_model_base_class;
|
||||
|
||||
class QX_BLOG_DLL_EXPORT comment_model : public comment_model_base_class
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
comment_model(QObject * parent = 0);
|
||||
comment_model(qx::IxModel * other, QObject * parent);
|
||||
virtual ~comment_model();
|
||||
|
||||
Q_INVOKABLE QObject * blog_id(int row, bool bLoadFromDatabase = false, const QString & sAppendRelations = QString());
|
||||
|
||||
/* List of properties exposed by the model (3) :
|
||||
- comment_id
|
||||
- title
|
||||
- text
|
||||
*/
|
||||
|
||||
protected:
|
||||
|
||||
virtual void syncNestedModel(int row, const QStringList & relation);
|
||||
virtual void syncAllNestedModel(const QStringList & relation);
|
||||
|
||||
};
|
||||
|
||||
} // namespace model_view
|
||||
|
||||
#endif // _QXBLOG_COMMENT_MODEL_VIEW_H_
|
||||
9
test/qxBlogModelView/include/precompiled.h
Normal file
9
test/qxBlogModelView/include/precompiled.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef _QX_BLOG_PRECOMPILED_HEADER_H_
|
||||
#define _QX_BLOG_PRECOMPILED_HEADER_H_
|
||||
|
||||
#include <QxOrm.h>
|
||||
#include <QxModelView.h>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#endif // _QX_BLOG_PRECOMPILED_HEADER_H_
|
||||
Reference in New Issue
Block a user