From 440ac51cf0250904813dfc9398ca8c9e6467328f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 00:25:15 +0100 Subject: database.h: rename to DatabaseSimple.hxx --- Makefile.am | 2 +- src/DatabaseGlue.cxx | 2 +- src/DatabaseSimple.hxx | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ src/Main.cxx | 2 +- src/Stats.cxx | 2 +- src/StickerCommands.cxx | 2 +- src/UpdateGlue.cxx | 2 +- src/UpdateWalk.cxx | 2 +- src/database.h | 88 ------------------------------------------------- 9 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 src/DatabaseSimple.hxx delete mode 100644 src/database.h diff --git a/Makefile.am b/Makefile.am index 3d4d9db80..e7a9ffb24 100644 --- a/Makefile.am +++ b/Makefile.am @@ -79,7 +79,6 @@ mpd_headers = \ src/decoder_api.h \ src/decoder_plugin.h \ src/decoder_internal.h \ - src/database.h \ src/encoder_plugin.h \ src/encoder_list.h \ src/encoder_api.h \ @@ -224,6 +223,7 @@ src_mpd_SOURCES = \ src/decoder_print.c \ src/Directory.cxx src/Directory.hxx \ src/DirectorySave.cxx src/DirectorySave.hxx \ + src/DatabaseSimple.hxx \ src/DatabaseGlue.cxx src/DatabaseGlue.hxx \ src/DatabasePrint.cxx src/DatabasePrint.hxx \ src/DatabaseQueue.cxx src/DatabaseQueue.hxx \ diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx index 86810c2bd..3325c5ecc 100644 --- a/src/DatabaseGlue.cxx +++ b/src/DatabaseGlue.cxx @@ -19,12 +19,12 @@ #include "config.h" #include "DatabaseGlue.hxx" +#include "DatabaseSimple.hxx" #include "DatabaseRegistry.hxx" #include "DatabaseSave.hxx" #include "Directory.hxx" extern "C" { -#include "database.h" #include "db_error.h" #include "stats.h" #include "conf.h" diff --git a/src/DatabaseSimple.hxx b/src/DatabaseSimple.hxx new file mode 100644 index 000000000..20f038024 --- /dev/null +++ b/src/DatabaseSimple.hxx @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DATABASE_SIMPLE_HXX +#define MPD_DATABASE_SIMPLE_HXX + +#include "gcc.h" + +#include + +#include +#include + +struct config_param; +struct directory; +struct db_selection; +struct db_visitor; + +/** + * Check whether the default #SimpleDatabasePlugin is used. This + * allows using db_get_root(), db_save(), db_get_mtime() and + * db_exists(). + */ +bool +db_is_simple(void); + +/** + * Returns the root directory object. Returns NULL if there is no + * configured music directory. + * + * May only be used if db_is_simple() returns true. + */ +gcc_pure +struct directory * +db_get_root(void); + +/** + * Caller must lock the #db_mutex. + */ +gcc_nonnull(1) +gcc_pure +struct directory * +db_get_directory(const char *name); + +/** + * May only be used if db_is_simple() returns true. + */ +bool +db_save(GError **error_r); + +/** + * May only be used if db_is_simple() returns true. + */ +gcc_pure +time_t +db_get_mtime(void); + +/** + * Returns true if there is a valid database file on the disk. + * + * May only be used if db_is_simple() returns true. + */ +gcc_pure +static inline bool +db_exists(void) +{ + /* mtime is set only if the database file was loaded or saved + successfully */ + return db_get_mtime() > 0; +} + +#endif diff --git a/src/Main.cxx b/src/Main.cxx index 5e63f5f67..24da70bc4 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -26,6 +26,7 @@ #include "PlayerThread.hxx" #include "Mapper.hxx" #include "DatabaseGlue.hxx" +#include "DatabaseSimple.hxx" extern "C" { #include "daemon.h" @@ -35,7 +36,6 @@ extern "C" { #include "idle.h" #include "AllCommands.h" #include "playlist.h" -#include "database.h" #include "listen.h" #include "cmdline.h" #include "conf.h" diff --git a/src/Stats.cxx b/src/Stats.cxx index d08074a8c..81d083d8c 100644 --- a/src/Stats.cxx +++ b/src/Stats.cxx @@ -21,7 +21,6 @@ extern "C" { #include "stats.h" -#include "database.h" #include "client.h" #include "player_control.h" #include "client_internal.h" @@ -30,6 +29,7 @@ extern "C" { #include "DatabaseSelection.hxx" #include "DatabaseGlue.hxx" #include "DatabasePlugin.hxx" +#include "DatabaseSimple.hxx" struct stats stats; diff --git a/src/StickerCommands.cxx b/src/StickerCommands.cxx index a4f83a583..dfb92df38 100644 --- a/src/StickerCommands.cxx +++ b/src/StickerCommands.cxx @@ -23,6 +23,7 @@ #include "DatabaseLock.hxx" #include "DatabasePlugin.hxx" #include "DatabaseGlue.hxx" +#include "DatabaseSimple.hxx" #include "SongSticker.hxx" #include "StickerPrint.hxx" #include "StickerDatabase.hxx" @@ -30,7 +31,6 @@ extern "C" { #include "protocol/result.h" -#include "database.h" } #include diff --git a/src/UpdateGlue.cxx b/src/UpdateGlue.cxx index 9cf27588a..f5664893b 100644 --- a/src/UpdateGlue.cxx +++ b/src/UpdateGlue.cxx @@ -23,9 +23,9 @@ #include "UpdateWalk.hxx" #include "UpdateRemove.hxx" #include "Mapper.hxx" +#include "DatabaseSimple.hxx" extern "C" { -#include "database.h" #include "playlist.h" #include "event_pipe.h" #include "idle.h" diff --git a/src/UpdateWalk.cxx b/src/UpdateWalk.cxx index a38b06c37..b848f124e 100644 --- a/src/UpdateWalk.cxx +++ b/src/UpdateWalk.cxx @@ -24,6 +24,7 @@ #include "UpdateSong.hxx" #include "UpdateArchive.hxx" #include "DatabaseLock.hxx" +#include "DatabaseSimple.hxx" #include "Directory.hxx" #include "song.h" #include "PlaylistVector.hxx" @@ -31,7 +32,6 @@ extern "C" { #include "exclude.h" -#include "database.h" #include "uri.h" #include "path.h" #include "playlist_list.h" diff --git a/src/database.h b/src/database.h deleted file mode 100644 index ee2e609a6..000000000 --- a/src/database.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DATABASE_H -#define MPD_DATABASE_H - -#include "gcc.h" - -#include - -#include -#include - -struct config_param; -struct directory; -struct db_selection; -struct db_visitor; - -/** - * Check whether the default #SimpleDatabasePlugin is used. This - * allows using db_get_root(), db_save(), db_get_mtime() and - * db_exists(). - */ -bool -db_is_simple(void); - -/** - * Returns the root directory object. Returns NULL if there is no - * configured music directory. - * - * May only be used if db_is_simple() returns true. - */ -gcc_pure -struct directory * -db_get_root(void); - -/** - * Caller must lock the #db_mutex. - */ -gcc_nonnull(1) -gcc_pure -struct directory * -db_get_directory(const char *name); - -/** - * May only be used if db_is_simple() returns true. - */ -bool -db_save(GError **error_r); - -/** - * May only be used if db_is_simple() returns true. - */ -gcc_pure -time_t -db_get_mtime(void); - -/** - * Returns true if there is a valid database file on the disk. - * - * May only be used if db_is_simple() returns true. - */ -gcc_pure -static inline bool -db_exists(void) -{ - /* mtime is set only if the database file was loaded or saved - successfully */ - return db_get_mtime() > 0; -} - -#endif -- cgit v1.2.3