| 39 | std::deque<SerializeStackEntry> Entries; |
| 40 | |
| 41 | inline void Push(const String& name, const Value& val) |
| 42 | { |
| 43 | Object::Ptr obj; |
| 44 | |
| 45 | if (val.IsObject()) |
| 46 | obj = val; |
| 47 | |
| 48 | if (obj) { |
| 49 | for (const auto& entry : Entries) { |
| 50 | if (entry.Val == obj) { |
| 51 | std::vector<String> path; |
| 52 | for (const auto& entry : Entries) |
| 53 | path.push_back(entry.Name); |
| 54 | path.push_back(name); |
| 55 | BOOST_THROW_EXCEPTION(CircularReferenceError("Cannot serialize object which recursively refers to itself. Attribute path which leads to the cycle: " + boost::algorithm::join(path, " -> "), path)); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | Entries.push_back({ name, obj }); |
| 61 | } |
| 62 | |
| 63 | inline void Pop() |
| 64 | { |
no test coverage detected