1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #ifndef CMIND_H
- #define CMIND_H
- #include "CNode.h"
- #include <QObject>
- class CMind : public QObject
- {
- Q_OBJECT
- public:
- explicit CMind(QObject *parent = nullptr);
- // 节点数据
- QList<CNodeData> nodeList() const;
- void setNodeList(QList<CNodeData> list);
- bool isNodeValid(CNodeData n) const;
- CNodeData node(int number) const;
- bool containsNode(int number) const;
- void addNode(CNodeData n);
- void removeNode(int number);
- CNodeData root() const;
- bool hasAncestor(int childNumber, int ancestorNumber) const;
- // 最大的节点编号, 创建节点时, 编号递增
- int maxNumber() const;
- // 最小的节点编号, 由于创建节点时编号递增, 所以此为根节点
- int minNumber() const;
- private:
- QList<int> numberList() const; // 节点编号列表
- private:
- QList<CNodeData> m_nodeList; // 节点列表
- };
- #endif // CMIND_H
|