From 118b76a8f1f5918947596c753aa9e01dca72df72 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Mon, 6 Mar 2023 15:18:48 +0100
Subject: [PATCH] db/Interface, ...: forward-declare TagType

---
 src/command/ClientCommands.cxx                 | 1 +
 src/command/TagCommands.cxx                    | 1 +
 src/db/Interface.hxx                           | 3 ++-
 src/db/UniqueTags.hxx                          | 4 ++--
 src/output/plugins/httpd/IcyMetaDataServer.hxx | 4 +++-
 src/song/Filter.cxx                            | 1 +
 src/tag/Config.cxx                             | 1 +
 src/tag/Fallback.hxx                           | 2 ++
 src/tag/GenParseName.cxx                       | 1 +
 src/tag/Handler.hxx                            | 3 ++-
 src/tag/Item.hxx                               | 4 +++-
 src/tag/Mask.hxx                               | 4 ++--
 src/tag/ParseName.hxx                          | 5 +++--
 src/tag/Pool.hxx                               | 4 +++-
 src/tag/Settings.cxx                           | 1 +
 src/tag/Settings.hxx                           | 1 -
 src/tag/Sort.hxx                               | 3 ++-
 17 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/src/command/ClientCommands.cxx b/src/command/ClientCommands.cxx
index 9b70e4652..7e66f1244 100644
--- a/src/command/ClientCommands.cxx
+++ b/src/command/ClientCommands.cxx
@@ -8,6 +8,7 @@
 #include "client/Response.hxx"
 #include "TagPrint.hxx"
 #include "tag/ParseName.hxx"
+#include "tag/Type.h"
 #include "util/StringAPI.hxx"
 
 CommandResult
diff --git a/src/command/TagCommands.cxx b/src/command/TagCommands.cxx
index 7032810b0..95c3b39ba 100644
--- a/src/command/TagCommands.cxx
+++ b/src/command/TagCommands.cxx
@@ -6,6 +6,7 @@
 #include "client/Client.hxx"
 #include "client/Response.hxx"
 #include "tag/ParseName.hxx"
+#include "tag/Type.h"
 #include "queue/Playlist.hxx"
 
 #include <fmt/format.h>
diff --git a/src/db/Interface.hxx b/src/db/Interface.hxx
index 0d1946ae2..78b9d3601 100644
--- a/src/db/Interface.hxx
+++ b/src/db/Interface.hxx
@@ -5,12 +5,13 @@
 #define MPD_DATABASE_INTERFACE_HXX
 
 #include "Visitor.hxx"
-#include "tag/Type.h"
 
 #include <chrono>
+#include <cstdint>
 #include <span>
 #include <string>
 
+enum TagType : uint8_t;
 struct DatabasePlugin;
 struct DatabaseStats;
 struct DatabaseSelection;
diff --git a/src/db/UniqueTags.hxx b/src/db/UniqueTags.hxx
index 047326ca3..5d10a2067 100644
--- a/src/db/UniqueTags.hxx
+++ b/src/db/UniqueTags.hxx
@@ -4,11 +4,11 @@
 #ifndef MPD_DB_UNIQUE_TAGS_HXX
 #define MPD_DB_UNIQUE_TAGS_HXX
 
-#include "tag/Type.h"
-
+#include <cstdint>
 #include <span>
 #include <string>
 
+enum TagType : uint8_t;
 class Database;
 struct DatabaseSelection;
 template<typename Key> class RecursiveMap;
diff --git a/src/output/plugins/httpd/IcyMetaDataServer.hxx b/src/output/plugins/httpd/IcyMetaDataServer.hxx
index f8fca132e..07d150eac 100644
--- a/src/output/plugins/httpd/IcyMetaDataServer.hxx
+++ b/src/output/plugins/httpd/IcyMetaDataServer.hxx
@@ -5,8 +5,10 @@
 #define MPD_ICY_META_DATA_SERVER_HXX
 
 #include "Page.hxx"
-#include "tag/Type.h"
 
+#include <cstdint>
+
+enum TagType : uint8_t;
 struct Tag;
 class AllocatedString;
 
diff --git a/src/song/Filter.cxx b/src/song/Filter.cxx
index 1ddfa7c77..333dce683 100644
--- a/src/song/Filter.cxx
+++ b/src/song/Filter.cxx
@@ -12,6 +12,7 @@
 #include "PrioritySongFilter.hxx"
 #include "pcm/AudioParser.hxx"
 #include "tag/ParseName.hxx"
+#include "tag/Type.h"
 #include "time/ISO8601.hxx"
 #include "lib/fmt/RuntimeError.hxx"
 #include "util/CharUtil.hxx"
diff --git a/src/tag/Config.cxx b/src/tag/Config.cxx
index 608256863..9d848f2a7 100644
--- a/src/tag/Config.cxx
+++ b/src/tag/Config.cxx
@@ -4,6 +4,7 @@
 #include "Config.hxx"
 #include "Settings.hxx"
 #include "ParseName.hxx"
+#include "Type.h"
 #include "config/Data.hxx"
 #include "config/Option.hxx"
 #include "lib/fmt/RuntimeError.hxx"
