Improve compilation times by removing some includes and avoiding heavy dependencies

This commit is contained in:
Vittorio Romeo 2021-12-19 17:34:49 +01:00
parent 569a7549d4
commit 18bb892625
38 changed files with 54 additions and 52 deletions

View File

@ -5,7 +5,6 @@
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
#include <iomanip>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>

View File

@ -5,7 +5,6 @@
#include <SFML/Audio.hpp> #include <SFML/Audio.hpp>
#include <SFML/Network.hpp> #include <SFML/Network.hpp>
#include <cstring> #include <cstring>
#include <iomanip>
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
#include <mutex> #include <mutex>

View File

@ -2,7 +2,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <iomanip>
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>

View File

@ -28,7 +28,7 @@
#ifndef SF_GLAD_WGL_H_ #ifndef SF_GLAD_WGL_H_
#define SF_GLAD_WGL_H_ #define SF_GLAD_WGL_H_
#include <windows.h> #include <SFML/System/Win32/WindowsHeader.hpp>
#include <glad/gl.h> #include <glad/gl.h>
#define SF_GLAD_WGL #define SF_GLAD_WGL

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp> #include <SFML/Audio/Export.hpp>
#include <string>
namespace sf namespace sf

View File

@ -32,7 +32,6 @@
#include <SFML/Graphics/RenderTarget.hpp> #include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/Image.hpp> #include <SFML/Graphics/Image.hpp>
#include <SFML/Window/Window.hpp> #include <SFML/Window/Window.hpp>
#include <string>
namespace sf namespace sf

View File

@ -30,8 +30,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Network/Export.hpp> #include <SFML/Network/Export.hpp>
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>
#include <istream> #include <iosfwd>
#include <ostream>
#include <string> #include <string>

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
#include <algorithm>
#include <locale> #include <locale>
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
@ -37,6 +36,12 @@
namespace sf namespace sf
{ {
namespace priv
{
template<class InputIt, class OutputIt>
OutputIt copy(InputIt first, InputIt last, OutputIt d_first);
}
template <unsigned int N> template <unsigned int N>
class Utf; class Utf;

View File

@ -35,6 +35,15 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename InputIt, typename OutputIt>
OutputIt priv::copy(InputIt first, InputIt last, OutputIt d_first)
{
while (first != last)
*d_first++ = *first++;
return d_first;
}
template <typename In> template <typename In>
In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement) In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
{ {
@ -121,7 +130,7 @@ Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement)
} }
// Add them to the output // Add them to the output
output = std::copy(bytes, bytes + bytestoWrite, output); output = priv::copy(bytes, bytes + bytestoWrite, output);
} }
return output; return output;
@ -244,7 +253,7 @@ Out Utf<8>::toLatin1(In begin, In end, Out output, char replacement)
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<8>::toUtf8(In begin, In end, Out output) Out Utf<8>::toUtf8(In begin, In end, Out output)
{ {
return std::copy(begin, end, output); return priv::copy(begin, end, output);
} }
@ -413,7 +422,7 @@ Out Utf<16>::fromLatin1(In begin, In end, Out output)
{ {
// Latin-1 is directly compatible with Unicode encodings, // Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32 // and can thus be treated as (a sub-range of) UTF-32
return std::copy(begin, end, output); return priv::copy(begin, end, output);
} }
@ -482,7 +491,7 @@ Out Utf<16>::toUtf8(In begin, In end, Out output)
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<16>::toUtf16(In begin, In end, Out output) Out Utf<16>::toUtf16(In begin, In end, Out output)
{ {
return std::copy(begin, end, output); return priv::copy(begin, end, output);
} }
@ -563,7 +572,7 @@ Out Utf<32>::fromLatin1(In begin, In end, Out output)
{ {
// Latin-1 is directly compatible with Unicode encodings, // Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32 // and can thus be treated as (a sub-range of) UTF-32
return std::copy(begin, end, output); return priv::copy(begin, end, output);
} }
@ -630,7 +639,7 @@ Out Utf<32>::toUtf16(In begin, In end, Out output)
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<32>::toUtf32(In begin, In end, Out output) Out Utf<32>::toUtf32(In begin, In end, Out output)
{ {
return std::copy(begin, end, output); return priv::copy(begin, end, output);
} }

View File

