Refactor ListInstance to a header file
This typedef is useful for the upcoming `move` command, so I want to
reuse it. It made no sense to put it in ast_values.hpp, so I just made a
new header.
Change-Id: Ia1ad07b8ac393a3f1aeffcdd4e19776390a00907
diff --git a/src/ast_path.hpp b/src/ast_path.hpp
index cb84e80..2d809bc 100644
--- a/src/ast_path.hpp
+++ b/src/ast_path.hpp
@@ -15,6 +15,7 @@
#include <vector>
#include "ast_values.hpp"
+#include "list_instance.hpp"
enum class Prefixes {
Always,
@@ -69,7 +70,7 @@
bool operator==(const listElement_& b) const;
std::string m_name;
- std::map<std::string, leaf_data_> m_keys;
+ ListInstance m_keys;
};
struct list_ {
diff --git a/src/datastore_access.hpp b/src/datastore_access.hpp
index 6412037..f9ea901 100644
--- a/src/datastore_access.hpp
+++ b/src/datastore_access.hpp
@@ -12,6 +12,7 @@
#include <optional>
#include <string>
#include "ast_values.hpp"
+#include "list_instance.hpp"
/*! \class DatastoreAccess
* \brief Abstract class for accessing a datastore
@@ -36,8 +37,6 @@
class Schema;
-using ListInstance = std::map<std::string, leaf_data_>;
-
class DatastoreAccess {
public:
using Tree = std::map<std::string, leaf_data_>;
diff --git a/src/list_instance.hpp b/src/list_instance.hpp
new file mode 100644
index 0000000..3fa19c9
--- /dev/null
+++ b/src/list_instance.hpp
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/
+ *
+ * Written by Václav Kubernát <kubernat@cesnet.cz>
+ *
+*/
+#pragma once
+#include <map>
+#include <string>
+#include "ast_values.hpp"
+
+using ListInstance = std::map<std::string, leaf_data_>;