first commit
This commit is contained in:
55
test/qxBlogMongoDB/include/TestQtProperty.h
Normal file
55
test/qxBlogMongoDB/include/TestQtProperty.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#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_BLOG_DLL_EXPORT TestQtProperty : public QObject, public qx::IxPersistable
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
QX_PERSISTABLE_HPP(TestQtProperty)
|
||||
Q_PROPERTY(QString 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:
|
||||
|
||||
QString m_id;
|
||||
long m_number;
|
||||
QString m_desc;
|
||||
QDateTime m_birthDate;
|
||||
QVariant m_photo;
|
||||
|
||||
public:
|
||||
|
||||
TestQtProperty() : QObject(), m_number(0) { ; }
|
||||
virtual ~TestQtProperty() { ; }
|
||||
|
||||
QString 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(const QString & id) { m_id = id; }
|
||||
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_PRIMARY_KEY(TestQtProperty, QString)
|
||||
QX_REGISTER_HPP_QX_BLOG(TestQtProperty, QObject, 0)
|
||||
|
||||
#endif // _QX_TEST_QT_META_PROPERTY_H_
|
||||
33
test/qxBlogMongoDB/include/author.h
Normal file
33
test/qxBlogMongoDB/include/author.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#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;
|
||||
// -- 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_sex(unknown) { ; }
|
||||
virtual ~author() { ; }
|
||||
// -- methods
|
||||
int age() const;
|
||||
};
|
||||
|
||||
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_
|
||||
29
test/qxBlogMongoDB/include/blog.h
Normal file
29
test/qxBlogMongoDB/include/blog.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#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:
|
||||
// -- properties
|
||||
QString m_id;
|
||||
QString m_text;
|
||||
QDateTime m_dt_creation;
|
||||
author_ptr m_author;
|
||||
list_comment m_commentX;
|
||||
list_category m_categoryX;
|
||||
// -- contructor, virtual destructor
|
||||
blog() { ; }
|
||||
virtual ~blog() { ; }
|
||||
};
|
||||
|
||||
QX_REGISTER_PRIMARY_KEY(blog, QString)
|
||||
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_
|
||||
28
test/qxBlogMongoDB/include/category.h
Normal file
28
test/qxBlogMongoDB/include/category.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#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;
|
||||
// -- properties
|
||||
QString m_id;
|
||||
QString m_name;
|
||||
QString m_desc;
|
||||
list_blog m_blogX;
|
||||
// -- contructor, virtual destructor
|
||||
category() { ; }
|
||||
virtual ~category() { ; }
|
||||
};
|
||||
|
||||
QX_REGISTER_PRIMARY_KEY(category, QString)
|
||||
QX_REGISTER_HPP_QX_BLOG(category, qx::trait::no_base_class_defined, 0)
|
||||
|
||||
typedef QSharedPointer<category> category_ptr;
|
||||
typedef qx::QxCollection<QString, category_ptr> list_category;
|
||||
|
||||
#endif // _QX_BLOG_CATEGORY_H_
|
||||
27
test/qxBlogMongoDB/include/comment.h
Normal file
27
test/qxBlogMongoDB/include/comment.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#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;
|
||||
// -- properties
|
||||
QString m_id;
|
||||
QString m_text;
|
||||
QDateTime m_dt_create;
|
||||
blog_ptr m_blog;
|
||||
// -- contructor, virtual destructor
|
||||
comment() { ; }
|
||||
virtual ~comment() { ; }
|
||||
};
|
||||
|
||||
QX_REGISTER_PRIMARY_KEY(comment, QString)
|
||||
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/qxBlogMongoDB/include/export.h
Normal file
18
test/qxBlogMongoDB/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_
|
||||
8
test/qxBlogMongoDB/include/precompiled.h
Normal file
8
test/qxBlogMongoDB/include/precompiled.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _QX_BLOG_PRECOMPILED_HEADER_H_
|
||||
#define _QX_BLOG_PRECOMPILED_HEADER_H_
|
||||
|
||||
#include <QxOrm.h>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#endif // _QX_BLOG_PRECOMPILED_HEADER_H_
|
||||
Reference in New Issue
Block a user