@ -29,11 +29,12 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Export.hpp> #include <SFML/Window/Export.hpp>
#include <SFML/System/String.hpp>
namespace sf namespace sf
{ {
class String;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Give access to the system clipboard /// \brief Give access to the system clipboard
/// ///

View File

@ -35,12 +35,13 @@
#include <SFML/Window/WindowHandle.hpp> #include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/WindowStyle.hpp> #include <SFML/Window/WindowStyle.hpp>
#include <SFML/System/Clock.hpp> #include <SFML/System/Clock.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
namespace sf namespace sf
{ {
class String;
namespace priv namespace priv
{ {
class WindowImpl; class WindowImpl;

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/System/Vector3.hpp> #include <SFML/System/Vector3.hpp>
#include <set>
#include <string> #include <string>

View File

@ -30,7 +30,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Audio/SoundFileReader.hpp> #include <SFML/Audio/SoundFileReader.hpp>
#include <FLAC/stream_decoder.h> #include <FLAC/stream_decoder.h>
#include <string>
#include <vector> #include <vector>

View File

@ -28,7 +28,6 @@
#include <SFML/Audio/SoundFileReaderOgg.hpp> #include <SFML/Audio/SoundFileReaderOgg.hpp>
#include <SFML/System/MemoryInputStream.hpp> #include <SFML/System/MemoryInputStream.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <algorithm>
#include <cctype> #include <cctype>
#include <cassert> #include <cassert>

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Audio/SoundFileReader.hpp> #include <SFML/Audio/SoundFileReader.hpp>
#include <string>
namespace sf namespace sf

View File

@ -28,6 +28,7 @@
#include <SFML/Graphics/Text.hpp> #include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Texture.hpp> #include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderTarget.hpp> #include <SFML/Graphics/RenderTarget.hpp>
#include <algorithm>
#include <cmath> #include <cmath>

View File

@ -28,7 +28,6 @@
#include <SFML/Network/Http.hpp> #include <SFML/Network/Http.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <cctype> #include <cctype>
#include <algorithm>
#include <iterator> #include <iterator>
#include <sstream> #include <sstream>
#include <limits> #include <limits>
@ -204,7 +203,7 @@ void Http::Response::parse(const std::string& data)
{ {
if ((version.size() >= 8) && (version[6] == '.') && if ((version.size() >= 8) && (version[6] == '.') &&
(toLower(version.substr(0, 5)) == "http/") && (toLower(version.substr(0, 5)) == "http/") &&
isdigit(version[5]) && isdigit(version[7])) std::isdigit(version[5]) && std::isdigit(version[7]))
{ {
m_majorVersion = static_cast<unsigned int>(version[5] - '0'); m_majorVersion = static_cast<unsigned int>(version[5] - '0');
m_minorVersion = static_cast<unsigned int>(version[7] - '0'); m_minorVersion = static_cast<unsigned int>(version[7] - '0');

View File

@ -28,6 +28,8 @@
#include <SFML/Network/IpAddress.hpp> #include <SFML/Network/IpAddress.hpp>
#include <SFML/Network/Http.hpp> #include <SFML/Network/Http.hpp>
#include <SFML/Network/SocketImpl.hpp> #include <SFML/Network/SocketImpl.hpp>
#include <istream>
#include <ostream>
#include <cstring> #include <cstring>
#include <utility> #include <utility>

View File

@ -30,7 +30,7 @@
#include <SFML/Network/Packet.hpp> #include <SFML/Network/Packet.hpp>
#include <SFML/Network/SocketImpl.hpp> #include <SFML/Network/SocketImpl.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <algorithm> #include <cstddef>
namespace sf namespace sf

View File

@ -26,6 +26,7 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <iostream>
#include <streambuf> #include <streambuf>
#include <cstdio> #include <cstdio>

View File

@ -27,6 +27,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Android/ClipboardImpl.hpp> #include <SFML/Window/Android/ClipboardImpl.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp>
namespace sf namespace sf

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLANDROID_HPP #ifndef SFML_CLIPBOARDIMPLANDROID_HPP
#define SFML_CLIPBOARDIMPLANDROID_HPP #define SFML_CLIPBOARDIMPLANDROID_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf namespace sf
{ {
class String;
namespace priv namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -29,6 +29,7 @@
#include <SFML/Window/EGLCheck.hpp> #include <SFML/Window/EGLCheck.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <glad/egl.h> #include <glad/egl.h>
#include <string>
namespace sf namespace sf

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
#include <string>
namespace sf namespace sf

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLCOCOA_HPP #ifndef SFML_CLIPBOARDIMPLCOCOA_HPP
#define SFML_CLIPBOARDIMPLCOCOA_HPP #define SFML_CLIPBOARDIMPLCOCOA_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf namespace sf
{ {
class String;
namespace priv namespace priv
{ {

View File

@ -27,6 +27,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/OSX/AutoreleasePoolWrapper.hpp> #include <SFML/Window/OSX/AutoreleasePoolWrapper.hpp>
#include <SFML/Window/OSX/ClipboardImpl.hpp> #include <SFML/Window/OSX/ClipboardImpl.hpp>
#include <SFML/System/String.hpp>
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>

View File

@ -30,7 +30,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/JoystickImpl.hpp> #include <SFML/Window/JoystickImpl.hpp>
#include <SFML/System/String.hpp>
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <IOKit/hid/IOHIDDevice.h> #include <IOKit/hid/IOHIDDevice.h>
#include <IOKit/hid/IOHIDKeys.h> #include <IOKit/hid/IOHIDKeys.h>

View File

@ -31,7 +31,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Event.hpp> #include <SFML/Window/Event.hpp>
#include <SFML/Window/WindowImpl.hpp> #include <SFML/Window/WindowImpl.hpp>
#include <SFML/System/String.hpp>
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Predefine OBJ-C classes /// Predefine OBJ-C classes
@ -55,6 +54,8 @@ using NSOpenGLContextRef = void*;
namespace sf namespace sf
{ {
class String;
namespace priv namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -29,6 +29,7 @@
#include <SFML/Window/OSX/AutoreleasePoolWrapper.hpp> #include <SFML/Window/OSX/AutoreleasePoolWrapper.hpp>
#include <SFML/Window/OSX/WindowImplCocoa.hpp> #include <SFML/Window/OSX/WindowImplCocoa.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp>
#import <SFML/Window/OSX/cpp_objc_conversion.h> #import <SFML/Window/OSX/cpp_objc_conversion.h>
#import <SFML/Window/OSX/Scaling.h> #import <SFML/Window/OSX/Scaling.h>

View File

@ -29,6 +29,7 @@
#include <SFML/Window/Unix/ClipboardImpl.hpp> #include <SFML/Window/Unix/ClipboardImpl.hpp>
#include <SFML/Window/Unix/Display.hpp> #include <SFML/Window/Unix/Display.hpp>
#include <SFML/Window/Unix/InputImpl.hpp> #include <SFML/Window/Unix/InputImpl.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Utf.hpp> #include <SFML/System/Utf.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <SFML/System/Sleep.hpp> #include <SFML/System/Sleep.hpp>

View File

@ -30,7 +30,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Event.hpp> #include <SFML/Window/Event.hpp>
#include <SFML/Window/WindowImpl.hpp> #include <SFML/Window/WindowImpl.hpp>
#include <SFML/System/String.hpp>
#include <SFML/Window/WindowStyle.hpp> // Prevent conflict with macro None from Xlib #include <SFML/Window/WindowStyle.hpp> // Prevent conflict with macro None from Xlib
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <deque> #include <deque>

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLWIN32_HPP #ifndef SFML_CLIPBOARDIMPLWIN32_HPP
#define SFML_CLIPBOARDIMPLWIN32_HPP #define SFML_CLIPBOARDIMPLWIN32_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf namespace sf
{ {
class String;
namespace priv namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -31,7 +31,6 @@
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <tchar.h> #include <tchar.h>
#include <regstr.h> #include <regstr.h>
#include <algorithm>
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>

View File

@ -29,6 +29,7 @@
#include <SFML/Window/WindowStyle.hpp> #include <SFML/Window/WindowStyle.hpp>
#include <SFML/Window/JoystickImpl.hpp> #include <SFML/Window/JoystickImpl.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Utf.hpp> #include <SFML/System/Utf.hpp>
// dbt.h is lowercase here, as a cross-compile on linux with mingw-w64 // dbt.h is lowercase here, as a cross-compile on linux with mingw-w64
// expects lowercase, and a native compile on windows, whether via msvc // expects lowercase, and a native compile on windows, whether via msvc

View File

@ -31,11 +31,12 @@
#include <SFML/Window/Event.hpp> #include <SFML/Window/Event.hpp>
#include <SFML/Window/WindowImpl.hpp> #include <SFML/Window/WindowImpl.hpp>
#include <SFML/System/Win32/WindowsHeader.hpp> #include <SFML/System/Win32/WindowsHeader.hpp>
#include <SFML/System/String.hpp>
namespace sf namespace sf
{ {
class String;
namespace priv namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
#include <SFML/System/String.hpp>
#include <SFML/Window/ContextSettings.hpp> #include <SFML/Window/ContextSettings.hpp>
#include <SFML/Window/CursorImpl.hpp> #include <SFML/Window/CursorImpl.hpp>
#include <SFML/Window/Event.hpp> #include <SFML/Window/Event.hpp>
@ -37,13 +36,14 @@
#include <SFML/Window/Sensor.hpp> #include <SFML/Window/Sensor.hpp>
#include <SFML/Window/SensorImpl.hpp> #include <SFML/Window/SensorImpl.hpp>
#include <SFML/Window/VideoMode.hpp> #include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/Vulkan.hpp>
#include <SFML/Window/WindowHandle.hpp> #include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/Window.hpp>
#include <queue> #include <queue>
#include <set> #include <set>
namespace sf namespace sf
{ {
class String;
class WindowListener; class WindowListener;
namespace priv namespace priv

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLIOS_HPP #ifndef SFML_CLIPBOARDIMPLIOS_HPP
#define SFML_CLIPBOARDIMPLIOS_HPP #define SFML_CLIPBOARDIMPLIOS_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf namespace sf
{ {
class String;
namespace priv namespace priv
{ {

View File

@ -26,6 +26,7 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/iOS/ClipboardImpl.hpp> #include <SFML/Window/iOS/ClipboardImpl.hpp>
#include <SFML/System/String.hpp>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>