summaryrefslogtreecommitdiff
path: root/server/include
diff options
context:
space:
mode:
Diffstat (limited to 'server/include')
-rw-r--r--server/include/api_core.h11
-rw-r--r--server/include/api_module_base.h6
-rw-r--r--server/include/api_module_downloader.h2
-rw-r--r--server/include/modules_handler.h46
4 files changed, 60 insertions, 5 deletions
diff --git a/server/include/api_core.h b/server/include/api_core.h
index 29e3886..1663f09 100644
--- a/server/include/api_core.h
+++ b/server/include/api_core.h
@@ -23,15 +23,20 @@
#define API_CORE_H_INCLUDED
#include <string>
#include <vector>
+#include <map>
class module_base;
class core_api
{
- virtual bool metadata_set(const module_base *m, const std::string &setting_name, const std::vector<char> &data);
- virtual bool metadata_get(const module_base *m, const std::string &setting_name, std::vector<char> &data);
- virtual bool metadata_remove(const module_base *m, const std::string &setting_name);
+ //core
+ std::map<std::string, std::string> get_module_settings(const module_base *m);
+
+ //metadata
+ bool metadata_set(const module_base *m, const std::string &setting_name, const std::vector<char> &data);
+ bool metadata_get(const module_base *m, const std::string &setting_name, std::vector<char> &data);
+ bool metadata_remove(const module_base *m, const std::string &setting_name);
};
diff --git a/server/include/api_module_base.h b/server/include/api_module_base.h
index 27797bc..38c9a00 100644
--- a/server/include/api_module_base.h
+++ b/server/include/api_module_base.h
@@ -26,6 +26,7 @@
struct module_info
{
std::string name, description, version;
+ std::map<std::string, std::string> default_settings; //to save in config file
};
class module_base
@@ -33,7 +34,10 @@ class module_base
public:
virtual void load(core_api *a) = 0;
virtual const module_info &get_module_info() = 0;
- virtual ~module_base() =0;
+ virtual void set_module_settings(const std::map<std::string, std::string> &settings) = 0;
+ virtual ~module_base() = 0;
+ protected:
+ std::map<std::string, std::string> settings;
};
diff --git a/server/include/api_module_downloader.h b/server/include/api_module_downloader.h
index 0c4bcf0..3cf8ec6 100644
--- a/server/include/api_module_downloader.h
+++ b/server/include/api_module_downloader.h
@@ -27,7 +27,7 @@ struct downloader_module_info : public module_info
{
};
-class downloader_module : public module_base
+class module_downloader : public module_base
{
};
diff --git a/server/include/modules_handler.h b/server/include/modules_handler.h
new file mode 100644
index 0000000..efcbebc
--- /dev/null
+++ b/server/include/modules_handler.h
@@ -0,0 +1,46 @@
+/*
+ Copyright © 2015 Gluzskiy Alexandr (sss)
+
+ This file is part of Unknown Download Manager (UDM).
+
+ UDM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ UDM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with UDM. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef MODULES_HANDLER_H
+#define MODULES_HANDLER_H
+
+#include <api_module_metadata_storage.h>
+#include <api_module_downloader.h>
+#include <list>
+
+class modules_handler
+{
+ public:
+ modules_handler();
+ std::string list_modules();
+ ~modules_handler();
+ private:
+ void load_metadata_modules(const std::string &path);
+ void load_downloader_modules(const std::string &path);
+ std::string get_self_path();
+ std::string self_path;
+ std::list<module_metadata_storage*> metadata_modules;
+ std::list<module_downloader*> downloader_modules;
+
+
+};
+
+#endif // MODULES_HANDLER_H