| 83 | } |
| 84 | |
| 85 | Json::Value toJSON() const { |
| 86 | Json::Value json(Json::objectValue); |
| 87 | json["k"] = key; |
| 88 | if (fake_df_id < 0) |
| 89 | json["f"] = fake_df_id; |
| 90 | if (str_value.size()) |
| 91 | json["s"] = str_value; |
| 92 | size_t num_set_ints = 0; |
| 93 | for (size_t i = 0; i < PersistentDataItem::NumInts; i++) { |
| 94 | if (int_values.at(i) != -1) |
| 95 | num_set_ints = i + 1; |
| 96 | } |
| 97 | if (num_set_ints) { |
| 98 | Json::Value ints(Json::arrayValue); |
| 99 | for (size_t i = 0; i < num_set_ints; i++) |
| 100 | ints.append(int_values.at(i)); |
| 101 | json["i"] = std::move(ints); |
| 102 | } |
| 103 | return json; |
| 104 | } |
| 105 | |
| 106 | bool isReferencedBy(const PersistentDataItem & item) { |
| 107 | return item.data.get() == this; |