Put empty path checking to a function
Instead of checking for .empty() everywhere I'm pushing path fragments,
do it once in a new function called pushFragment, which resolves nodeup_
fragments.
Change-Id: I2528f814991eed5218d8272ea386bd732a7448a5
diff --git a/src/ast_path.hpp b/src/ast_path.hpp
index da99a26..91268e6 100644
--- a/src/ast_path.hpp
+++ b/src/ast_path.hpp
@@ -117,6 +117,8 @@
Scope m_scope = Scope::Relative;
std::vector<schemaNode_> m_nodes;
TrailingSlash m_trailingSlash = TrailingSlash::NonPresent;
+ // @brief Pushes a new fragment. Pops a fragment if it's nodeup_
+ void pushFragment(const schemaNode_& fragment);
};
struct dataPath_ {
@@ -124,6 +126,9 @@
Scope m_scope = Scope::Relative;
std::vector<dataNode_> m_nodes;
TrailingSlash m_trailingSlash = TrailingSlash::NonPresent;
+
+ // @brief Pushes a new fragment. Pops a fragment if it's nodeup_
+ void pushFragment(const dataNode_& fragment);
};
std::string nodeToSchemaString(decltype(dataPath_::m_nodes)::value_type node);