Utils/Logger: Remove dependency on libboost_datetime
[senf.git] / Console / ScopedDirectory.hh
index 6c27f40..cd5b9b4 100644 (file)
@@ -49,14 +49,17 @@ namespace console {
                                       * static_cast<DirectoryNode *>(0),
                                       * static_cast<Owner *>(0),
                                       * static_cast<std::string const *>(0),
-                                      * static_cast<Object const *>(0)) ) result_type;
+                                      * static_cast<Object *>(0),
+                                      * static_cast<int *>(0)) ) base_type;
+        typedef typename senf::remove_cvref<base_type>::type value_type;
 
-        typedef typename boost::remove_reference<result_type>::type NodeType;
+        typedef typename value_type::node_type NodeType;
+        typedef typename value_type::return_type result_type;
 
         /// Internal
         struct Creator {
-            static NodeType & create(DirectoryNode & node, Owner & owner, 
-                                     std::string const & name, Object const & ob);
+            static result_type create(DirectoryNode & node, Owner & owner, 
+                                     std::string const & name, Object & ob);
         };
     };
     
@@ -72,6 +75,7 @@ namespace console {
         ///\{
 
         GenericNode::ptr remove(std::string const & name);
+        bool hasChild(std::string const & name) const;
         DirectoryNode & getDirectory(std::string const & name) const;
         DirectoryNode & operator[](std::string const & name) const;
         CommandNode & getCommand(std::string const & name) const;
@@ -144,8 +148,8 @@ namespace console {
         ///////////////////////////////////////////////////////////////////////////
 
         template <class Object>
-        typename OwnerNodeCreateTraits<Owner, Object>::NodeType & add(std::string const & name,
-                                                                      Object const & ob);
+        typename OwnerNodeCreateTraits<Owner, Object>::result_type add(std::string const & name,
+                                                                       Object const & ob);
                                         ///< Create new child node
                                         /**< Adds a new child node to the (proxied)
                                              DirectoryNode. How the node is added is configured
@@ -153,30 +157,41 @@ namespace console {
                                              implementation just forwards the call to the proxied
                                              directory node. */
 
+        template <class Object>
+        typename OwnerNodeCreateTraits<Owner, Object>::result_type add(std::string const & name,
+                                                                       Object & ob);
+                                        ///< Create new child node
+                                        /**< \see add() */
+
     protected:
 
     private:
         Owner * owner_;
     };
 
+#ifndef DOXYGEN
+
     template <>
     class ScopedDirectory<void> : public ScopedDirectoryBase
     {
     public:
         template <class Object>
-        typename NodeCreateTraits<Object>::NodeType & add(std::string const & name,
-                                                          Object const & ob);
+        typename NodeCreateTraits<Object>::result_type add(std::string const & name,
+                                                           Object const & ob);
+
+        template <class Object>
+        typename NodeCreateTraits<Object>::result_type add(std::string const & name,
+                                                           Object & ob);
     };
 
-#ifndef DOXYGEN
     template <class Owner, class Function>
     SimpleCommandNode & senf_console_add_node(
-        DirectoryNode & node, Owner & owner, std::string const & name, Function const & fn);
+        DirectoryNode & node, Owner & owner, std::string const & name, Function const & fn, ...);
 
     template <class Owner>
     SimpleCommandNode & senf_console_add_node(
         DirectoryNode & node, Owner & owner, std::string const & name,
-        void (Owner::*fn)(std::ostream &, ParseCommandInfo const &));
+        void (Owner::*fn)(std::ostream &, ParseCommandInfo const &), int);
 
     template <class Node>
     DirectoryNode & senf_console_add_node(