Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/ |
| 3 | * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/ |
| 4 | * |
| 5 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #include <experimental/iterator> |
Václav Kubernát | 509ce65 | 2019-05-29 19:46:44 +0200 | [diff] [blame] | 10 | #include <sstream> |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 11 | #include "ast_path.hpp" |
| 12 | #include "utils.hpp" |
| 13 | |
| 14 | container_::container_(const std::string& name) |
| 15 | : m_name(name) |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | bool container_::operator==(const container_& b) const |
| 20 | { |
| 21 | return this->m_name == b.m_name; |
| 22 | } |
| 23 | |
| 24 | leaf_::leaf_(const std::string& name) |
| 25 | : m_name(name) |
| 26 | { |
| 27 | } |
| 28 | |
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame] | 29 | bool leafListElement_::operator==(const leafListElement_& b) const |
| 30 | { |
| 31 | return this->m_name == b.m_name && this->m_value == b.m_value; |
| 32 | } |
| 33 | |
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame] | 34 | leafList_::leafList_(const std::string& name) |
| 35 | : m_name(name) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | bool leafList_::operator==(const leafList_& b) const |
| 40 | { |
| 41 | return this->m_name == b.m_name; |
| 42 | } |
| 43 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 44 | bool module_::operator==(const module_& b) const |
| 45 | { |
| 46 | return this->m_name == b.m_name; |
| 47 | } |
| 48 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 49 | dataNode_::dataNode_() = default; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 50 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 51 | dataNode_::dataNode_(decltype(m_suffix) node) |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 52 | : m_suffix(node) |
| 53 | { |
| 54 | } |
| 55 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 56 | dataNode_::dataNode_(module_ module, decltype(m_suffix) node) |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 57 | : m_prefix(module) |
| 58 | , m_suffix(node) |
| 59 | { |
| 60 | } |
| 61 | |
Václav Kubernát | 2db124c | 2020-05-28 21:58:36 +0200 | [diff] [blame] | 62 | dataNode_::dataNode_(boost::optional<module_> module, decltype(m_suffix) node) |
| 63 | : m_prefix(module) |
| 64 | , m_suffix(node) |
| 65 | { |
| 66 | |
| 67 | } |
| 68 | |
Václav Kubernát | 5c75b25 | 2018-10-10 18:33:47 +0200 | [diff] [blame] | 69 | schemaNode_::schemaNode_(decltype(m_suffix) node) |
| 70 | : m_suffix(node) |
| 71 | { |
| 72 | } |
| 73 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 74 | schemaNode_::schemaNode_(module_ module, decltype(m_suffix) node) |
| 75 | : m_prefix(module) |
| 76 | , m_suffix(node) |
| 77 | { |
| 78 | } |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 79 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 80 | schemaNode_::schemaNode_() = default; |
| 81 | |
| 82 | bool schemaNode_::operator==(const schemaNode_& b) const |
| 83 | { |
| 84 | return this->m_suffix == b.m_suffix && this->m_prefix == b.m_prefix; |
| 85 | } |
| 86 | |
| 87 | bool dataNode_::operator==(const dataNode_& b) const |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 88 | { |
| 89 | return this->m_suffix == b.m_suffix && this->m_prefix == b.m_prefix; |
| 90 | } |
| 91 | |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 92 | bool leaf_::operator==(const leaf_& b) const |
| 93 | { |
| 94 | return this->m_name == b.m_name; |
| 95 | } |
| 96 | |
Václav Kubernát | c15fe82 | 2020-06-04 11:28:39 +0200 | [diff] [blame] | 97 | listElement_::listElement_(const std::string& listName, const ListInstance& keys) |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 98 | : m_name(listName) |
| 99 | , m_keys(keys) |
| 100 | { |
| 101 | } |
| 102 | |
| 103 | bool listElement_::operator==(const listElement_& b) const |
| 104 | { |
| 105 | return (this->m_name == b.m_name && this->m_keys == b.m_keys); |
| 106 | } |
| 107 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 108 | bool list_::operator==(const list_& b) const |
| 109 | { |
| 110 | return (this->m_name == b.m_name); |
| 111 | } |
| 112 | |
Václav Kubernát | e7248b2 | 2020-06-26 15:38:59 +0200 | [diff] [blame^] | 113 | bool rpcNode_::operator==(const rpcNode_& other) const |
| 114 | { |
| 115 | return this->m_name == other.m_name; |
| 116 | } |
| 117 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 118 | list_::list_(const std::string& listName) |
| 119 | : m_name(listName) |
| 120 | { |
| 121 | } |
| 122 | |
Jan Kundrát | 97376f7 | 2020-06-15 19:26:31 +0200 | [diff] [blame] | 123 | namespace { |
| 124 | template <typename T, typename U> |
| 125 | auto findFirstOf(const std::vector<U>& nodes) |
| 126 | { |
| 127 | return std::find_if(nodes.begin(), nodes.end(), [](const auto& e) { |
| 128 | return std::holds_alternative<T>(e.m_suffix); |
| 129 | }); |
| 130 | } |
| 131 | |
| 132 | template <typename T> |
| 133 | void validatePathNodes(const std::vector<T>& nodes) |
| 134 | { |
| 135 | static_assert(std::is_same<T, dataNode_>() || std::is_same<T, schemaNode_>()); |
| 136 | |
| 137 | if (nodes.empty()) { |
| 138 | // there are default ctors, so it makes sense to specify the same thing via explicit args and not fail |
| 139 | return; |
| 140 | } |
| 141 | |
| 142 | if (auto firstLeaf = findFirstOf<leaf_>(nodes); |
| 143 | firstLeaf != nodes.end() && firstLeaf != nodes.end() - 1) { |
| 144 | throw std::logic_error{"Cannot put any extra nodes after a leaf"}; |
| 145 | } |
| 146 | |
| 147 | if (auto firstLeafList = findFirstOf<leafList_>(nodes); |
| 148 | firstLeafList != nodes.end() && firstLeafList != nodes.end() - 1) { |
| 149 | throw std::logic_error{"Cannot put any extra nodes after a leaf-list"}; |
| 150 | } |
| 151 | |
| 152 | if constexpr (std::is_same<T, dataNode_>()) { |
| 153 | if (auto firstLeafListElements = findFirstOf<leafListElement_>(nodes); |
| 154 | firstLeafListElements != nodes.end() && firstLeafListElements != nodes.end() - 1) { |
| 155 | throw std::logic_error{"Cannot put any extra nodes after a leaf-list with element specification"}; |
| 156 | } |
| 157 | if (auto firstList = findFirstOf<list_>(nodes); |
| 158 | firstList != nodes.end() && firstList != nodes.end() - 1) { |
| 159 | throw std::logic_error{ |
| 160 | "A list with no key specification can be present only as a last item in a dataPath. Did you mean to use a schemaPath?" |
| 161 | }; |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
Václav Kubernát | 51fa48e | 2020-07-08 17:17:34 +0200 | [diff] [blame] | 167 | schemaPath_::schemaPath_() = default; |
Jan Kundrát | 97376f7 | 2020-06-15 19:26:31 +0200 | [diff] [blame] | 168 | |
| 169 | schemaPath_::schemaPath_(const Scope scope, const std::vector<schemaNode_>& nodes, const TrailingSlash trailingSlash) |
| 170 | : m_scope(scope) |
| 171 | , m_nodes(nodes) |
| 172 | , m_trailingSlash(trailingSlash) |
| 173 | { |
| 174 | validatePathNodes(m_nodes); |
| 175 | } |
| 176 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 177 | bool schemaPath_::operator==(const schemaPath_& b) const |
| 178 | { |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 179 | if (this->m_nodes.size() != b.m_nodes.size()) { |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 180 | return false; |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 181 | } |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 182 | return this->m_nodes == b.m_nodes; |
| 183 | } |
| 184 | |
Václav Kubernát | 51fa48e | 2020-07-08 17:17:34 +0200 | [diff] [blame] | 185 | dataPath_::dataPath_() = default; |
Jan Kundrát | 97376f7 | 2020-06-15 19:26:31 +0200 | [diff] [blame] | 186 | |
| 187 | dataPath_::dataPath_(const Scope scope, const std::vector<dataNode_>& nodes, const TrailingSlash trailingSlash) |
| 188 | : m_scope(scope) |
| 189 | , m_nodes(nodes) |
| 190 | , m_trailingSlash(trailingSlash) |
| 191 | { |
| 192 | validatePathNodes(m_nodes); |
| 193 | } |
| 194 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 195 | bool dataPath_::operator==(const dataPath_& b) const |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 196 | { |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 197 | if (this->m_nodes.size() != b.m_nodes.size()) { |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 198 | return false; |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 199 | } |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 200 | return this->m_nodes == b.m_nodes; |
| 201 | } |
| 202 | |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 203 | struct nodeToSchemaStringVisitor { |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 204 | std::string operator()(const nodeup_&) const |
| 205 | { |
| 206 | return ".."; |
| 207 | } |
| 208 | template <class T> |
| 209 | std::string operator()(const T& node) const |
| 210 | { |
| 211 | return node.m_name; |
| 212 | } |
| 213 | }; |
Jan Kundrát | 2a8f433 | 2018-09-14 17:05:31 +0200 | [diff] [blame] | 214 | |
| 215 | std::string escapeListKeyString(const std::string& what) |
| 216 | { |
| 217 | // If we have both single and double quote, then we're screwed, but that "shouldn't happen" |
| 218 | // in <= YANG 1.1 due to limitations in XPath 1.0. |
| 219 | if (what.find('\'') != std::string::npos) { |
| 220 | return '\"' + what + '\"'; |
| 221 | } else { |
| 222 | return '\'' + what + '\''; |
| 223 | } |
| 224 | } |
| 225 | |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 226 | struct nodeToDataStringVisitor { |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 227 | std::string operator()(const listElement_& node) const |
| 228 | { |
| 229 | std::ostringstream res; |
| 230 | res << node.m_name + "["; |
| 231 | std::transform(node.m_keys.begin(), node.m_keys.end(), |
Václav Kubernát | 5395e71 | 2019-12-03 18:24:33 +0100 | [diff] [blame] | 232 | std::experimental::make_ostream_joiner(res, "]["), |
Václav Kubernát | 7707cae | 2020-01-16 12:04:53 +0100 | [diff] [blame] | 233 | [] (const auto& it) { return it.first + "=" + escapeListKeyString(leafDataToString(it.second)); }); |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 234 | res << "]"; |
Václav Kubernát | ebca255 | 2018-06-08 19:06:02 +0200 | [diff] [blame] | 235 | return res.str(); |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 236 | } |
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame] | 237 | std::string operator()(const leafListElement_& node) const |
| 238 | { |
| 239 | return node.m_name + "[.=" + escapeListKeyString(leafDataToString(node.m_value)) + "]"; |
| 240 | } |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 241 | std::string operator()(const nodeup_&) const |
| 242 | { |
| 243 | return ".."; |
| 244 | } |
| 245 | template <class T> |
| 246 | std::string operator()(const T& node) const |
| 247 | { |
| 248 | return node.m_name; |
| 249 | } |
| 250 | }; |
| 251 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 252 | std::string nodeToSchemaString(decltype(dataPath_::m_nodes)::value_type node) |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 253 | { |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 254 | return std::visit(nodeToSchemaStringVisitor(), node.m_suffix); |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 255 | } |
| 256 | |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 257 | std::string pathToDataString(const dataPath_& path, Prefixes prefixes) |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 258 | { |
| 259 | std::string res; |
Václav Kubernát | 5395e71 | 2019-12-03 18:24:33 +0100 | [diff] [blame] | 260 | if (path.m_scope == Scope::Absolute) { |
| 261 | res = "/"; |
| 262 | } |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 263 | |
Václav Kubernát | ef08574 | 2020-04-21 09:28:44 +0200 | [diff] [blame] | 264 | for (const auto& it : path.m_nodes) { |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 265 | if (it.m_prefix) { |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 266 | res = joinPaths(res, it.m_prefix.value().m_name + ":" + std::visit(nodeToDataStringVisitor(), it.m_suffix)); |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 267 | } else { |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 268 | res = joinPaths(res, (prefixes == Prefixes::Always ? path.m_nodes.at(0).m_prefix.value().m_name + ":" : "") + std::visit(nodeToDataStringVisitor(), it.m_suffix)); |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 269 | } |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 270 | } |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 271 | |
| 272 | return res; |
| 273 | } |
| 274 | |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 275 | std::string pathToSchemaString(const schemaPath_& path, Prefixes prefixes) |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 276 | { |
| 277 | std::string res; |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 278 | if (path.m_scope == Scope::Absolute) { |
| 279 | res = "/"; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 280 | } |
| 281 | |
Václav Kubernát | ef08574 | 2020-04-21 09:28:44 +0200 | [diff] [blame] | 282 | for (const auto& it : path.m_nodes) { |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 283 | if (it.m_prefix) { |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 284 | res = joinPaths(res, it.m_prefix.value().m_name + ":" + std::visit(nodeToSchemaStringVisitor(), it.m_suffix)); |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 285 | } else { |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 286 | res = joinPaths(res, (prefixes == Prefixes::Always ? path.m_nodes.at(0).m_prefix.value().m_name + ":" : "") + std::visit(nodeToSchemaStringVisitor(), it.m_suffix)); |
Václav Kubernát | 3a43323 | 2020-07-08 17:52:50 +0200 | [diff] [blame] | 287 | } |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 288 | } |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 289 | return res; |
| 290 | } |
| 291 | |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 292 | std::string pathToSchemaString(const dataPath_& path, Prefixes prefixes) |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 293 | { |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 294 | return pathToSchemaString(dataPathToSchemaPath(path), prefixes); |
Václav Kubernát | 5c75b25 | 2018-10-10 18:33:47 +0200 | [diff] [blame] | 295 | } |
| 296 | |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 297 | struct dataSuffixToSchemaSuffix { |
| 298 | using ReturnType = decltype(schemaNode_::m_suffix); |
| 299 | ReturnType operator()(const listElement_& listElement) const |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 300 | { |
| 301 | return list_{listElement.m_name}; |
| 302 | } |
| 303 | |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 304 | ReturnType operator()(const leafListElement_& leafListElement) const |
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame] | 305 | { |
| 306 | return leafList_{leafListElement.m_name}; |
| 307 | } |
| 308 | |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 309 | template <typename T> |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 310 | ReturnType operator()(const T& suffix) const |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 311 | { |
| 312 | return suffix; |
| 313 | } |
| 314 | }; |
| 315 | |
| 316 | schemaNode_ dataNodeToSchemaNode(const dataNode_& node) |
| 317 | { |
| 318 | schemaNode_ res; |
| 319 | res.m_prefix = node.m_prefix; |
Václav Kubernát | b5ca154 | 2020-05-27 01:03:54 +0200 | [diff] [blame] | 320 | res.m_suffix = std::visit(dataSuffixToSchemaSuffix(), node.m_suffix); |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 321 | return res; |
| 322 | } |
| 323 | |
| 324 | schemaPath_ dataPathToSchemaPath(const dataPath_& path) |
| 325 | { |
Václav Kubernát | bf083ec | 2019-02-19 13:58:09 +0100 | [diff] [blame] | 326 | schemaPath_ res{path.m_scope, {}}; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 327 | |
Václav Kubernát | bf083ec | 2019-02-19 13:58:09 +0100 | [diff] [blame] | 328 | std::transform(path.m_nodes.begin(), path.m_nodes.end(), |
| 329 | std::back_inserter(res.m_nodes), |
| 330 | [](const dataNode_& node) { return dataNodeToSchemaNode(node); }); |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 331 | |
Václav Kubernát | bf083ec | 2019-02-19 13:58:09 +0100 | [diff] [blame] | 332 | return res; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 333 | } |
Václav Kubernát | e781b90 | 2020-06-15 14:35:11 +0200 | [diff] [blame] | 334 | |
| 335 | namespace { |
| 336 | template <typename NodeType> |
| 337 | void impl_pushFragment(std::vector<NodeType>& where, const NodeType& what) |
| 338 | { |
| 339 | if (std::holds_alternative<nodeup_>(what.m_suffix)) { |
| 340 | if (!where.empty()) { // Allow going up, when already at root |
| 341 | where.pop_back(); |
| 342 | } |
| 343 | } else { |
Václav Kubernát | faacd02 | 2020-07-08 16:44:38 +0200 | [diff] [blame] | 344 | where.emplace_back(what); |
Václav Kubernát | e781b90 | 2020-06-15 14:35:11 +0200 | [diff] [blame] | 345 | } |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | void schemaPath_::pushFragment(const schemaNode_& fragment) |
| 350 | { |
| 351 | impl_pushFragment(m_nodes, fragment); |
Jan Kundrát | 97376f7 | 2020-06-15 19:26:31 +0200 | [diff] [blame] | 352 | validatePathNodes(m_nodes); |
Václav Kubernát | e781b90 | 2020-06-15 14:35:11 +0200 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | void dataPath_::pushFragment(const dataNode_& fragment) |
| 356 | { |
| 357 | impl_pushFragment(m_nodes, fragment); |
Jan Kundrát | 97376f7 | 2020-06-15 19:26:31 +0200 | [diff] [blame] | 358 | validatePathNodes(m_nodes); |
Václav Kubernát | e781b90 | 2020-06-15 14:35:11 +0200 | [diff] [blame] | 359 | } |