| 166 | } |
| 167 | |
| 168 | void StructTreeNode::readFromJson(const QJsonObject& json, StructTreeNode* parent) |
| 169 | { |
| 170 | m_parent = parent; |
| 171 | if (json["rootNode"] != QJsonValue::Undefined) |
| 172 | { |
| 173 | m_isGroup = false; |
| 174 | QJsonArray structTree = json["rootNode"].toArray(); |
| 175 | for (auto i : structTree) |
| 176 | { |
| 177 | QJsonObject node = i.toObject(); |
| 178 | StructTreeNode* childNode = new StructTreeNode(nullptr, nullptr); |
| 179 | childNode->readFromJson(node, this); |
| 180 | m_children.append(childNode); |
| 181 | } |
| 182 | } |
| 183 | else if (json["groupName"] != QJsonValue::Undefined) |
| 184 | { |
| 185 | m_isGroup = true; |
| 186 | m_nodeName = json["groupName"].toString(); |
| 187 | m_expanded = json["expanded"].toBool(); |
| 188 | QJsonArray groupChildren = json["groupChildren"].toArray(); |
| 189 | for (auto i : groupChildren) |
| 190 | { |
| 191 | QJsonObject node = i.toObject(); |
| 192 | StructTreeNode* childNode = new StructTreeNode(nullptr, nullptr); |
| 193 | childNode->readFromJson(node, this); |
| 194 | if (isNameAvailable(childNode->getName())) |
| 195 | m_children.append(childNode); |
| 196 | } |
| 197 | } |
| 198 | else |
| 199 | { |
| 200 | m_isGroup = false; |
| 201 | m_nodeName = json["structName"].toString(); |
| 202 | m_structDef = new StructDef(); |
| 203 | m_structDef->readFromJson(json["struct"].toObject()); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | void StructTreeNode::writeToJson(QJsonObject& json) const |
| 208 | { |
nothing calls this directly
no outgoing calls
no test coverage detected