diff --git a/src/tag/Fallback.hxx b/src/tag/Fallback.hxx
index c9d72aebd..2c8ed8962 100644
--- a/src/tag/Fallback.hxx
+++ b/src/tag/Fallback.hxx
@@ -4,6 +4,8 @@
 #ifndef MPD_TAG_FALLBACK_HXX
 #define MPD_TAG_FALLBACK_HXX
 
+#include "Type.h"
+
 #include <utility>
 
 /**
diff --git a/src/tag/GenParseName.cxx b/src/tag/GenParseName.cxx
index 1a96ea69c..fdaf90adf 100644
--- a/src/tag/GenParseName.cxx
+++ b/src/tag/GenParseName.cxx
@@ -31,6 +31,7 @@ main(int argc, char **argv)
 
 	fprintf(out,
 		"#include \"ParseName.hxx\"\n"
+		"#include \"Type.h\"\n"
 		"\n"
 		"#include <assert.h>\n"
 		"#include <string.h>\n"
diff --git a/src/tag/Handler.hxx b/src/tag/Handler.hxx
index 7b4fccc9c..c376020ef 100644
--- a/src/tag/Handler.hxx
+++ b/src/tag/Handler.hxx
@@ -4,14 +4,15 @@
 #ifndef MPD_TAG_HANDLER_HXX
 #define MPD_TAG_HANDLER_HXX
 
-#include "Type.h"
 #include "Chrono.hxx"
 #include "util/Compiler.h"
 
 #include <cstddef>
+#include <cstdint>
 #include <span>
 #include <string_view>
 
+enum TagType : uint8_t;
 struct AudioFormat;
 class TagBuilder;
 
diff --git a/src/tag/Item.hxx b/src/tag/Item.hxx
index 22e74747b..84bf6ae49 100644
--- a/src/tag/Item.hxx
+++ b/src/tag/Item.hxx
@@ -4,7 +4,9 @@
 #ifndef MPD_TAG_ITEM_HXX
 #define MPD_TAG_ITEM_HXX
 
-#include "Type.h"
+#include <cstdint>
+
+enum TagType : uint8_t;
 
 /**
  * One tag value.  It is a mapping of #TagType to am arbitrary string
diff --git a/src/tag/Mask.hxx b/src/tag/Mask.hxx
index 19ada0c39..534680beb 100644
--- a/src/tag/Mask.hxx
+++ b/src/tag/Mask.hxx
@@ -4,10 +4,10 @@
 #ifndef MPD_TAG_MASK_HXX
 #define MPD_TAG_MASK_HXX
 
-#include "Type.h"
-
 #include <cstdint>
 
+enum TagType : uint8_t;
+
 class TagMask {
 	typedef uint_least32_t mask_t;
 	mask_t value;
diff --git a/src/tag/ParseName.hxx b/src/tag/ParseName.hxx
index f1da1cba3..18e9001af 100644
--- a/src/tag/ParseName.hxx
+++ b/src/tag/ParseName.hxx
@@ -4,10 +4,11 @@
 #ifndef MPD_TAG_PARSE_NAME_HXX
 #define MPD_TAG_PARSE_NAME_HXX
 
-#include "Type.h"
-
+#include <cstdint>
 #include <string_view>
 
+enum TagType : uint8_t;
+
 /**
  * Parse the string, and convert it into a #TagType.  Returns
  * #TAG_NUM_OF_ITEM_TYPES if the string could not be recognized.
diff --git a/src/tag/Pool.hxx b/src/tag/Pool.hxx
index e3c9efded..a5c879fa1 100644
--- a/src/tag/Pool.hxx
+++ b/src/tag/Pool.hxx
@@ -4,11 +4,13 @@
 #ifndef MPD_TAG_POOL_HXX
 #define MPD_TAG_POOL_HXX
 
-#include "Type.h"
 #include "thread/Mutex.hxx"
 
+#include <cstdint>
 #include <string_view>
 
+enum TagType : uint8_t;
+
 extern Mutex tag_pool_lock;
 
 struct TagItem;
diff --git a/src/tag/Settings.cxx b/src/tag/Settings.cxx
index 880449ca0..582722a44 100644
--- a/src/tag/Settings.cxx
+++ b/src/tag/Settings.cxx
@@ -2,5 +2,6 @@
 // Copyright The Music Player Daemon Project
 
 #include "Settings.hxx"
+#include "Type.h"
 
 TagMask global_tag_mask = TagMask::All() & ~TagMask(TAG_COMMENT);
diff --git a/src/tag/Settings.hxx b/src/tag/Settings.hxx
index cbadebb25..5e6d75b9b 100644
--- a/src/tag/Settings.hxx
+++ b/src/tag/Settings.hxx
@@ -5,7 +5,6 @@
 #define MPD_TAG_SETTINGS_HXX
 
 #include "Mask.hxx"
-#include "Type.h"
 
 extern TagMask global_tag_mask;
 
diff --git a/src/tag/Sort.hxx b/src/tag/Sort.hxx
index b2ee450a1..ed1ce48f2 100644
--- a/src/tag/Sort.hxx
+++ b/src/tag/Sort.hxx
@@ -3,8 +3,9 @@
 
 #pragma once
 
-#include "Type.h"
+#include <cstdint>
 
+enum TagType : uint8_t;
 struct Tag;
 
 [[gnu::pure]]