X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FExecutor.hh;h=882792a806660cde23998a71bb5e1c02c3f1f6f8;hb=9e7071473642404359c8b7a88c78fe02f00baf16;hp=5cdd1f751dc14d521654eaafa1723e452e90f332;hpb=bf6bdcb90de19ed474535d41c5519518921b717b;p=senf.git diff --git a/Console/Executor.hh b/Console/Executor.hh index 5cdd1f7..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 @@ -120,19 +122,27 @@ namespace console { are accessible via the executor. This value defaults to senf::console::root(). */ - Executor & policy(SecurityPolicy policy); ///< Set security policy + Executor & policy(SecurityPolicy policy = SecurityPolicy()); ///< Set security policy /**< The security policy is called before traversing a node to validate that access. */ protected: private: - GenericNode & traverseNode(ParseCommandInfo::TokensRange const & path); - GenericNode & traverseCommand(ParseCommandInfo::CommandPathRange 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 {}; @@ -140,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