From 8b36da3625eeb4bbcf5a930c8abae21e32c76c7b Mon Sep 17 00:00:00 2001 From: vittorioromeo Date: Wed, 22 May 2024 13:07:46 +0200 Subject: [PATCH] Use '{}' for default parameter initialization --- include/SFML/Graphics/Image.hpp | 5 +---- include/SFML/Graphics/RectangleShape.hpp | 2 +- include/SFML/Graphics/Texture.hpp | 8 ++++---- include/SFML/System/String.hpp | 8 ++++---- include/SFML/System/Utf.hpp | 16 ++++++++-------- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp index 3963585fe..6c94eef04 100644 --- a/include/SFML/Graphics/Image.hpp +++ b/include/SFML/Graphics/Image.hpp @@ -217,10 +217,7 @@ public: /// \return True if the operation was successful, false otherwise /// //////////////////////////////////////////////////////////// - [[nodiscard]] bool copy(const Image& source, - const Vector2u& dest, - const IntRect& sourceRect = IntRect({0, 0}, {0, 0}), - bool applyAlpha = false); + [[nodiscard]] bool copy(const Image& source, const Vector2u& dest, const IntRect& sourceRect = {}, bool applyAlpha = false); //////////////////////////////////////////////////////////// /// \brief Change the color of a pixel diff --git a/include/SFML/Graphics/RectangleShape.hpp b/include/SFML/Graphics/RectangleShape.hpp index 700d4ce03..99a7a5020 100644 --- a/include/SFML/Graphics/RectangleShape.hpp +++ b/include/SFML/Graphics/RectangleShape.hpp @@ -51,7 +51,7 @@ public: /// \param size Size of the rectangle /// //////////////////////////////////////////////////////////// - explicit RectangleShape(const Vector2f& size = Vector2f(0, 0)); + explicit RectangleShape(const Vector2f& size = {}); //////////////////////////////////////////////////////////// /// \brief Set the size of the rectangle diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp index 6ecd36cd5..8e75dc4b0 100644 --- a/include/SFML/Graphics/Texture.hpp +++ b/include/SFML/Graphics/Texture.hpp @@ -129,7 +129,7 @@ public: /// \see loadFromMemory, loadFromStream, loadFromImage /// //////////////////////////////////////////////////////////// - [[nodiscard]] bool loadFromFile(const std::filesystem::path& filename, const IntRect& area = IntRect()); + [[nodiscard]] bool loadFromFile(const std::filesystem::path& filename, const IntRect& area = {}); //////////////////////////////////////////////////////////// /// \brief Load the texture from a file in memory @@ -154,7 +154,7 @@ public: /// \see loadFromFile, loadFromStream, loadFromImage /// //////////////////////////////////////////////////////////// - [[nodiscard]] bool loadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect()); + [[nodiscard]] bool loadFromMemory(const void* data, std::size_t size, const IntRect& area = {}); //////////////////////////////////////////////////////////// /// \brief Load the texture from a custom stream @@ -178,7 +178,7 @@ public: /// \see loadFromFile, loadFromMemory, loadFromImage /// //////////////////////////////////////////////////////////// - [[nodiscard]] bool loadFromStream(InputStream& stream, const IntRect& area = IntRect()); + [[nodiscard]] bool loadFromStream(InputStream& stream, const IntRect& area = {}); //////////////////////////////////////////////////////////// /// \brief Load the texture from an image @@ -202,7 +202,7 @@ public: /// \see loadFromFile, loadFromMemory /// //////////////////////////////////////////////////////////// - [[nodiscard]] bool loadFromImage(const Image& image, const IntRect& area = IntRect()); + [[nodiscard]] bool loadFromImage(const Image& image, const IntRect& area = {}); //////////////////////////////////////////////////////////// /// \brief Return the size of the texture diff --git a/include/SFML/System/String.hpp b/include/SFML/System/String.hpp index 27480db29..383e0120d 100644 --- a/include/SFML/System/String.hpp +++ b/include/SFML/System/String.hpp @@ -120,7 +120,7 @@ public: /// \param locale Locale to use for conversion /// //////////////////////////////////////////////////////////// - String(char ansiChar, const std::locale& locale = std::locale()); + String(char ansiChar, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Construct from single wide character @@ -148,7 +148,7 @@ public: /// \param locale Locale to use for conversion /// //////////////////////////////////////////////////////////// - String(const char* ansiString, const std::locale& locale = std::locale()); + String(const char* ansiString, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Construct from an ANSI string and a locale @@ -160,7 +160,7 @@ public: /// \param locale Locale to use for conversion /// //////////////////////////////////////////////////////////// - String(const std::string& ansiString, const std::locale& locale = std::locale()); + String(const std::string& ansiString, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Construct from null-terminated C-style wide string @@ -287,7 +287,7 @@ public: /// \see toWideString, operator std::string /// //////////////////////////////////////////////////////////// - [[nodiscard]] std::string toAnsiString(const std::locale& locale = std::locale()) const; + [[nodiscard]] std::string toAnsiString(const std::locale& locale = {}) const; //////////////////////////////////////////////////////////// /// \brief Convert the Unicode string to a wide string diff --git a/include/SFML/System/Utf.hpp b/include/SFML/System/Utf.hpp index 8773af89d..f4a9931ae 100644 --- a/include/SFML/System/Utf.hpp +++ b/include/SFML/System/Utf.hpp @@ -134,7 +134,7 @@ public: /// //////////////////////////////////////////////////////////// template - static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Convert a wide characters range to UTF-8 @@ -178,7 +178,7 @@ public: /// //////////////////////////////////////////////////////////// template - static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Convert an UTF-8 characters range to wide characters @@ -340,7 +340,7 @@ public: /// //////////////////////////////////////////////////////////// template - static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Convert a wide characters range to UTF-16 @@ -384,7 +384,7 @@ public: /// //////////////////////////////////////////////////////////// template - static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Convert an UTF-16 characters range to wide characters @@ -547,7 +547,7 @@ public: /// //////////////////////////////////////////////////////////// template - static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Convert a wide characters range to UTF-32 @@ -591,7 +591,7 @@ public: /// //////////////////////////////////////////////////////////// template - static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Convert an UTF-32 characters range to wide characters @@ -679,7 +679,7 @@ public: /// //////////////////////////////////////////////////////////// template - static std::uint32_t decodeAnsi(In input, const std::locale& locale = std::locale()); + static std::uint32_t decodeAnsi(In input, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Decode a single wide character to UTF-32 @@ -712,7 +712,7 @@ public: /// //////////////////////////////////////////////////////////// template - static Out encodeAnsi(std::uint32_t codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale()); + static Out encodeAnsi(std::uint32_t codepoint, Out output, char replacement = 0, const std::locale& locale = {}); //////////////////////////////////////////////////////////// /// \brief Encode a single UTF-32 character to wide