OSDN Git Service

大量変更… (こういう風に書くのは好ましくない〜)
[gikomona/GikoMona.git] / core / include / config.hpp
index 2aa315a..efe9338 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef GIKOMONA_CORE_CONFIG_HPP
 #define GIKOMONA_CORE_CONFIG_HPP
 
-#include <tuple>
 #include <unordered_map>
 
+#include <boost/fusion/include/vector.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/any.hpp>
 
 
 namespace monazilla { namespace GikoMona { namespace core {
 
-class config final {
+class config final : public query {
 public:
     typedef config self_type;
+    typedef query base_type;
 
     config() noexcept {}
     ~config() {}
 
-    template <typename ...ValueType>
-    void insert(const mona_string& into,
-                const std::tuple<ValueType...>& value) {}
-
+    /**
+     *  @breif query_concept を満たすクラスはこの関数と同じ型、名前を持つ関数を持っていなければならない。
+     *  @retval true insert 操作が成功した
+     *          false insert 操作に失敗した
+     *  @param[in] into どのテーブルのどの要素に対し insertion query を実行するかを記述する。
+     *                  記述の仕方は次の通り:(テーブル名)/[(サブテーブル名)/]*(要素名)
+     *  @param[in] value テーブルに対して代入する値を記述する。
+     *  @note さらに、最大限 multi-threading な環境を考慮しなければならない。
+     */
+    template <typename T, typename U, typename ...ValueType>
+    bool insert(const mona_string& into,
+                const boost::fusion::vector<T, U, ValueType...>& value) {}
+    
+    template <typename T>
+    bool insert(const mona_string& into,
+                const boost::fusion::vector<T>& value) {}
+    
+    template <typename T>
+    bool insert(const mona_string& into,
+                const boost::any& value,
+                base_type::enable_if_T_is_U<T, boost::any>*& = enabler) {}
+    
+    /**
+     *  @brief query_concept を満たすクラスはこの関数と同じ型、名前を持つ関数を持っていなければならない。
+     *  @return 引数で指定したテーブルの要素から、テンプレートで指定した方に変換された値が返される。
+     */
     template <typename T>
     T select(const mona_string& column,
              const mona_string& from) const noexcept {}
     
+    template <typename T>
+    boost::any select(const mona_string& column,
+                      const mona_string& from,
+                      base_type::enable_if_T_is_U<T, boost::any>*& = enabler) const noexcept {}
+    
     template <typename ...ValueType>
-    std::tuple<ValueType...>
+    boost::fusion::vector<ValueType...>
     select_all(const mona_string& from) const noexcept {}
-
 private:
     std::unordered_map<mona_string, boost::any> map;
 };