From 3deca8fccd9776828808d35181203d8fd95eb450 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Aug 2013 19:43:27 +0200 Subject: db_error: convert to C++ --- src/CommandError.cxx | 2 +- src/DatabaseError.hxx | 47 +++++++++++++++++++++++++++++++++++++++++ src/DatabaseGlue.cxx | 2 +- src/db/ProxyDatabasePlugin.cxx | 5 +---- src/db/SimpleDatabasePlugin.cxx | 2 +- src/db_error.h | 47 ----------------------------------------- 6 files changed, 51 insertions(+), 54 deletions(-) create mode 100644 src/DatabaseError.hxx delete mode 100644 src/db_error.h (limited to 'src') diff --git a/src/CommandError.cxx b/src/CommandError.cxx index 7e777d82a..7a33761ae 100644 --- a/src/CommandError.cxx +++ b/src/CommandError.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "CommandError.hxx" -#include "db_error.h" +#include "DatabaseError.hxx" #include "io_error.h" #include "protocol/Result.hxx" diff --git a/src/DatabaseError.hxx b/src/DatabaseError.hxx new file mode 100644 index 000000000..3827daff0 --- /dev/null +++ b/src/DatabaseError.hxx @@ -0,0 +1,47 @@ +/* + * 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_DB_ERROR_HXX +#define MPD_DB_ERROR_HXX + +#include "gcc.h" + +#include + +enum db_error { + /** + * The database is disabled, i.e. none is configured in this + * MPD instance. + */ + DB_DISABLED, + + DB_NOT_FOUND, +}; + +/** + * Quark for GError.domain; the code is an enum #db_error. + */ +gcc_const +static inline GQuark +db_quark(void) +{ + return g_quark_from_static_string("db"); +} + +#endif diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx index e2076be28..70b7acc9e 100644 --- a/src/DatabaseGlue.cxx +++ b/src/DatabaseGlue.cxx @@ -22,11 +22,11 @@ #include "DatabaseSimple.hxx" #include "DatabaseRegistry.hxx" #include "DatabaseSave.hxx" +#include "DatabaseError.hxx" #include "Directory.hxx" #include "conf.h" extern "C" { -#include "db_error.h" #include "stats.h" } diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx index 638a801d4..81aad0a4c 100644 --- a/src/db/ProxyDatabasePlugin.cxx +++ b/src/db/ProxyDatabasePlugin.cxx @@ -21,6 +21,7 @@ #include "ProxyDatabasePlugin.hxx" #include "DatabasePlugin.hxx" #include "DatabaseSelection.hxx" +#include "DatabaseError.hxx" #include "PlaylistVector.hxx" #include "Directory.hxx" #include "Song.hxx" @@ -28,10 +29,6 @@ #include "conf.h" #include "Tag.hxx" -extern "C" { -#include "db_error.h" -} - #undef MPD_DIRECTORY_H #undef MPD_SONG_H #include diff --git a/src/db/SimpleDatabasePlugin.cxx b/src/db/SimpleDatabasePlugin.cxx index 373064c3f..21eb8752d 100644 --- a/src/db/SimpleDatabasePlugin.cxx +++ b/src/db/SimpleDatabasePlugin.cxx @@ -25,7 +25,7 @@ #include "SongFilter.hxx" #include "DatabaseSave.hxx" #include "DatabaseLock.hxx" -#include "db_error.h" +#include "DatabaseError.hxx" #include "TextFile.hxx" #include "conf.h" #include "fs/FileSystem.hxx" diff --git a/src/db_error.h b/src/db_error.h deleted file mode 100644 index 05946aaf1..000000000 --- a/src/db_error.h +++ /dev/null @@ -1,47 +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_DB_ERROR_H -#define MPD_DB_ERROR_H - -#include "gcc.h" - -#include - -enum db_error { - /** - * The database is disabled, i.e. none is configured in this - * MPD instance. - */ - DB_DISABLED, - - DB_NOT_FOUND, -}; - -/** - * Quark for GError.domain; the code is an enum #db_error. - */ -gcc_const -static inline GQuark -db_quark(void) -{ - return g_quark_from_static_string("db"); -} - -#endif -- cgit v1.2.3