| 104 | |
| 105 | |
| 106 | std::string DeepIterator::pathString() const { |
| 107 | std::stringstream s; |
| 108 | for (auto &component : _path) { |
| 109 | if (component.key) { |
| 110 | bool quote = false; |
| 111 | for (auto c : component.key) { |
| 112 | if (!isalnum(c) && c != '_') { |
| 113 | quote = true; |
| 114 | break; |
| 115 | } |
| 116 | } |
| 117 | s << (quote ? "[\"" : "."); |
| 118 | s.write((char*)component.key.buf, component.key.size); |
| 119 | if (quote) |
| 120 | s << "\"]"; |
| 121 | } else { |
| 122 | s << '[' << component.index << ']'; |
| 123 | } |
| 124 | } |
| 125 | return s.str(); |
| 126 | } |
| 127 | |
| 128 | |
| 129 | std::string DeepIterator::jsonPointer() const { |
no test coverage detected