add class representing the node tree

add CParser class

This class holds the definitions of all the grammars. It also holds a reference a CTree instance it uses when parsing. This means, that it doesn't have to be declared globally.

Change-Id: I3ca23253b546e26612106067045e1e7d3e2ef919
diff --git a/src/CTree.hpp b/src/CTree.hpp
new file mode 100644
index 0000000..88bccae
--- /dev/null
+++ b/src/CTree.hpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
+ *
+ * Written by Václav Kubernát <kubervac@fit.cvut.cz>
+ *
+*/
+
+#pragma once
+
+#include <stdexcept>
+#include <unordered_map>
+#include <unordered_set>
+
+class InvalidNodeException : public std::invalid_argument {
+public:
+    using std::invalid_argument::invalid_argument;
+    ~InvalidNodeException() override;
+
+};
+
+/*! \class CTree
+ *     \brief The class representing the tree, that the user traverses.
+ *
+ *         This class holds the current position in the tree and handles changing the position,
+ *         including checking what nodes are available.
+ *         */
+class CTree {
+public:
+    bool checkNode(const std::string& location, const std::string& node) const;
+    void changeNode(const std::string& node);
+    void initDefault();
+    std::string currentNode() const;
+
+private:
+    void addNode(const std::string& location, const std::string& node);
+    const std::unordered_set<std::string>& children(const std::string& node) const;
+
+    std::unordered_map<std::string, std::unordered_set<std::string>> m_nodes;
+    std::string m_curDir;
+};