Add Boost.Typeof library to repository
[senf.git] / Console / Node.hh
index c2c8be5..d081ffd 100644 (file)
@@ -34,6 +34,7 @@
 #include <boost/utility.hpp>
 #include <boost/range/iterator_range.hpp>
 #include "../Utils/Exception.hh"
+#include "Parse.hh"
 
 //#include "Node.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -54,6 +55,7 @@ namespace console {
         // Types
 
         typedef boost::shared_ptr<GenericNode> ptr;
+        typedef boost::shared_ptr<GenericNode const> cptr;
         typedef boost::weak_ptr<GenericNode> weak_ptr;
 
         ///////////////////////////////////////////////////////////////////////////
@@ -66,6 +68,9 @@ namespace console {
 
         std::string path() const;
 
+        ptr thisptr();
+        cptr thisptr() const;
+
     protected:
         explicit GenericNode(std::string const & name);
 
@@ -92,6 +97,7 @@ namespace console {
         // Types
 
         typedef boost::shared_ptr<DirectoryNode> ptr;
+        typedef boost::shared_ptr<DirectoryNode const> cptr;
         typedef boost::weak_ptr<DirectoryNode> weak_ptr;
 
         typedef boost::iterator_range<ChildMap::const_iterator> ChildrenRange;
@@ -103,17 +109,23 @@ namespace console {
 
         DirectoryNode & operator[](std::string const & name) const;
         CommandNode & operator()(std::string const & name) const;
+        GenericNode & get(std::string const & name) const;
 
         DirectoryNode & mkdir(std::string const & name);
         
         ChildrenRange children() const;
 
+        template <class ForwardRange>
+        GenericNode & traverse(ForwardRange const & range);
+
+        ptr thisptr();
+        cptr thisptr() const;
+
     protected:
         explicit DirectoryNode(std::string const & name);
 
     private:
         void add(GenericNode::ptr node, bool uniquify);
-        GenericNode & lookup(std::string const & name) const;
 
         ChildMap children_;
 
@@ -135,10 +147,17 @@ namespace console {
         // Types
 
         typedef boost::shared_ptr<CommandNode> ptr;
+        typedef boost::shared_ptr<CommandNode const> cptr;
         typedef boost::weak_ptr<CommandNode> weak_ptr;
 
         ///////////////////////////////////////////////////////////////////////////
 
+        virtual void operator()(std::ostream & output, 
+                                ParseCommandInfo::ArgumentsRange const & arguments) = 0;
+
+        ptr thisptr();
+        cptr thisptr() const;
+
     protected:
         explicit CommandNode(std::string const & name);
 
@@ -152,7 +171,7 @@ namespace console {
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #include "Node.cci"
-//#include "Node.ct"
+#include "Node.ct"
 //#include "Node.cti"
 #endif