From 63ce7e4e92118fe2c1d4f4a3f38c595ea00b29da Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 10 Feb 2022 17:19:01 +0000 Subject: [PATCH] Remove unnecessary includes from public-facing headers --- include/SFML/Audio/InputSoundFile.hpp | 2 +- include/SFML/Audio/Music.hpp | 2 +- include/SFML/Audio/Sound.hpp | 2 +- include/SFML/Graphics/Drawable.hpp | 2 +- include/SFML/Graphics/RenderTarget.hpp | 2 +- include/SFML/Graphics/RenderWindow.hpp | 1 - include/SFML/Graphics/Shape.hpp | 2 ++ include/SFML/Graphics/Text.hpp | 3 ++- include/SFML/Graphics/Texture.hpp | 4 +++- include/SFML/Network/Ftp.hpp | 1 - include/SFML/System/Clock.hpp | 3 ++- include/SFML/System/Sleep.hpp | 3 ++- include/SFML/Window/Context.hpp | 3 ++- include/SFML/Window/Sensor.hpp | 1 - include/SFML/Window/Vulkan.hpp | 1 - include/SFML/Window/Window.hpp | 1 + src/SFML/Audio/InputSoundFile.cpp | 1 + src/SFML/Audio/Music.cpp | 1 + src/SFML/Audio/SoundBuffer.cpp | 1 + src/SFML/Graphics/Font.cpp | 1 + src/SFML/Graphics/RenderTextureImplDefault.cpp | 1 + src/SFML/Graphics/RenderTextureImplFBO.cpp | 1 + src/SFML/Graphics/Text.cpp | 1 + src/SFML/Main/MainAndroid.cpp | 1 + src/SFML/System/Clock.cpp | 1 + src/SFML/System/Sleep.cpp | 1 + src/SFML/System/Unix/SleepImpl.cpp | 1 + src/SFML/System/Unix/SleepImpl.hpp | 3 ++- src/SFML/System/Win32/SleepImpl.cpp | 1 + src/SFML/System/Win32/SleepImpl.hpp | 3 ++- src/SFML/Window/Unix/ClipboardImpl.cpp | 1 + src/SFML/Window/Unix/WindowImplX11.cpp | 1 + src/SFML/Window/Win32/JoystickImpl.cpp | 1 + src/SFML/Window/WindowImpl.cpp | 1 + src/SFML/Window/iOS/EaglContext.mm | 1 + test/System/Clock.cpp | 1 + 36 files changed, 41 insertions(+), 16 deletions(-) diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index f010258eb..7d13131d2 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include #include #include @@ -37,6 +36,7 @@ namespace sf { +class Time; class InputStream; class SoundFileReader; diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 32ed5f5f7..64cc25fef 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -31,13 +31,13 @@ #include #include #include -#include #include #include namespace sf { +class Time; class InputStream; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp index b47483ae9..7424acf07 100644 --- a/include/SFML/Audio/Sound.hpp +++ b/include/SFML/Audio/Sound.hpp @@ -30,12 +30,12 @@ //////////////////////////////////////////////////////////// #include #include -#include #include namespace sf { +class Time; class SoundBuffer; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp index 49a005f02..1ebcfbb91 100644 --- a/include/SFML/Graphics/Drawable.hpp +++ b/include/SFML/Graphics/Drawable.hpp @@ -29,12 +29,12 @@ // Headers //////////////////////////////////////////////////////////// #include -#include namespace sf { class RenderTarget; +class RenderStates; //////////////////////////////////////////////////////////// /// \brief Abstract base class for objects that can be drawn diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index 95a874b4f..47a565279 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -44,6 +43,7 @@ namespace sf { class Drawable; class VertexBuffer; +class Transform; //////////////////////////////////////////////////////////// /// \brief Base class for all render targets (window, texture, ...) diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index 3fc6c543d..b278c3764 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include -#include #include diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp index 6ae93e1c8..b2434ef85 100644 --- a/include/SFML/Graphics/Shape.hpp +++ b/include/SFML/Graphics/Shape.hpp @@ -37,6 +37,8 @@ namespace sf { +class Texture; + //////////////////////////////////////////////////////////// /// \brief Base class for textured shapes with outline /// diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index a36a1acb6..0d9228d56 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -41,6 +40,8 @@ namespace sf { +class Font; + //////////////////////////////////////////////////////////// /// \brief Graphical text that can be drawn to a render target /// diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp index 7f4e33e36..171809853 100644 --- a/include/SFML/Graphics/Texture.hpp +++ b/include/SFML/Graphics/Texture.hpp @@ -29,8 +29,9 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include +#include +#include namespace sf @@ -40,6 +41,7 @@ class RenderTarget; class RenderTexture; class Text; class Window; +class Image; //////////////////////////////////////////////////////////// /// \brief Image living on the graphics card that can be used for drawing diff --git a/include/SFML/Network/Ftp.hpp b/include/SFML/Network/Ftp.hpp index db9489268..520e18fde 100644 --- a/include/SFML/Network/Ftp.hpp +++ b/include/SFML/Network/Ftp.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include - #include #include #include diff --git a/include/SFML/System/Clock.hpp b/include/SFML/System/Clock.hpp index 0ee4d9dc0..21a9c38ca 100644 --- a/include/SFML/System/Clock.hpp +++ b/include/SFML/System/Clock.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include #include #include @@ -80,6 +79,8 @@ namespace priv } // namespace priv +class Time; + //////////////////////////////////////////////////////////// /// \brief Utility class that measures the elapsed time /// diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp index 9362e47f3..c8b74d748 100644 --- a/include/SFML/System/Sleep.hpp +++ b/include/SFML/System/Sleep.hpp @@ -29,11 +29,12 @@ // Headers //////////////////////////////////////////////////////////// #include -#include namespace sf { +class Time; + //////////////////////////////////////////////////////////// /// \ingroup system /// \brief Make the current thread sleep for a given duration diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp index 73f1fb869..21aae7117 100644 --- a/include/SFML/Window/Context.hpp +++ b/include/SFML/Window/Context.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include -#include #include @@ -41,6 +40,8 @@ namespace priv class GlContext; } +struct ContextSettings; + using GlFunctionPointer = void (*)(); //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Sensor.hpp b/include/SFML/Window/Sensor.hpp index 98652d29f..747a57211 100644 --- a/include/SFML/Window/Sensor.hpp +++ b/include/SFML/Window/Sensor.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include -#include namespace sf diff --git a/include/SFML/Window/Vulkan.hpp b/include/SFML/Window/Vulkan.hpp index 5a0927a6e..0acf0a364 100644 --- a/include/SFML/Window/Vulkan.hpp +++ b/include/SFML/Window/Vulkan.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include #include diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index d29442e19..0192a1d69 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -31,6 +31,7 @@ #include #include #include +#include #include diff --git a/src/SFML/Audio/InputSoundFile.cpp b/src/SFML/Audio/InputSoundFile.cpp index ddf7d9c85..83cfabab9 100644 --- a/src/SFML/Audio/InputSoundFile.cpp +++ b/src/SFML/Audio/InputSoundFile.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp index 9b5a190ca..ef5ba31ea 100644 --- a/src/SFML/Audio/Music.cpp +++ b/src/SFML/Audio/Music.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index 240771863..ecc58320a 100644 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #if defined(__APPLE__) diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index f0b8461dc..993c140ce 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -27,6 +27,7 @@ //////////////////////////////////////////////////////////// #include #include +#include #ifdef SFML_SYSTEM_ANDROID #include #endif diff --git a/src/SFML/Graphics/RenderTextureImplDefault.cpp b/src/SFML/Graphics/RenderTextureImplDefault.cpp index ca094ab90..c63d3c892 100644 --- a/src/SFML/Graphics/RenderTextureImplDefault.cpp +++ b/src/SFML/Graphics/RenderTextureImplDefault.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index 1fca17eb9..cefbe4bac 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/src/SFML/Graphics/Text.cpp b/src/SFML/Graphics/Text.cpp index 374a1eb1e..57355c595 100644 --- a/src/SFML/Graphics/Text.cpp +++ b/src/SFML/Graphics/Text.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/src/SFML/Main/MainAndroid.cpp b/src/SFML/Main/MainAndroid.cpp index 5a6be3c8b..5e5d03547 100644 --- a/src/SFML/Main/MainAndroid.cpp +++ b/src/SFML/Main/MainAndroid.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include diff --git a/src/SFML/System/Clock.cpp b/src/SFML/System/Clock.cpp index 2abf85dfe..f9c0ea5a3 100644 --- a/src/SFML/System/Clock.cpp +++ b/src/SFML/System/Clock.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include namespace sf diff --git a/src/SFML/System/Sleep.cpp b/src/SFML/System/Sleep.cpp index ee4c73050..bc0522311 100644 --- a/src/SFML/System/Sleep.cpp +++ b/src/SFML/System/Sleep.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #if defined(SFML_SYSTEM_WINDOWS) #include diff --git a/src/SFML/System/Unix/SleepImpl.cpp b/src/SFML/System/Unix/SleepImpl.cpp index ef35dbdea..599a448dd 100644 --- a/src/SFML/System/Unix/SleepImpl.cpp +++ b/src/SFML/System/Unix/SleepImpl.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include diff --git a/src/SFML/System/Unix/SleepImpl.hpp b/src/SFML/System/Unix/SleepImpl.hpp index 5731ad376..dbaff3741 100644 --- a/src/SFML/System/Unix/SleepImpl.hpp +++ b/src/SFML/System/Unix/SleepImpl.hpp @@ -29,9 +29,10 @@ // Headers //////////////////////////////////////////////////////////// #include -#include +namespace sf { class Time; } + namespace sf::priv { //////////////////////////////////////////////////////////// diff --git a/src/SFML/System/Win32/SleepImpl.cpp b/src/SFML/System/Win32/SleepImpl.cpp index b44364056..8207d48f4 100644 --- a/src/SFML/System/Win32/SleepImpl.cpp +++ b/src/SFML/System/Win32/SleepImpl.cpp @@ -27,6 +27,7 @@ //////////////////////////////////////////////////////////// #include #include +#include #include namespace sf::priv diff --git a/src/SFML/System/Win32/SleepImpl.hpp b/src/SFML/System/Win32/SleepImpl.hpp index 10f37ac71..4ab282830 100644 --- a/src/SFML/System/Win32/SleepImpl.hpp +++ b/src/SFML/System/Win32/SleepImpl.hpp @@ -29,11 +29,12 @@ // Headers //////////////////////////////////////////////////////////// #include -#include +namespace sf { class Time; } namespace sf::priv { + //////////////////////////////////////////////////////////// /// \brief Windows implementation of sf::Sleep /// diff --git a/src/SFML/Window/Unix/ClipboardImpl.cpp b/src/SFML/Window/Unix/ClipboardImpl.cpp index 8c21cffb2..6723a7e2d 100644 --- a/src/SFML/Window/Unix/ClipboardImpl.cpp +++ b/src/SFML/Window/Unix/ClipboardImpl.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index 382e4653c..636df98df 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #undef min // Defined by `Xlibint.h`, conflicts with standard headers diff --git a/src/SFML/Window/Win32/JoystickImpl.cpp b/src/SFML/Window/Win32/JoystickImpl.cpp index 8d0bf71c0..f4bf43a17 100644 --- a/src/SFML/Window/Win32/JoystickImpl.cpp +++ b/src/SFML/Window/Win32/JoystickImpl.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/src/SFML/Window/WindowImpl.cpp b/src/SFML/Window/WindowImpl.cpp index b5b603391..a98e88acc 100644 --- a/src/SFML/Window/WindowImpl.cpp +++ b/src/SFML/Window/WindowImpl.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/src/SFML/Window/iOS/EaglContext.mm b/src/SFML/Window/iOS/EaglContext.mm index bb18671e3..013e25217 100644 --- a/src/SFML/Window/iOS/EaglContext.mm +++ b/src/SFML/Window/iOS/EaglContext.mm @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/test/System/Clock.cpp b/test/System/Clock.cpp index 69765f79a..2c5631a2c 100644 --- a/test/System/Clock.cpp +++ b/test/System/Clock.cpp @@ -1,4 +1,5 @@ #include +#include #include "SystemUtil.hpp" #include