XNSim/XNCore/XNObject.h
2025-04-28 12:25:20 +08:00

85 lines
1.4 KiB
C++
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file XNObject.h
* @author jinchao
* @brief 基础对象类
* @version 1.0
* @date 2025-01-08
*
* @copyright Copyright (c) 2025 COMAC
*
*/
#pragma once
#include <QObject>
#include <QVariant>
#include <QtXml/QDomDocument>
#include "XNCore_global.h"
#include "XNLogger.h"
class XNObjectPrivate;
/**
* @brief 基础对象类
*/
class XNCORE_EXPORT XNObject : public QObject
{
/**
* @brief 宏定义用于支持Qt的元对象系统
*/
Q_OBJECT
/**
* @brief 宏定义,用于禁用拷贝构造函数
*/
Q_DISABLE_COPY(XNObject)
/**
* @brief 宏定义,用于声明私有数据成员
*/
Q_DECLARE_PRIVATE(XNObject)
/**
* @brief 宏定义用于声明属性uniqueId
*/
Q_PROPERTY(quint32 UniqueId READ getUniqueId WRITE setUniqueId)
public:
/**
* @brief 构造函数
* @param parent 父对象
*/
explicit XNObject(QObject *parent = nullptr);
/**
* @brief 析构函数
*/
virtual ~XNObject();
/**
* @brief 获取唯一ID
* @return 唯一ID
*/
quint32 getUniqueId();
/**
* @brief 设置唯一ID
* @param uniqueId 唯一ID
*/
void setUniqueId(const quint32 &uniqueId);
protected:
/**
* @brief 构造函数
* @param dd 私有数据成员
* @param parent 父对象
*/
XNObject(XNObjectPrivate &dd, QObject *parent = nullptr);
protected:
/**
* @brief 私有数据成员
*/
XNObjectPrivate *d_ptr;
};