move joinPaths to utils.cpp
Change-Id: I8012fa004d174ddf42086b109caab3f2d7857d1e
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ac9278..5fa1ac2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,7 @@
src/CTree.cpp
src/CParser.cpp
src/ast.cpp
+ src/utils.cpp
)
add_library(parser STATIC ${parser_SRCS})
diff --git a/src/CTree.cpp b/src/CTree.cpp
index 7d89cf3..de16250 100644
--- a/src/CTree.cpp
+++ b/src/CTree.cpp
@@ -7,16 +7,10 @@
*/
#include "CTree.hpp"
+#include "utils.hpp"
InvalidNodeException::~InvalidNodeException() = default;
-std::string joinPaths(const std::string& prefix, const std::string& suffix)
-{
- if (prefix.empty() || suffix.empty())
- return prefix + suffix;
- else
- return prefix + '/' + suffix;
-}
bool TreeNode::operator<(const TreeNode& b) const
{
diff --git a/src/ast.hpp b/src/ast.hpp
index f55ab39..93127d5 100644
--- a/src/ast.hpp
+++ b/src/ast.hpp
@@ -14,6 +14,7 @@
#include <vector>
#include "CTree.hpp"
+#include "utils.hpp"
namespace x3 = boost::spirit::x3;
namespace ascii = boost::spirit::x3::ascii;
diff --git a/src/utils.cpp b/src/utils.cpp
new file mode 100644
index 0000000..38bfe7d
--- /dev/null
+++ b/src/utils.cpp
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
+ * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
+ *
+ * Written by Václav Kubernát <kubervac@fit.cvut.cz>
+ *
+*/
+#include "utils.hpp"
+
+std::string joinPaths(const std::string& prefix, const std::string& suffix)
+{
+ if (prefix.empty() || suffix.empty())
+ return prefix + suffix;
+ else
+ return prefix + '/' + suffix;
+}
diff --git a/src/utils.hpp b/src/utils.hpp
new file mode 100644
index 0000000..54c455a
--- /dev/null
+++ b/src/utils.hpp
@@ -0,0 +1,10 @@
+/*
+ * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
+ * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
+ *
+ * Written by Václav Kubernát <kubervac@fit.cvut.cz>
+ *
+*/
+#include <string>
+
+std::string joinPaths(const std::string& prefix, const std::string& suffix);