diff options
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/Configured.cxx | 9 | ||||
-rw-r--r-- | src/db/DatabaseGlue.cxx | 8 | ||||
-rw-r--r-- | src/db/DatabaseGlue.hxx | 4 | ||||
-rw-r--r-- | src/db/DatabasePlugin.hxx | 4 | ||||
-rw-r--r-- | src/db/plugins/ProxyDatabasePlugin.cxx | 18 | ||||
-rw-r--r-- | src/db/plugins/simple/SimpleDatabasePlugin.cxx | 14 | ||||
-rw-r--r-- | src/db/plugins/simple/SimpleDatabasePlugin.hxx | 6 | ||||
-rw-r--r-- | src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 12 |
8 files changed, 38 insertions, 37 deletions
diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx index 5d53e5951..9ada7f34a 100644 --- a/src/db/Configured.cxx +++ b/src/db/Configured.cxx @@ -22,6 +22,7 @@ #include "DatabaseGlue.hxx" #include "config/ConfigGlobal.hxx" #include "config/Param.hxx" +#include "config/Block.hxx" #include "config/ConfigError.hxx" #include "fs/AllocatedPath.hxx" #include "fs/StandardDirectory.hxx" @@ -32,7 +33,7 @@ Database * CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener, Error &error) { - const auto *param = config_get_param(ConfigOption::DATABASE); + const auto *param = config_get_block(ConfigBlockOption::DATABASE); const auto *path = config_get_param(ConfigOption::DB_FILE); if (param != nullptr && path != nullptr) { @@ -42,10 +43,10 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener, return nullptr; } - struct config_param *allocated = nullptr; + ConfigBlock *allocated = nullptr; if (param == nullptr && path != nullptr) { - allocated = new config_param("database", path->line); + allocated = new ConfigBlock(path->line); allocated->AddBlockParam("path", path->value.c_str(), path->line); param = allocated; @@ -60,7 +61,7 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener, const auto db_file = AllocatedPath::Build(cache_dir, "mpd.db"); - allocated = new config_param("database"); + allocated = new ConfigBlock(); allocated->AddBlockParam("path", db_file.c_str(), -1); param = allocated; } diff --git a/src/db/DatabaseGlue.cxx b/src/db/DatabaseGlue.cxx index 3ba1b8148..193b672e9 100644 --- a/src/db/DatabaseGlue.cxx +++ b/src/db/DatabaseGlue.cxx @@ -22,17 +22,17 @@ #include "Registry.hxx" #include "DatabaseError.hxx" #include "util/Error.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "DatabasePlugin.hxx" #include <string.h> Database * DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener, - const config_param ¶m, Error &error) + const ConfigBlock &block, Error &error) { const char *plugin_name = - param.GetBlockValue("plugin", "simple"); + block.GetBlockValue("plugin", "simple"); const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name); if (plugin == nullptr) { @@ -41,5 +41,5 @@ DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener, return nullptr; } - return plugin->create(loop, listener, param, error); + return plugin->create(loop, listener, block, error); } diff --git a/src/db/DatabaseGlue.hxx b/src/db/DatabaseGlue.hxx index c35dd1cbd..67ff4f537 100644 --- a/src/db/DatabaseGlue.hxx +++ b/src/db/DatabaseGlue.hxx @@ -22,7 +22,7 @@ #include "Compiler.h" -struct config_param; +struct ConfigBlock; class EventLoop; class DatabaseListener; class Database; @@ -35,6 +35,6 @@ class Error; */ Database * DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener, - const config_param ¶m, Error &error); + const ConfigBlock &block, Error &error); #endif diff --git a/src/db/DatabasePlugin.hxx b/src/db/DatabasePlugin.hxx index 4497b8b91..116aa59d2 100644 --- a/src/db/DatabasePlugin.hxx +++ b/src/db/DatabasePlugin.hxx @@ -26,7 +26,7 @@ #ifndef MPD_DATABASE_PLUGIN_HXX #define MPD_DATABASE_PLUGIN_HXX -struct config_param; +struct ConfigBlock; class Error; class EventLoop; class DatabaseListener; @@ -47,7 +47,7 @@ struct DatabasePlugin { * Allocates and configures a database. */ Database *(*create)(EventLoop &loop, DatabaseListener &listener, - const config_param ¶m, + const ConfigBlock &block, Error &error); constexpr bool RequireStorage() const { diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 1a94000b2..67c651e83 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -30,7 +30,7 @@ #include "db/Stats.hxx" #include "SongFilter.hxx" #include "Compiler.h" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "tag/TagBuilder.hxx" #include "tag/Tag.hxx" #include "util/Error.hxx" @@ -97,7 +97,7 @@ public: listener(_listener) {} static Database *Create(EventLoop &loop, DatabaseListener &listener, - const config_param ¶m, + const ConfigBlock &block, Error &error); virtual bool Open(Error &error) override; @@ -129,7 +129,7 @@ public: } private: - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); bool Connect(Error &error); bool CheckConnection(Error &error); @@ -321,10 +321,10 @@ SendConstraints(mpd_connection *connection, const DatabaseSelection &selection) Database * ProxyDatabase::Create(EventLoop &loop, DatabaseListener &listener, - const config_param ¶m, Error &error) + const ConfigBlock &block, Error &error) { ProxyDatabase *db = new ProxyDatabase(loop, listener); - if (!db->Configure(param, error)) { + if (!db->Configure(block, error)) { delete db; db = nullptr; } @@ -333,11 +333,11 @@ ProxyDatabase::Create(EventLoop &loop, DatabaseListener &listener, } bool -ProxyDatabase::Configure(const config_param ¶m, gcc_unused Error &error) +ProxyDatabase::Configure(const ConfigBlock &block, gcc_unused Error &error) { - host = param.GetBlockValue("host", ""); - port = param.GetBlockValue("port", 0u); - keepalive = param.GetBlockValue("keepalive", false); + host = block.GetBlockValue("host", ""); + port = block.GetBlockValue("port", 0u); + keepalive = block.GetBlockValue("keepalive", false); return true; } diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index 18faf46df..da8d44fb0 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -34,7 +34,7 @@ #include "fs/io/TextFile.hxx" #include "fs/io/BufferedOutputStream.hxx" #include "fs/io/FileOutputStream.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "fs/FileSystem.hxx" #include "util/CharUtil.hxx" #include "util/Error.hxx" @@ -76,10 +76,10 @@ inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path, Database * SimpleDatabase::Create(gcc_unused EventLoop &loop, gcc_unused DatabaseListener &listener, - const config_param ¶m, Error &error) + const ConfigBlock &block, Error &error) { SimpleDatabase *db = new SimpleDatabase(); - if (!db->Configure(param, error)) { + if (!db->Configure(block, error)) { delete db; db = nullptr; } @@ -88,9 +88,9 @@ SimpleDatabase::Create(gcc_unused EventLoop &loop, } bool -SimpleDatabase::Configure(const config_param ¶m, Error &error) +SimpleDatabase::Configure(const ConfigBlock &block, Error &error) { - path = param.GetBlockPath("path", error); + path = block.GetBlockPath("path", error); if (path.IsNull()) { if (!error.IsDefined()) error.Set(simple_db_domain, @@ -100,12 +100,12 @@ SimpleDatabase::Configure(const config_param ¶m, Error &error) path_utf8 = path.ToUTF8(); - cache_path = param.GetBlockPath("cache_directory", error); + cache_path = block.GetBlockPath("cache_directory", error); if (path.IsNull() && error.IsDefined()) return false; #ifdef ENABLE_ZLIB - compress = param.GetBlockValue("compress", compress); + compress = block.GetBlockValue("compress", compress); #endif return true; diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx index 2e2d39a86..fc720ecf8 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx @@ -28,7 +28,7 @@ #include <cassert> -struct config_param; +struct ConfigBlock; struct Directory; struct DatabasePlugin; class EventLoop; @@ -73,7 +73,7 @@ class SimpleDatabase : public Database { public: static Database *Create(EventLoop &loop, DatabaseListener &listener, - const config_param ¶m, + const ConfigBlock &block, Error &error); gcc_pure @@ -134,7 +134,7 @@ public: } private: - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); gcc_pure bool Check(Error &error) const; diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 2f666acbe..9f0841780 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -33,7 +33,7 @@ #include "db/LightDirectory.hxx" #include "db/LightSong.hxx" #include "db/Stats.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "tag/TagBuilder.hxx" #include "tag/TagTable.hxx" #include "util/Error.hxx" @@ -78,7 +78,7 @@ public: UpnpDatabase():Database(upnp_db_plugin) {} static Database *Create(EventLoop &loop, DatabaseListener &listener, - const config_param ¶m, + const ConfigBlock &block, Error &error); virtual bool Open(Error &error) override; @@ -106,7 +106,7 @@ public: } protected: - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); private: bool VisitServer(const ContentDirectoryService &server, @@ -158,10 +158,10 @@ private: Database * UpnpDatabase::Create(gcc_unused EventLoop &loop, gcc_unused DatabaseListener &listener, - const config_param ¶m, Error &error) + const ConfigBlock &block, Error &error) { UpnpDatabase *db = new UpnpDatabase(); - if (!db->Configure(param, error)) { + if (!db->Configure(block, error)) { delete db; return nullptr; } @@ -173,7 +173,7 @@ UpnpDatabase::Create(gcc_unused EventLoop &loop, } inline bool -UpnpDatabase::Configure(const config_param &, Error &) +UpnpDatabase::Configure(const ConfigBlock &, Error &) { return true; } |