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,34 @@
#ifndef _QX_BLOG_AUTHOR_H_
#define _QX_BLOG_AUTHOR_H_
class blog;
class QX_BLOG_DLL_EXPORT author : public qx::IxPersistable
{
QX_PERSISTABLE_HPP(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() : qx::IxPersistable(), m_id("0"), 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_

View File

@@ -0,0 +1,37 @@
#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 qx::IxPersistable
{
QX_PERSISTABLE_HPP(blog)
QX_REGISTER_FRIEND_CLASS(blog)
public:
// -- properties
long 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() : qx::IxPersistable(), m_id(0) { ; }
virtual ~blog() { ; }
#ifndef _QX_NO_JSON
// -- function callable by introspection and REST API
static QJsonValue helloWorld(const QJsonValue & request);
#endif // _QX_NO_JSON
private:
// -- function to validate a blog instance
void isValid(qx::QxInvalidValueX & invalidValues);
};
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_

View File

@@ -0,0 +1,28 @@
#ifndef _QX_BLOG_CATEGORY_H_
#define _QX_BLOG_CATEGORY_H_
class blog;
class QX_BLOG_DLL_EXPORT category : public qx::IxPersistable
{
QX_PERSISTABLE_HPP(category)
public:
// -- typedef
typedef std::shared_ptr<blog> blog_ptr;
typedef qx::QxCollection<long, blog_ptr> list_blog;
// -- properties
long m_id;
QString m_name;
QString m_desc;
list_blog m_blogX;
// -- contructor, virtual destructor
category() : qx::IxPersistable(), m_id(0) { ; }
virtual ~category() { ; }
};
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_

View File

@@ -0,0 +1,27 @@
#ifndef _QX_BLOG_COMMENT_H_
#define _QX_BLOG_COMMENT_H_
class blog;
class QX_BLOG_DLL_EXPORT comment : public qx::IxPersistable
{
QX_PERSISTABLE_HPP(comment)
public:
// -- typedef
typedef std::shared_ptr<blog> blog_ptr;
// -- properties
long m_id;
QString m_text;
QDateTime m_dt_create;
blog_ptr m_blog;
// -- contructor, virtual destructor
comment() : qx::IxPersistable(), m_id(0) { ; }
virtual ~comment() { ; }
};
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_

View 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_

View 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_