From 2f5106c97f7c3c198650b1b6951b71c5d492aaa7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 24 Aug 2015 11:19:19 +0200 Subject: tag/Settings: convert to C++ --- src/TagPrint.cxx | 2 +- src/db/plugins/simple/DatabaseSave.cxx | 2 +- src/tag/Set.cxx | 2 +- src/tag/Settings.cxx | 22 +++++++++++++++ src/tag/Settings.hxx | 46 +++++++++++++++++++++++++++++++ src/tag/TagBuilder.cxx | 2 +- src/tag/TagConfig.cxx | 2 +- src/tag/TagSettings.c | 22 --------------- src/tag/TagSettings.h | 50 ---------------------------------- 9 files changed, 73 insertions(+), 77 deletions(-) create mode 100644 src/tag/Settings.cxx create mode 100644 src/tag/Settings.hxx delete mode 100644 src/tag/TagSettings.c delete mode 100644 src/tag/TagSettings.h (limited to 'src') diff --git a/src/TagPrint.cxx b/src/TagPrint.cxx index 4a97d851e..d938d8fa5 100644 --- a/src/TagPrint.cxx +++ b/src/TagPrint.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "TagPrint.hxx" #include "tag/Tag.hxx" -#include "tag/TagSettings.h" +#include "tag/Settings.hxx" #include "client/Response.hxx" void diff --git a/src/db/plugins/simple/DatabaseSave.cxx b/src/db/plugins/simple/DatabaseSave.cxx index 02690dcf8..d2953b048 100644 --- a/src/db/plugins/simple/DatabaseSave.cxx +++ b/src/db/plugins/simple/DatabaseSave.cxx @@ -26,7 +26,7 @@ #include "fs/io/BufferedOutputStream.hxx" #include "fs/io/TextFile.hxx" #include "tag/Tag.hxx" -#include "tag/TagSettings.h" +#include "tag/Settings.hxx" #include "fs/Charset.hxx" #include "util/StringUtil.hxx" #include "util/Error.hxx" diff --git a/src/tag/Set.cxx b/src/tag/Set.cxx index 24ca30ee3..30e4efe2d 100644 --- a/src/tag/Set.cxx +++ b/src/tag/Set.cxx @@ -19,7 +19,7 @@ #include "Set.hxx" #include "TagBuilder.hxx" -#include "TagSettings.h" +#include "Settings.hxx" #include diff --git a/src/tag/Settings.cxx b/src/tag/Settings.cxx new file mode 100644 index 000000000..83c626db8 --- /dev/null +++ b/src/tag/Settings.cxx @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2003-2015 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. + */ + +#include "Settings.hxx" + +tag_mask_t global_tag_mask = (tag_mask_t)-1 & ~(1 << TAG_COMMENT); diff --git a/src/tag/Settings.hxx b/src/tag/Settings.hxx new file mode 100644 index 000000000..42d0dc684 --- /dev/null +++ b/src/tag/Settings.hxx @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2003-2015 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_TAG_SETTINGS_HXX +#define MPD_TAG_SETTINGS_HXX + +#include "TagType.h" +#include "Compiler.h" + +#include + +typedef uint_least32_t tag_mask_t; + +extern tag_mask_t global_tag_mask; + +gcc_const +static inline bool +IsTagEnabled(unsigned tag) +{ + return global_tag_mask & (1u << tag); +} + +gcc_const +static inline bool +IsTagEnabled(TagType tag) +{ + return IsTagEnabled(unsigned(tag)); +} + +#endif diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx index 4e810475f..4ce50cc4c 100644 --- a/src/tag/TagBuilder.cxx +++ b/src/tag/TagBuilder.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "TagBuilder.hxx" -#include "TagSettings.h" +#include "Settings.hxx" #include "TagPool.hxx" #include "TagString.hxx" #include "Tag.hxx" diff --git a/src/tag/TagConfig.cxx b/src/tag/TagConfig.cxx index de5faff32..b0e7b8ff0 100644 --- a/src/tag/TagConfig.cxx +++ b/src/tag/TagConfig.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "TagConfig.hxx" -#include "TagSettings.h" +#include "Settings.hxx" #include "Tag.hxx" #include "config/ConfigGlobal.hxx" #include "config/ConfigOption.hxx" diff --git a/src/tag/TagSettings.c b/src/tag/TagSettings.c deleted file mode 100644 index 905265913..000000000 --- a/src/tag/TagSettings.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2003-2015 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. - */ - -#include "TagSettings.h" - -tag_mask_t global_tag_mask = (tag_mask_t)-1 & ~(1 << TAG_COMMENT); diff --git a/src/tag/TagSettings.h b/src/tag/TagSettings.h deleted file mode 100644 index 708517a08..000000000 --- a/src/tag/TagSettings.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2003-2015 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_TAG_SETTINGS_H -#define MPD_TAG_SETTINGS_H - -#include "TagType.h" -#include "Compiler.h" - -#include - -typedef uint_least32_t tag_mask_t; - -extern tag_mask_t global_tag_mask; - -#ifdef __cplusplus - -gcc_const -static inline bool -IsTagEnabled(unsigned tag) -{ - return global_tag_mask & (1u << tag); -} - -gcc_const -static inline bool -IsTagEnabled(TagType tag) -{ - return IsTagEnabled(unsigned(tag)); -} - -#endif - -#endif -- cgit v1.2.3