| 11 | EndOffset(0) {} |
| 12 | |
| 13 | bool Definition::fromJson(const Json::Value &Root, |
| 14 | const TypeAnalysisReport &Report) { |
| 15 | try { |
| 16 | Array = Root["Array"].asBool(); |
| 17 | for (auto &ArrayID : Root["ArrayIDs"]) |
| 18 | ArrayIDs.emplace(ArrayID.asUInt()); |
| 19 | ArrayLen = Root["ArrayLen"].asBool(); |
| 20 | for (auto &ArrayLenID : Root["ArrayLenIDs"]) |
| 21 | ArrayLenIDs.emplace(ArrayLenID.asUInt()); |
| 22 | AssignOperatorRequired = Root["AssignOperatorRequired"].asBool(); |
| 23 | BufferAllocSize = Root["BufferAllocSize"].asBool(); |
| 24 | DataType = Root["DataType"].isNull() |
| 25 | ? nullptr |
| 26 | : std::make_shared<Type>(Root["DataType"], &Report); |
| 27 | Declaration = (Definition::DeclType)Root["Declaration"].asUInt(); |
| 28 | EndOffset = Root["EndOffset"].asUInt(); |
| 29 | FilePath = Root["FilePath"].asBool(); |
| 30 | for (auto &FilterJson : Root["Filters"]) |
| 31 | Filters.emplace(FilterJson.asString()); |
| 32 | ID = Root["ID"].asUInt(); |
| 33 | Namespace = Root["Namespace"].asString(); |
| 34 | Path = util::getNormalizedPath(Root["Path"].asString()); |
| 35 | Offset = Root["Offset"].asUInt(); |
| 36 | Length = Root["Length"].asUInt(); |
| 37 | LoopExit = Root["LoopExit"].asBool(); |
| 38 | TypeOffset = Root["TypeOffset"].asUInt(); |
| 39 | TypeString = Root["TypeString"].asString(); |
| 40 | Value = ASTValue(Root["Value"]); |
| 41 | VarName = Root["VarName"].asString(); |
| 42 | } catch (Json::Exception &E) { |
| 43 | return false; |
| 44 | } |
| 45 | return true; |
| 46 | } |
| 47 | |
| 48 | Json::Value Definition::toJson() const { |
| 49 | Json::Value Result; |