Console: Complete 'Variable' command implementation
[senf.git] / Console / Variables.ih
index e1a2ce8..88b2207 100644 (file)
 
 // Custom includes
 #include <boost/function.hpp>
+#include <boost/type_traits/is_const.hpp>
 
 ///////////////////////////////ih.p////////////////////////////////////////
 
 namespace senf {
 namespace console {
+
+    template <class Variable> class ConstVariableAttributor;
+    template <class Variable> class VariableAttributor;
+
 namespace detail {
 
     template <class Variable>
@@ -66,6 +71,22 @@ namespace detail {
         OnChangeHandler handler_;
     };
 
+    template <class Variable, bool isConst=boost::is_const<Variable>::value>
+    struct VariableNodeCreator
+    {
+        typedef VariableAttributor<Variable> result_type;
+        static VariableAttributor<Variable> add(DirectoryNode & node, std::string const & name,
+                                                Variable & var);
+    };
+
+    template <class Variable>
+    struct VariableNodeCreator<Variable, true>
+    {
+        typedef ConstVariableAttributor<Variable> result_type;
+        static ConstVariableAttributor<Variable> add(DirectoryNode & node, std::string const & name,
+                                                     Variable & var);
+    };
+
 }}}
 
 ///////////////////////////////ih.e////////////////////////////////////////