| 7 | #include "StructDef.h" |
| 8 | |
| 9 | class StructTreeNode |
| 10 | { |
| 11 | public: |
| 12 | explicit StructTreeNode(StructDef* const structDef, StructTreeNode* const parent, |
| 13 | bool isGroup = false, QString name = {""}); |
| 14 | explicit StructTreeNode(StructTreeNode* node); |
| 15 | ~StructTreeNode(); |
| 16 | |
| 17 | StructTreeNode(const StructTreeNode&) = delete; |
| 18 | StructTreeNode(StructTreeNode&&) = delete; |
| 19 | StructTreeNode& operator=(const StructTreeNode&) = delete; |
| 20 | StructTreeNode& operator=(StructTreeNode&&) = delete; |
| 21 | |
| 22 | bool isGroup() const; |
| 23 | bool isExpanded() const; |
| 24 | void setExpanded(const bool expanded); |
| 25 | const QString& getName(); |
| 26 | void setName(const QString& name); |
| 27 | bool isNameAvailable(const QString name) const; |
| 28 | StructTreeNode* getParent() const; |
| 29 | void setParent(StructTreeNode* parent); |
| 30 | int getRow() const; |
| 31 | bool hasChildren() const; |
| 32 | int childrenCount() const; |
| 33 | const QVector<StructTreeNode*>& getChildren() const; |
| 34 | void setChildren(QVector<StructTreeNode*> children); |
| 35 | QVector<QString> getChildNames(); |
| 36 | StructDef* getStructDef() const; |
| 37 | void setStructDef(StructDef* structDef); |
| 38 | |
| 39 | void appendChild(StructTreeNode* node); |
| 40 | void insertChild(int row, StructTreeNode* node); |
| 41 | void removeChild(int row); |
| 42 | void removeChild(StructTreeNode* child); |
| 43 | void removeChildren(); |
| 44 | void deleteChildren(); |
| 45 | |
| 46 | void readFromJson(const QJsonObject& json, StructTreeNode* parent = nullptr); |
| 47 | void writeToJson(QJsonObject& json) const; |
| 48 | |
| 49 | QVector<QString> getStructNames(bool includeGroups = false, QString prefix = QString()); |
| 50 | QString getNameSpace(); |
| 51 | QString appendNameToNameSpace(QString nameSpace) const; |
| 52 | u32 getSizeOfStruct(QString nameSpace); |
| 53 | StructTreeNode* findNode(QString nameSpace, bool returnDeepest = false); |
| 54 | StructTreeNode* findDeepestAvailableNode(QString nameSpace); |
| 55 | |
| 56 | private: |
| 57 | void updateName(); |
| 58 | |
| 59 | bool m_isGroup; |
| 60 | QString m_nodeName; |
| 61 | bool m_expanded{}; |
| 62 | StructDef* m_structDef; |
| 63 | StructTreeNode* m_parent; |
| 64 | |
| 65 | QVector<StructTreeNode*> m_children{}; |
| 66 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected