MCPcopy Create free account
hub / github.com/aldelaro5/dolphin-memory-engine / readFromJson

Method readFromJson

Source/MemoryWatch/MemWatchTreeNode.cpp:136–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void MemWatchTreeNode::readFromJson(const QJsonObject& json,
137 const QMap<QString, QString> structNameReplacements,
138 MemWatchTreeNode* parent)
139{
140 m_parent = parent;
141 if (json["watchList"] != QJsonValue::Undefined)
142 {
143 m_isGroup = false;
144 QJsonArray watchList = json["watchList"].toArray();
145 for (auto i : watchList)
146 {
147 QJsonObject node = i.toObject();
148 MemWatchTreeNode* childNode = new MemWatchTreeNode(nullptr);
149 childNode->readFromJson(node, structNameReplacements, this);
150 m_children.append(childNode);
151 }
152 }
153 else if (json["groupName"] != QJsonValue::Undefined)
154 {
155 m_isGroup = true;
156 m_groupName = json["groupName"].toString();
157 if (json.contains("expanded"))
158 {
159 m_expanded = json["expanded"].toBool();
160 }
161 QJsonArray groupEntries = json["groupEntries"].toArray();
162 for (auto i : groupEntries)
163 {
164 QJsonObject node = i.toObject();
165 MemWatchTreeNode* childNode = new MemWatchTreeNode(nullptr);
166 childNode->readFromJson(node, structNameReplacements, this);
167 m_children.append(childNode);
168 }
169 }
170 else
171 {
172 m_isGroup = false;
173 m_entry = new MemWatchEntry();
174 m_entry->readFromJson(json);
175 if (m_entry->getType() == Common::MemType::type_struct &&
176 structNameReplacements.contains(m_entry->getStructName()))
177 m_entry->setStructName(structNameReplacements[m_entry->getStructName()]);
178 }
179}
180
181void MemWatchTreeNode::writeToJson(QJsonObject& json, const bool writeExpandedState) const
182{

Callers

nothing calls this directly

Calls 3

setStructNameMethod · 0.80
getTypeMethod · 0.45
getStructNameMethod · 0.45

Tested by

no test coverage detected