diff --git a/.gitignore b/.gitignore
index 6ab8fa8..942182a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ cscope.in.out
cscope.po.out
cscope.out
tags
+autom4te.cache/
diff --git a/include/pq/implem/string_bt.hpp b/include/pq/implem/string_bt.hpp
index a10981b..8295ab7 100644
--- a/include/pq/implem/string_bt.hpp
+++ b/include/pq/implem/string_bt.hpp
@@ -1,4 +1,4 @@
-/* Copyright 2015, Michele Santullo
+/* Copyright 2016, Michele Santullo
* This file is part of "dindexer".
*
* "dindexer" is free software: you can redistribute it and/or modify
diff --git a/src/navigate/CMakeLists.txt b/src/navigate/CMakeLists.txt
index c63eb83..44cfe5f 100644
--- a/src/navigate/CMakeLists.txt
+++ b/src/navigate/CMakeLists.txt
@@ -4,7 +4,7 @@ add_executable(${PROJECT_NAME}
main.cpp
commandline.cpp
commandprocessor.cpp
- dirmanager.cpp
+ genericpath.cpp
)
target_include_directories(${PROJECT_NAME}
diff --git a/src/navigate/dirmanager.cpp b/src/navigate/genericpath.cpp
similarity index 95%
rename from src/navigate/dirmanager.cpp
rename to src/navigate/genericpath.cpp
index d608dc6..96fe904 100644
--- a/src/navigate/dirmanager.cpp
+++ b/src/navigate/genericpath.cpp
@@ -15,7 +15,7 @@
* along with "dindexer". If not, see .
*/
-#include "dirmanager.hpp"
+#include "genericpath.hpp"
#include "helpers/infix_iterator.hpp"
#include
#include
@@ -62,7 +62,7 @@ namespace din {
}
} //unnamed namespace
- void DirManager::push_piece (const std::string& parPiece) {
+ void GenericPath::push_piece (const std::string& parPiece) {
using boost::spirit::qi::parse;
PathGrammar gramm;
@@ -97,7 +97,7 @@ namespace din {
assert(parse_result);
}
- std::string DirManager::to_string() const {
+ std::string GenericPath::to_string() const {
std::ostringstream oss;
oss << '/';
boost::copy(m_stack, infix_ostream_iterator(oss, "/"));
diff --git a/src/navigate/dirmanager.hpp b/src/navigate/genericpath.hpp
similarity index 95%
rename from src/navigate/dirmanager.hpp
rename to src/navigate/genericpath.hpp
index ec7faaf..5409e6e 100644
--- a/src/navigate/dirmanager.hpp
+++ b/src/navigate/genericpath.hpp
@@ -22,9 +22,9 @@
#include
namespace din {
- class DirManager {
+ class GenericPath {
public:
- DirManager ( void ) = default;
+ GenericPath ( void ) = default;
void push_piece ( const std::string& parPiece );
std::string to_string ( void ) const;
diff --git a/src/navigate/main.cpp b/src/navigate/main.cpp
index e7aec27..a7eb2e8 100644
--- a/src/navigate/main.cpp
+++ b/src/navigate/main.cpp
@@ -17,7 +17,7 @@
#include "commandline.hpp"
#include "commandprocessor.hpp"
-#include "dirmanager.hpp"
+#include "genericpath.hpp"
#include
#include
#include
@@ -28,7 +28,8 @@ namespace {
void do_navigation ( void );
bool on_exit ( void );
- void on_pwd ( const din::DirManager& parDirMan );
+ void on_pwd ( const din::GenericPath& parDirMan );
+ void on_ls ( const din::GenericPath& parDirMan );
} //unnamed namespace
int main (int parArgc, char* parArgv[]) {
@@ -53,25 +54,34 @@ namespace {
bool on_exit() {
return true;
}
- void on_pwd (const din::DirManager& parDirMan) {
+
+ void on_pwd (const din::GenericPath& parDirMan) {
std::cout << parDirMan.to_string() << '\n';
}
- void do_navigation() {
+ void on_ls (const din::GenericPath& parDirMan) {
+
+ }
+
+ void do_navigation (din::DBSource& parDB) {
auto& inp = std::cin;
bool running = true;
std::string curr_line;
din::CommandProcessor proc;
- din::DirManager dir_man;
+ din::GenericPath dir_man;
proc.add_command("exit", &on_exit, 0);
- proc.add_command("cd", std::function(std::bind(&din::DirManager::push_piece, &dir_man, std::placeholders::_1)), 1);
+ proc.add_command("cd", std::function(std::bind(&din::GenericPath::push_piece, &dir_man, std::placeholders::_1)), 1);
+ proc.add_command("disconnect", std::function(std::bind(&din::DBSource::disconnect, &parDB)), 0);
proc.add_command("pwd", std::function(std::bind(&on_pwd, std::ref(dir_man))), 0);
+ proc.add_command("ls", std::function(std::bind(&on_ls, std::ref(dir_man))), 0);
do {
do {
std::getline(inp, curr_line);
} while (curr_line.empty());
running = proc.exec_command(curr_line);
} while (running);
+
+ parDB.disconnect();
}
} //unnamed namespace