From 698b7ee49f36423e5352e7bcf82ecab13f941bdc Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Mon, 20 Feb 2023 22:31:47 +0100 Subject: [PATCH] Remove unused headers and reduce physical dependencies --- include/SFML/Audio/InputSoundFile.hpp | 1 - include/SFML/Audio/Music.hpp | 1 - include/SFML/Audio/OutputSoundFile.hpp | 1 - include/SFML/Audio/SoundFileFactory.hpp | 1 - include/SFML/Audio/SoundFileWriter.hpp | 1 - include/SFML/Graphics/Image.hpp | 4 ++-- include/SFML/Graphics/Text.hpp | 1 - include/SFML/System/FileInputStream.hpp | 1 - include/SFML/System/String.hpp | 1 - include/SFML/System/Utf.hpp | 2 -- src/SFML/Audio/SoundFileWriterWav.hpp | 2 +- src/SFML/Graphics/Image.cpp | 4 ++-- src/SFML/Window/DRM/ClipboardImpl.cpp | 2 +- src/SFML/Window/DRM/ClipboardImpl.hpp | 13 ++++++------- src/SFML/Window/Win32/VulkanImplWin32.cpp | 2 +- 15 files changed, 13 insertions(+), 24 deletions(-) diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index d3951094..20b946ee 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -34,7 +34,6 @@ #include #include #include -#include namespace sf diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 8d217a56..f4a704d2 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -33,7 +33,6 @@ #include #include -#include #include diff --git a/include/SFML/Audio/OutputSoundFile.hpp b/include/SFML/Audio/OutputSoundFile.hpp index 26497f0b..26447137 100644 --- a/include/SFML/Audio/OutputSoundFile.hpp +++ b/include/SFML/Audio/OutputSoundFile.hpp @@ -33,7 +33,6 @@ #include #include -#include namespace sf diff --git a/include/SFML/Audio/SoundFileFactory.hpp b/include/SFML/Audio/SoundFileFactory.hpp index 3f3d0f89..92797f96 100644 --- a/include/SFML/Audio/SoundFileFactory.hpp +++ b/include/SFML/Audio/SoundFileFactory.hpp @@ -31,7 +31,6 @@ #include #include -#include #include diff --git a/include/SFML/Audio/SoundFileWriter.hpp b/include/SFML/Audio/SoundFileWriter.hpp index 1cf94598..4944f6f8 100644 --- a/include/SFML/Audio/SoundFileWriter.hpp +++ b/include/SFML/Audio/SoundFileWriter.hpp @@ -30,7 +30,6 @@ #include #include -#include namespace sf diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp index 09fb05b3..933a1529 100644 --- a/include/SFML/Graphics/Image.hpp +++ b/include/SFML/Graphics/Image.hpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include @@ -156,7 +156,7 @@ public: /// \see create, loadFromFile, loadFromMemory, saveToFile /// //////////////////////////////////////////////////////////// - [[nodiscard]] bool saveToMemory(std::vector& output, const std::string& format) const; + [[nodiscard]] bool saveToMemory(std::vector& output, std::string_view format) const; //////////////////////////////////////////////////////////// /// \brief Return the size (width and height) of the image diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index ca7879a8..ad7351d7 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -35,7 +35,6 @@ #include #include -#include #include diff --git a/include/SFML/System/FileInputStream.hpp b/include/SFML/System/FileInputStream.hpp index ca595753..b85177ef 100644 --- a/include/SFML/System/FileInputStream.hpp +++ b/include/SFML/System/FileInputStream.hpp @@ -36,7 +36,6 @@ #include #include #include -#include #ifdef SFML_SYSTEM_ANDROID namespace sf::priv diff --git a/include/SFML/System/String.hpp b/include/SFML/System/String.hpp index 590661af..d13341dd 100644 --- a/include/SFML/System/String.hpp +++ b/include/SFML/System/String.hpp @@ -31,7 +31,6 @@ #include -#include #include #include diff --git a/include/SFML/System/Utf.hpp b/include/SFML/System/Utf.hpp index 40278676..086d9e62 100644 --- a/include/SFML/System/Utf.hpp +++ b/include/SFML/System/Utf.hpp @@ -30,9 +30,7 @@ #include #include -#include #include -#include namespace sf diff --git a/src/SFML/Audio/SoundFileWriterWav.hpp b/src/SFML/Audio/SoundFileWriterWav.hpp index 160792c6..f4a8b13e 100644 --- a/src/SFML/Audio/SoundFileWriterWav.hpp +++ b/src/SFML/Audio/SoundFileWriterWav.hpp @@ -29,8 +29,8 @@ //////////////////////////////////////////////////////////// #include +#include #include -#include namespace sf::priv diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index f34fb07f..de1d0aba 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -138,9 +138,9 @@ bool Image::saveToFile(const std::filesystem::path& filename) const } //////////////////////////////////////////////////////////// -bool Image::saveToMemory(std::vector& output, const std::string& format) const +bool Image::saveToMemory(std::vector& output, std::string_view format) const { - return priv::ImageLoader::getInstance().saveImageToMemory(format, output, m_pixels, m_size); + return priv::ImageLoader::getInstance().saveImageToMemory(std::string(format), output, m_pixels, m_size); } diff --git a/src/SFML/Window/DRM/ClipboardImpl.cpp b/src/SFML/Window/DRM/ClipboardImpl.cpp index 081aaea3..02f946e2 100644 --- a/src/SFML/Window/DRM/ClipboardImpl.cpp +++ b/src/SFML/Window/DRM/ClipboardImpl.cpp @@ -25,9 +25,9 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include - namespace sf::priv { //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/DRM/ClipboardImpl.hpp b/src/SFML/Window/DRM/ClipboardImpl.hpp index 9f06671e..0d01d015 100644 --- a/src/SFML/Window/DRM/ClipboardImpl.hpp +++ b/src/SFML/Window/DRM/ClipboardImpl.hpp @@ -24,13 +24,11 @@ #pragma once -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include +namespace sf +{ +class String; - -namespace sf::priv +namespace priv { //////////////////////////////////////////////////////////// /// \brief Give access to the system clipboard @@ -64,4 +62,5 @@ public: static void setString(const String& text); }; -} // namespace sf::priv +} // namespace priv +} // namespace sf diff --git a/src/SFML/Window/Win32/VulkanImplWin32.cpp b/src/SFML/Window/Win32/VulkanImplWin32.cpp index f6828785..d0050a6b 100644 --- a/src/SFML/Window/Win32/VulkanImplWin32.cpp +++ b/src/SFML/Window/Win32/VulkanImplWin32.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #define VK_USE_PLATFORM_WIN32_KHR #define VK_NO_PROTOTYPES #include