OSDN Git Service

[core] : エクステンション利用のためにclass extensionを追加。
authorcaprice <caprice@users.sourceforge.jp>
Sat, 29 Jun 2013 06:59:05 +0000 (15:59 +0900)
committercaprice <caprice@users.sourceforge.jp>
Sat, 29 Jun 2013 06:59:05 +0000 (15:59 +0900)
core/include/extension.hpp [new file with mode: 0644]

diff --git a/core/include/extension.hpp b/core/include/extension.hpp
new file mode 100644 (file)
index 0000000..830358b
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef core_extension_hpp
+#define core_extension_hpp
+
+#include <unorderd_map>
+
+#include <boost/filesystem/path.hpp>
+
+#include <luajit-2.0/lua.hpp>
+
+namespace monazilla { namespace GikoMona { namespace core {
+
+class extension final {
+public:
+    typedef int extension_id_type;
+    const static extension_id_type inavailable_id;
+    struct information {
+        mona_string name;
+        void* lua_obj;
+        bool is_packaged;
+    };
+    
+    extension() : inavailable_id(0) {}
+    ~extension() {}
+    
+    extension_id_type load_extension(const boost::filesystem::path& ext_path) {
+        if(ext_path.get_ext() == "gep") {
+            // エクステンションはパッケージ化されている
+            
+            information ext_info = {"", luaL_newstate(""), true};
+        } else if(ext_path.get_ext() == "gex") {
+            // エクステンションは単体のファイルである
+        } else { return inavailable_id; }
+    }
+private:
+    std::unorderd_map<extension_id_type, information> extension_table;
+};
+
+} } }
+
+#endif