X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FExecutor.hh;h=882792a806660cde23998a71bb5e1c02c3f1f6f8;hb=9e7071473642404359c8b7a88c78fe02f00baf16;hp=5f1cc46679dfb75630b1a67038c1aed3967aa28d;hpb=e72b932bd59aa3e4553151f0d03e663af7ac5cd6;p=senf.git diff --git a/Console/Executor.hh b/Console/Executor.hh index 5f1cc46..882792a 100644 --- a/Console/Executor.hh +++ b/Console/Executor.hh @@ -91,6 +91,8 @@ namespace console { /**< Output will be written to \a output. Same as execute(). */ DirectoryNode & cwd() const; ///< Current working directory + std::string cwdPath() const; ///< Return pathname of current directory + bool skipping() const; ///< \c true, if currently skipping a directory group bool autocd() const; ///< Get current autocd status /**< if autocd is enabled, specifying a directory name as @@ -127,11 +129,20 @@ namespace console { protected: private: - GenericNode & traverseNode(ParseCommandInfo::TokensRange const & path); - DirectoryNode & traverseDirectory(ParseCommandInfo::TokensRange const & path); + typedef std::vector Path; + + void exec(std::ostream & output, ParseCommandInfo const & command); - template - GenericNode & traverse(DirectoryNode & dir, ForwardRange const & range); + void cd(ParseCommandInfo::TokensRange dir); + void ls(std::ostream & output, ParseCommandInfo::TokensRange dir); + void pushd(ParseCommandInfo::TokensRange dir); + void popd(); + void exit(); + void help(std::ostream & output, ParseCommandInfo::TokensRange path); + + GenericNode & traverseNode(ParseCommandInfo::TokensRange const & path); + void traverseDirectory(ParseCommandInfo::TokensRange const & path, + Path & dir); struct InvalidPathException {}; struct InvalidDirectoryException {}; @@ -139,28 +150,21 @@ namespace console { DirectoryNode::ptr root_; SecurityPolicy policy_; - DirectoryNode::weak_ptr cwd_; - DirectoryNode::weak_ptr oldCwd_; - struct DirEntry { - DirEntry(DirectoryNode::weak_ptr dir_, bool skip_) : dir(dir_), skip(skip_) {} - DirectoryNode::weak_ptr dir; - bool skip; - }; - typedef std::vector DirStack; + mutable Path cwd_; + Path oldCwd_; + + typedef std::vector DirStack; DirStack dirstack_; bool autocd_; bool autocomplete_; - - bool skipping_; }; - }} ///////////////////////////////hh.e//////////////////////////////////////// #include "Executor.cci" -#include "Executor.ct" +//#include "Executor.ct" //#include "Executor.cti" #endif