diff --git a/gui-builder/src/GuiBuilder.cpp b/gui-builder/src/GuiBuilder.cpp index b00748d7d..f0fa8a171 100644 --- a/gui-builder/src/GuiBuilder.cpp +++ b/gui-builder/src/GuiBuilder.cpp @@ -237,7 +237,7 @@ namespace } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -} // namespace +} // anonymous namespace ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/TGUI/Backend/Renderer/OpenGL.hpp b/include/TGUI/Backend/Renderer/OpenGL.hpp index 53b5dd0e0..2a7ef42f5 100644 --- a/include/TGUI/Backend/Renderer/OpenGL.hpp +++ b/include/TGUI/Backend/Renderer/OpenGL.hpp @@ -90,54 +90,51 @@ #define TGUI_GL_CHECK(expr) expr #endif -namespace tgui +namespace tgui::priv { - namespace priv - { #if !defined(NDEBUG) && !defined(TGUI_NO_RUNTIME_WARNINGS) - inline void checkAndLogErrorOpenGL(const char* file, unsigned int line, const char* expression) - { - const GLenum errorCode = glGetError(); - if (errorCode == GL_NO_ERROR) - return; - - const char* error; - switch (errorCode) - { - case GL_INVALID_ENUM: - error = "GL_INVALID_ENUM"; - break; - case GL_INVALID_VALUE: - error = "GL_INVALID_VALUE"; - break; - case GL_INVALID_OPERATION: - error = "GL_INVALID_OPERATION"; - break; - case GL_STACK_OVERFLOW: - error = "GL_STACK_OVERFLOW"; - break; - case GL_STACK_UNDERFLOW: - error = "GL_STACK_UNDERFLOW"; - break; - case GL_OUT_OF_MEMORY: - error = "GL_OUT_OF_MEMORY"; - break; - default: - error = "Unknown error"; - break; - } + inline void checkAndLogErrorOpenGL(const char* file, unsigned int line, const char* expression) + { + const GLenum errorCode = glGetError(); + if (errorCode == GL_NO_ERROR) + return; - const std::string fileStr = file; - TGUI_PRINT_WARNING( - "An internal OpenGL call failed in " + fileStr.substr(fileStr.find_last_of("\\/") + 1) + "(" - + std::to_string(line) + ")." + "\nExpression:\n " + expression + "\nError description:\n " + error + "\n"); - } -#else - inline void checkAndLogErrorOpenGL(const char*, unsigned int, const char*) + const char* error; + switch (errorCode) { + case GL_INVALID_ENUM: + error = "GL_INVALID_ENUM"; + break; + case GL_INVALID_VALUE: + error = "GL_INVALID_VALUE"; + break; + case GL_INVALID_OPERATION: + error = "GL_INVALID_OPERATION"; + break; + case GL_STACK_OVERFLOW: + error = "GL_STACK_OVERFLOW"; + break; + case GL_STACK_UNDERFLOW: + error = "GL_STACK_UNDERFLOW"; + break; + case GL_OUT_OF_MEMORY: + error = "GL_OUT_OF_MEMORY"; + break; + default: + error = "Unknown error"; + break; } + + const std::string fileStr = file; + TGUI_PRINT_WARNING( + "An internal OpenGL call failed in " + fileStr.substr(fileStr.find_last_of("\\/") + 1) + "(" + std::to_string(line) + + ")." + "\nExpression:\n " + expression + "\nError description:\n " + error + "\n"); + } +#else + inline void checkAndLogErrorOpenGL(const char*, unsigned int, const char*) + { + } #endif - } // namespace priv -} // namespace tgui +} // namespace tgui::priv #endif // TGUI_OPENGL_HPP diff --git a/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp b/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp index f36adb557..8956442b2 100644 --- a/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp +++ b/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp @@ -296,6 +296,4 @@ namespace tgui }; } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_CANVAS_SFML_HPP diff --git a/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp b/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp index 624b51dbe..f29aabfd1 100644 --- a/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp +++ b/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp @@ -264,13 +264,9 @@ TGUI_IGNORE_DEPRECATED_WARNINGS_START // Required for VS2017 due to inheriting a protected: GLFWwindow* m_window = nullptr; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; -} +} // namespace tgui TGUI_IGNORE_DEPRECATED_WARNINGS_END -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_BACKEND_GUI_GLFW_HPP diff --git a/include/TGUI/Backend/Window/Raylib/BackendRaylib.hpp b/include/TGUI/Backend/Window/Raylib/BackendRaylib.hpp index 941597ba3..b6c6fd37e 100644 --- a/include/TGUI/Backend/Window/Raylib/BackendRaylib.hpp +++ b/include/TGUI/Backend/Window/Raylib/BackendRaylib.hpp @@ -110,12 +110,8 @@ TGUI_IGNORE_DEPRECATED_WARNINGS_START // Required for VS2017 due to inheriting a [[nodiscard]] std::unique_ptr readFileFromAndroidAssets(const String& filename, std::size_t& fileSize) const override; #endif }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -} +} // namespace tgui TGUI_IGNORE_DEPRECATED_WARNINGS_END -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_BACKEND_RAYLIB_HPP diff --git a/include/TGUI/Backend/Window/SDL/BackendSDL.hpp b/include/TGUI/Backend/Window/SDL/BackendSDL.hpp index 78e2434d9..d5c54a614 100644 --- a/include/TGUI/Backend/Window/SDL/BackendSDL.hpp +++ b/include/TGUI/Backend/Window/SDL/BackendSDL.hpp @@ -175,12 +175,8 @@ TGUI_IGNORE_DEPRECATED_WARNINGS_START // Required for VS2017 due to inheriting a bool m_customCursorX11 = false; #endif }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -} +} // namespace tgui TGUI_IGNORE_DEPRECATED_WARNINGS_END -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_BACKEND_SDL_HPP diff --git a/include/TGUI/Backend/Window/SFML/BackendSFML.hpp b/include/TGUI/Backend/Window/SFML/BackendSFML.hpp index b36fab17a..9781ebc12 100644 --- a/include/TGUI/Backend/Window/SFML/BackendSFML.hpp +++ b/include/TGUI/Backend/Window/SFML/BackendSFML.hpp @@ -180,12 +180,8 @@ TGUI_IGNORE_DEPRECATED_WARNINGS_START // Required for VS2017 due to inheriting a static std::vector> m_leakedCursors; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -} +} // namespace tgui TGUI_IGNORE_DEPRECATED_WARNINGS_END -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_BACKEND_SFML_HPP diff --git a/include/TGUI/Renderers/TextBoxRenderer.hpp b/include/TGUI/Renderers/TextBoxRenderer.hpp index 825fdb39b..45bb78b8a 100644 --- a/include/TGUI/Renderers/TextBoxRenderer.hpp +++ b/include/TGUI/Renderers/TextBoxRenderer.hpp @@ -32,6 +32,6 @@ namespace tgui { using TextBoxRenderer TGUI_DEPRECATED("TextBoxRenderer has been renamed to TextAreaRenderer") = TextAreaRenderer; -} +} // namespace tgui #endif // TGUI_TEXT_BOX_RENDERER_HPP diff --git a/include/TGUI/SvgImage.hpp b/include/TGUI/SvgImage.hpp index 39dd143f6..e5a76b6cb 100644 --- a/include/TGUI/SvgImage.hpp +++ b/include/TGUI/SvgImage.hpp @@ -32,13 +32,10 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -namespace tgui +namespace tgui::priv { - namespace priv - { - struct SvgImageData; - } -} // namespace tgui + struct SvgImageData; +} // namespace tgui::priv namespace tgui { diff --git a/include/TGUI/Utf.hpp b/include/TGUI/Utf.hpp index 0e9dd4c77..6c79d33bb 100644 --- a/include/TGUI/Utf.hpp +++ b/include/TGUI/Utf.hpp @@ -33,280 +33,277 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -namespace tgui +namespace tgui::utf { - namespace utf + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Helper function that encodes a single UTF-32 character into one or more UTF-8 characters + /// @param input UTF-32 character to encode + /// @param outStrUtf8 Reference to string to which the output UTF-8 characters are appended + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template // CharT is either char or char8_t + void encodeCharUtf8(char32_t input, std::basic_string& outStrUtf8) { - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Helper function that encodes a single UTF-32 character into one or more UTF-8 characters - /// @param input UTF-32 character to encode - /// @param outStrUtf8 Reference to string to which the output UTF-8 characters are appended - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template // CharT is either char or char8_t - void encodeCharUtf8(char32_t input, std::basic_string& outStrUtf8) + if (input < 128) { - if (input < 128) - { - outStrUtf8.push_back(static_cast(input)); - return; - } + outStrUtf8.push_back(static_cast(input)); + return; + } - // Encode the character (if it is valid) - if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF))) - return; + // Encode the character (if it is valid) + if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF))) + return; - // Get the number of bytes to write - std::size_t bytestoWrite; - std::uint8_t firstByteMask; - if (input < 0x800) - { - bytestoWrite = 2; - firstByteMask = 0xC0; - } - else if (input < 0x10000) - { - bytestoWrite = 3; - firstByteMask = 0xE0; - } - else - { - bytestoWrite = 4; - firstByteMask = 0xF0; - } + // Get the number of bytes to write + std::size_t bytestoWrite; + std::uint8_t firstByteMask; + if (input < 0x800) + { + bytestoWrite = 2; + firstByteMask = 0xC0; + } + else if (input < 0x10000) + { + bytestoWrite = 3; + firstByteMask = 0xE0; + } + else + { + bytestoWrite = 4; + firstByteMask = 0xF0; + } - // Extract the bytes to write - std::array bytes; - if (bytestoWrite == 4) - { - bytes[3] = static_cast((input | 0x80) & 0xBF); - input >>= 6; - } - if (bytestoWrite >= 3) - { - bytes[2] = static_cast((input | 0x80) & 0xBF); - input >>= 6; - } - bytes[1] = static_cast((input | 0x80) & 0xBF); + // Extract the bytes to write + std::array bytes; + if (bytestoWrite == 4) + { + bytes[3] = static_cast((input | 0x80) & 0xBF); input >>= 6; - bytes[0] = static_cast(input | firstByteMask); - - // Add them to the output - outStrUtf8.append(bytes.cbegin(), bytes.cbegin() + static_cast(bytestoWrite)); } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Helper function that decodes one or more UTF-8 characters into a single UTF-32 character - /// @param inputCharIt Iterator to the UTF-8 character that should be decoded - /// @param inputEndIt Iterator to the end of the input - /// @param outStrUtf32 Reference to string to which the output UTF-32 character is appended - /// @return Iterator to the next UTF-8 character or inputEndIt if there are no more characters - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template // CharIt is an iterator for a string containing either char or char8_t - CharIt decodeCharUtf8(CharIt inputCharIt, CharIt inputEndIt, std::u32string& outStrUtf32) + if (bytestoWrite >= 3) { - if (static_cast(*inputCharIt) < 128) - { - outStrUtf32.push_back(static_cast(static_cast(*inputCharIt))); - return ++inputCharIt; - } + bytes[2] = static_cast((input | 0x80) & 0xBF); + input >>= 6; + } + bytes[1] = static_cast((input | 0x80) & 0xBF); + input >>= 6; + bytes[0] = static_cast(input | firstByteMask); + + // Add them to the output + outStrUtf8.append(bytes.cbegin(), bytes.cbegin() + static_cast(bytestoWrite)); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Helper function that decodes one or more UTF-8 characters into a single UTF-32 character + /// @param inputCharIt Iterator to the UTF-8 character that should be decoded + /// @param inputEndIt Iterator to the end of the input + /// @param outStrUtf32 Reference to string to which the output UTF-32 character is appended + /// @return Iterator to the next UTF-8 character or inputEndIt if there are no more characters + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template // CharIt is an iterator for a string containing either char or char8_t + CharIt decodeCharUtf8(CharIt inputCharIt, CharIt inputEndIt, std::u32string& outStrUtf32) + { + if (static_cast(*inputCharIt) < 128) + { + outStrUtf32.push_back(static_cast(static_cast(*inputCharIt))); + return ++inputCharIt; + } - // Some useful precomputed data - static const std::array offsetsMap = {0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080}; - static const std::array trailingMap = - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5}; - - // decode the character - const std::uint8_t trailingBytes = trailingMap[static_cast(*inputCharIt) - 128]; - const std::uint32_t offset = offsetsMap[trailingBytes]; - const auto remainingBytes = std::distance(inputCharIt, inputEndIt) - 1; - if (remainingBytes >= static_cast(trailingBytes)) + // Some useful precomputed data + static const std::array offsetsMap = {0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080}; + static const std::array trailingMap = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5}; + + // decode the character + const std::uint8_t trailingBytes = trailingMap[static_cast(*inputCharIt) - 128]; + const std::uint32_t offset = offsetsMap[trailingBytes]; + const auto remainingBytes = std::distance(inputCharIt, inputEndIt) - 1; + if (remainingBytes >= static_cast(trailingBytes)) + { + char32_t outputChar = 0; + for (std::uint8_t i = 0; i < trailingBytes; ++i) { - char32_t outputChar = 0; - for (std::uint8_t i = 0; i < trailingBytes; ++i) - { - outputChar += static_cast(static_cast(*inputCharIt++)); - outputChar <<= 6; - } - outputChar += static_cast(static_cast(*inputCharIt++)); - outputChar -= offset; - outStrUtf32.push_back(outputChar); + outputChar <<= 6; } - else // Incomplete character - inputCharIt = inputEndIt; - return inputCharIt; + outputChar += static_cast(static_cast(*inputCharIt++)); + outputChar -= offset; + outStrUtf32.push_back(outputChar); } + else // Incomplete character + inputCharIt = inputEndIt; + + return inputCharIt; + } #if defined(__cpp_lib_char8_t) && (__cpp_lib_char8_t >= 201811L) - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Convert an UTF-32 string to UTF-8 - /// @param strUtf32 Input UTF-32 string - /// @return Output UTF-8 string - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - [[nodiscard]] inline std::u8string convertUtf32toUtf8(const std::u32string& strUtf32) - { - std::u8string outStrUtf8; - outStrUtf8.reserve(strUtf32.length() + 1); - for (const char32_t& codepoint : strUtf32) - encodeCharUtf8(codepoint, outStrUtf8); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Convert an UTF-32 string to UTF-8 + /// @param strUtf32 Input UTF-32 string + /// @return Output UTF-8 string + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + [[nodiscard]] inline std::u8string convertUtf32toUtf8(const std::u32string& strUtf32) + { + std::u8string outStrUtf8; + outStrUtf8.reserve(strUtf32.length() + 1); + for (const char32_t& codepoint : strUtf32) + encodeCharUtf8(codepoint, outStrUtf8); - return outStrUtf8; - } + return outStrUtf8; + } #endif - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Convert an UTF-8 string to UTF-32 - /// @param inputBegin Begin iterator to input UTF-8 string - /// @param inputBegin End iterator to input UTF-8 string - /// @return Output UTF-32 string - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - [[nodiscard]] std::u32string convertUtf8toUtf32(CharIt inputBegin, CharIt inputEnd) - { - std::u32string outStrUtf32; - outStrUtf32.reserve(static_cast((inputEnd - inputBegin) + 1)); - - auto it = inputBegin; - while (it < inputEnd) - it = decodeCharUtf8(it, inputEnd, outStrUtf32); - - return outStrUtf32; - } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Convert an UTF-8 string to UTF-32 + /// @param inputBegin Begin iterator to input UTF-8 string + /// @param inputBegin End iterator to input UTF-8 string + /// @return Output UTF-32 string + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + [[nodiscard]] std::u32string convertUtf8toUtf32(CharIt inputBegin, CharIt inputEnd) + { + std::u32string outStrUtf32; + outStrUtf32.reserve(static_cast((inputEnd - inputBegin) + 1)); + + auto it = inputBegin; + while (it < inputEnd) + it = decodeCharUtf8(it, inputEnd, outStrUtf32); + + return outStrUtf32; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Convert an UTF-16 string to UTF-32 + /// @param inputBegin Begin iterator to input UTF-16 string + /// @param inputEnd End iterator to input UTF-16 string + /// @return Output UTF-32 string + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + [[nodiscard]] std::u32string convertUtf16toUtf32(U16CharIt inputBegin, U16CharIt inputEnd) + { + std::u32string outStrUtf32; + outStrUtf32.reserve(static_cast((inputEnd - inputBegin) + 1)); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Convert an UTF-16 string to UTF-32 - /// @param inputBegin Begin iterator to input UTF-16 string - /// @param inputEnd End iterator to input UTF-16 string - /// @return Output UTF-32 string - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - [[nodiscard]] std::u32string convertUtf16toUtf32(U16CharIt inputBegin, U16CharIt inputEnd) + auto it = inputBegin; + while (it < inputEnd) { - std::u32string outStrUtf32; - outStrUtf32.reserve(static_cast((inputEnd - inputBegin) + 1)); + const char16_t first = *it++; - auto it = inputBegin; - while (it < inputEnd) + // Copy the character if it isn't a surrogate pair + if ((first < 0xD800) || (first > 0xDBFF)) { - const char16_t first = *it++; - - // Copy the character if it isn't a surrogate pair - if ((first < 0xD800) || (first > 0xDBFF)) - { - outStrUtf32.push_back(static_cast(first)); - continue; - } - - // We need to read another character - if (it == inputEnd) - break; - - const char16_t second = *it++; - if ((second >= 0xDC00) && (second <= 0xDFFF)) - outStrUtf32.push_back( - ((static_cast(first) - 0xD800) << 10) + (static_cast(second) - 0xDC00) + 0x0010000); + outStrUtf32.push_back(static_cast(first)); + continue; } - return outStrUtf32; - } + // We need to read another character + if (it == inputEnd) + break; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Convert an std::wstring string to UTF-32 - /// @param str Input wstring to copy - /// @return Output UTF-32 string - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - [[nodiscard]] std::u32string convertWidetoUtf32(WCharIt inputBegin, WCharIt inputEnd) - { - std::u32string outStrUtf32; - outStrUtf32.reserve(static_cast((inputEnd - inputBegin) + 1)); + const char16_t second = *it++; + if ((second >= 0xDC00) && (second <= 0xDFFF)) + outStrUtf32.push_back( + ((static_cast(first) - 0xD800) << 10) + (static_cast(second) - 0xDC00) + 0x0010000); + } - // std::wstring uses UCS-2 on Windows and UCS-4 on unix, so we can be cast directly - for (auto it = inputBegin; it != inputEnd; ++it) - outStrUtf32.push_back(static_cast(*it)); + return outStrUtf32; + } - return outStrUtf32; - } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Convert an std::wstring string to UTF-32 + /// @param str Input wstring to copy + /// @return Output UTF-32 string + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + [[nodiscard]] std::u32string convertWidetoUtf32(WCharIt inputBegin, WCharIt inputEnd) + { + std::u32string outStrUtf32; + outStrUtf32.reserve(static_cast((inputEnd - inputBegin) + 1)); + + // std::wstring uses UCS-2 on Windows and UCS-4 on unix, so we can be cast directly + for (auto it = inputBegin; it != inputEnd; ++it) + outStrUtf32.push_back(static_cast(*it)); + + return outStrUtf32; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Convert an UTF-32 string to UTF-8 + /// @param strUtf32 Input UTF-32 string + /// @return Output UTF-8 string + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + [[nodiscard]] inline std::string convertUtf32toStdStringUtf8(const std::u32string& strUtf32) + { + std::string outStrUtf8; + outStrUtf8.reserve(strUtf32.length() + 1); + for (const char32_t codepoint : strUtf32) + encodeCharUtf8(codepoint, outStrUtf8); + + return outStrUtf8; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Convert an UTF-32 string to std::wstring + /// @param strUtf32 Input UTF-32 string + /// @return Output wstring + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + [[nodiscard]] inline std::wstring convertUtf32toWide(const std::u32string& strUtf32) + { + std::wstring outStr; + outStr.reserve(strUtf32.length() + 1); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Convert an UTF-32 string to UTF-8 - /// @param strUtf32 Input UTF-32 string - /// @return Output UTF-8 string - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - [[nodiscard]] inline std::string convertUtf32toStdStringUtf8(const std::u32string& strUtf32) + if constexpr (sizeof(wchar_t) == 4) { - std::string outStrUtf8; - outStrUtf8.reserve(strUtf32.length() + 1); + // On Unix, wide characters are UCS-4 and we can just copy the characters for (const char32_t codepoint : strUtf32) - encodeCharUtf8(codepoint, outStrUtf8); - - return outStrUtf8; + outStr.push_back(static_cast(codepoint)); } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Convert an UTF-32 string to std::wstring - /// @param strUtf32 Input UTF-32 string - /// @return Output wstring - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - [[nodiscard]] inline std::wstring convertUtf32toWide(const std::u32string& strUtf32) + else { - std::wstring outStr; - outStr.reserve(strUtf32.length() + 1); - - if constexpr (sizeof(wchar_t) == 4) + // On Windows, wide characters are UCS-2. We just drop the characters that don't fit within a single wide character here. + for (const char32_t codepoint : strUtf32) { - // On Unix, wide characters are UCS-4 and we can just copy the characters - for (const char32_t codepoint : strUtf32) + if ((codepoint < 0xD800) || ((codepoint > 0xDFFF) && (codepoint <= 0xFFFF))) outStr.push_back(static_cast(codepoint)); } - else - { - // On Windows, wide characters are UCS-2. We just drop the characters that don't fit within a single wide character here. - for (const char32_t codepoint : strUtf32) - { - if ((codepoint < 0xD800) || ((codepoint > 0xDFFF) && (codepoint <= 0xFFFF))) - outStr.push_back(static_cast(codepoint)); - } - } - - return outStr; } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @brief Convert an UTF-32 string to UTF-16 - /// @param strUtf32 Input UTF-32 string - /// @return Output UTF-16 string - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - [[nodiscard]] inline std::u16string convertUtf32toUtf16(const std::u32string& strUtf32) - { - std::u16string outStrUtf16; - outStrUtf16.reserve(strUtf32.length() + 1); + return outStr; + } - for (const char32_t codepoint : strUtf32) + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// @brief Convert an UTF-32 string to UTF-16 + /// @param strUtf32 Input UTF-32 string + /// @return Output UTF-16 string + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + [[nodiscard]] inline std::u16string convertUtf32toUtf16(const std::u32string& strUtf32) + { + std::u16string outStrUtf16; + outStrUtf16.reserve(strUtf32.length() + 1); + + for (const char32_t codepoint : strUtf32) + { + // If the codepoint fits inside 2 bytes and it would represent a valid character then just copy it + if (codepoint <= 0xFFFF) { - // If the codepoint fitst inside 2 bytes and it would represent a valid character then just copy it - if (codepoint <= 0xFFFF) - { - if ((codepoint < 0xD800) || (codepoint > 0xDFFF)) - outStrUtf16.push_back(static_cast(codepoint)); - - continue; - } - if (codepoint > 0x0010FFFF) - continue; // Invalid character (greater than the maximum Unicode value) - - // The input character needs be converted to two UTF-16 elements - outStrUtf16.push_back(static_cast(((codepoint - 0x0010000) >> 10) + 0xD800)); - outStrUtf16.push_back(static_cast(((codepoint - 0x0010000) & 0x3FFUL) + 0xDC00)); + if ((codepoint < 0xD800) || (codepoint > 0xDFFF)) + outStrUtf16.push_back(static_cast(codepoint)); + + continue; } + if (codepoint > 0x0010FFFF) + continue; // Invalid character (greater than the maximum Unicode value) - return outStrUtf16; + // The input character needs be converted to two UTF-16 elements + outStrUtf16.push_back(static_cast(((codepoint - 0x0010000) >> 10) + 0xD800)); + outStrUtf16.push_back(static_cast(((codepoint - 0x0010000) & 0x3FFUL) + 0xDC00)); } - } // namespace utf -} // namespace tgui + + return outStrUtf16; + } +} // namespace tgui::utf #endif // TGUI_UTF_HPP diff --git a/include/TGUI/Widget.hpp b/include/TGUI/Widget.hpp index d01a181a6..0116ff066 100644 --- a/include/TGUI/Widget.hpp +++ b/include/TGUI/Widget.hpp @@ -69,13 +69,10 @@ namespace tgui enum class ShowEffectType; } // namespace tgui -namespace tgui +namespace tgui::priv { - namespace priv - { - class Animation; - } -} // namespace tgui + class Animation; +} // namespace tgui::priv namespace tgui { diff --git a/include/TGUI/Widgets/BitmapButton.hpp b/include/TGUI/Widgets/BitmapButton.hpp index 60193ffd9..ba1f651f6 100644 --- a/include/TGUI/Widgets/BitmapButton.hpp +++ b/include/TGUI/Widgets/BitmapButton.hpp @@ -179,10 +179,6 @@ namespace tgui float m_relativeGlyphHeight = 0; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_BITMAP_BUTTON_HPP diff --git a/include/TGUI/Widgets/Button.hpp b/include/TGUI/Widgets/Button.hpp index 75b1134c1..7a68894ec 100644 --- a/include/TGUI/Widgets/Button.hpp +++ b/include/TGUI/Widgets/Button.hpp @@ -134,10 +134,6 @@ namespace tgui public: SignalString onPress = {"Pressed"}; //!< The button was pressed. Optional parameter: text of the button }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_BUTTON_HPP diff --git a/include/TGUI/Widgets/ChatBox.hpp b/include/TGUI/Widgets/ChatBox.hpp index 3e028e107..13f45182b 100644 --- a/include/TGUI/Widgets/ChatBox.hpp +++ b/include/TGUI/Widgets/ChatBox.hpp @@ -421,13 +421,7 @@ namespace tgui Padding m_paddingCached; Color m_backgroundColorCached; Color m_borderColorCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_TEXT_BOX_HPP diff --git a/include/TGUI/Widgets/CheckBox.hpp b/include/TGUI/Widgets/CheckBox.hpp index 1932369d1..9907d906c 100644 --- a/include/TGUI/Widgets/CheckBox.hpp +++ b/include/TGUI/Widgets/CheckBox.hpp @@ -166,13 +166,7 @@ namespace tgui private: Texture m_textureUncheckedCached; Texture m_textureCheckedCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_CHECK_BOX_HPP diff --git a/include/TGUI/Widgets/ChildWindow.hpp b/include/TGUI/Widgets/ChildWindow.hpp index 9079c3ccc..3270843b8 100644 --- a/include/TGUI/Widgets/ChildWindow.hpp +++ b/include/TGUI/Widgets/ChildWindow.hpp @@ -604,13 +604,7 @@ namespace tgui float m_paddingBetweenButtonsCached = 0; float m_minimumResizableBorderWidthCached = 10; bool m_showTextOnTitleButtonsCached = false; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_CHILD_WINDOW_HPP diff --git a/include/TGUI/Widgets/ClickableWidget.hpp b/include/TGUI/Widgets/ClickableWidget.hpp index fc9d26835..62a4aae49 100644 --- a/include/TGUI/Widgets/ClickableWidget.hpp +++ b/include/TGUI/Widgets/ClickableWidget.hpp @@ -148,13 +148,7 @@ namespace tgui private: bool m_rightMouseDown = false; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_CLICKABLE_WIDGET_HPP diff --git a/include/TGUI/Widgets/ColorPicker.hpp b/include/TGUI/Widgets/ColorPicker.hpp index 1b1cbccfc..4ad64cff2 100644 --- a/include/TGUI/Widgets/ColorPicker.hpp +++ b/include/TGUI/Widgets/ColorPicker.hpp @@ -217,9 +217,6 @@ namespace tgui bool m_colorRead = false; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endif //TGUI_COLOR_PICKER_HPP diff --git a/include/TGUI/Widgets/ComboBox.hpp b/include/TGUI/Widgets/ComboBox.hpp index 253c75384..fecfa082e 100644 --- a/include/TGUI/Widgets/ComboBox.hpp +++ b/include/TGUI/Widgets/ComboBox.hpp @@ -655,13 +655,7 @@ namespace tgui Color m_textColorCached; Color m_textColorDisabledCached; float m_roundedBorderRadiusCached = 0; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_COMBO_BOX_HPP diff --git a/include/TGUI/Widgets/ContextMenu.hpp b/include/TGUI/Widgets/ContextMenu.hpp index 983f49284..4e254feac 100644 --- a/include/TGUI/Widgets/ContextMenu.hpp +++ b/include/TGUI/Widgets/ContextMenu.hpp @@ -442,10 +442,6 @@ namespace tgui bool m_menuOpen = false; float m_itemHeight = 0; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_CONTEXT_MENU_HPP diff --git a/include/TGUI/Widgets/EditBox.hpp b/include/TGUI/Widgets/EditBox.hpp index 9ddb732b8..ade3c6f66 100644 --- a/include/TGUI/Widgets/EditBox.hpp +++ b/include/TGUI/Widgets/EditBox.hpp @@ -643,13 +643,7 @@ namespace tgui private: // Used to prevent emitting onReturnOrUnfocus twice when unfocusing the edit box inside the callback function. bool m_onReturnOrUnfocusEmitted = false; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_EDIT_BOX_HPP diff --git a/include/TGUI/Widgets/EditBoxSlider.hpp b/include/TGUI/Widgets/EditBoxSlider.hpp index 55d365d05..cf8fa190e 100644 --- a/include/TGUI/Widgets/EditBoxSlider.hpp +++ b/include/TGUI/Widgets/EditBoxSlider.hpp @@ -329,6 +329,4 @@ namespace tgui }; } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_EDIT_BOX_SLIDER_HPP diff --git a/include/TGUI/Widgets/FileDialog.hpp b/include/TGUI/Widgets/FileDialog.hpp index 14ed74f64..87f87dcaf 100644 --- a/include/TGUI/Widgets/FileDialog.hpp +++ b/include/TGUI/Widgets/FileDialog.hpp @@ -571,10 +571,6 @@ namespace tgui std::vector m_selectedFiles; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_FILE_DIALOG_HPP diff --git a/include/TGUI/Widgets/Grid.hpp b/include/TGUI/Widgets/Grid.hpp index ca5db9a91..9483cfa04 100644 --- a/include/TGUI/Widgets/Grid.hpp +++ b/include/TGUI/Widgets/Grid.hpp @@ -342,13 +342,7 @@ namespace tgui std::unordered_map> m_widgetCells; std::unordered_map m_connectedSizeCallbacks; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_GRID_HPP diff --git a/include/TGUI/Widgets/Group.hpp b/include/TGUI/Widgets/Group.hpp index d2e78a791..0d55b5e8a 100644 --- a/include/TGUI/Widgets/Group.hpp +++ b/include/TGUI/Widgets/Group.hpp @@ -144,13 +144,7 @@ namespace tgui protected: // Cached renderer properties Padding m_paddingCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_GROUP_HPP diff --git a/include/TGUI/Widgets/GrowHorizontalLayout.hpp b/include/TGUI/Widgets/GrowHorizontalLayout.hpp index f55fc055d..9c8050efc 100644 --- a/include/TGUI/Widgets/GrowHorizontalLayout.hpp +++ b/include/TGUI/Widgets/GrowHorizontalLayout.hpp @@ -132,13 +132,7 @@ namespace tgui protected: std::vector m_widgetLayouts; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_GROW_HORIZONTAL_LAYOUT_HPP diff --git a/include/TGUI/Widgets/GrowVerticalLayout.hpp b/include/TGUI/Widgets/GrowVerticalLayout.hpp index d317167ec..e7a5b1304 100644 --- a/include/TGUI/Widgets/GrowVerticalLayout.hpp +++ b/include/TGUI/Widgets/GrowVerticalLayout.hpp @@ -132,13 +132,7 @@ namespace tgui protected: std::vector m_widgetLayouts; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_GROW_VERTICAL_LAYOUT_HPP diff --git a/include/TGUI/Widgets/HorizontalLayout.hpp b/include/TGUI/Widgets/HorizontalLayout.hpp index 8fb33f706..80cef2056 100644 --- a/include/TGUI/Widgets/HorizontalLayout.hpp +++ b/include/TGUI/Widgets/HorizontalLayout.hpp @@ -86,13 +86,7 @@ namespace tgui // @brief Makes a copy of the widget //////////////////////////////////////////////////////////////////////////////////////////////////////////////// [[nodiscard]] Widget::Ptr clone() const override; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_HORIZONTAL_LAYOUT_HPP diff --git a/include/TGUI/Widgets/HorizontalWrap.hpp b/include/TGUI/Widgets/HorizontalWrap.hpp index 436806ac1..93f42a57b 100644 --- a/include/TGUI/Widgets/HorizontalWrap.hpp +++ b/include/TGUI/Widgets/HorizontalWrap.hpp @@ -80,13 +80,7 @@ namespace tgui // Makes a copy of the widget //////////////////////////////////////////////////////////////////////////////////////////////////////////////// [[nodiscard]] Widget::Ptr clone() const override; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_HORIZONTAL_WRAP_HPP diff --git a/include/TGUI/Widgets/Knob.hpp b/include/TGUI/Widgets/Knob.hpp index dac3d6a71..d950ff834 100644 --- a/include/TGUI/Widgets/Knob.hpp +++ b/include/TGUI/Widgets/Knob.hpp @@ -308,10 +308,6 @@ namespace tgui Color m_thumbColorCached; float m_imageRotationCached = 0; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_KNOB_HPP diff --git a/include/TGUI/Widgets/Label.hpp b/include/TGUI/Widgets/Label.hpp index a7bebfddc..a76c189f7 100644 --- a/include/TGUI/Widgets/Label.hpp +++ b/include/TGUI/Widgets/Label.hpp @@ -399,13 +399,7 @@ namespace tgui Color m_backgroundColorCached; Color m_textOutlineColorCached = Color::Black; float m_textOutlineThicknessCached = 0; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_LABEL_HPP diff --git a/include/TGUI/Widgets/ListBox.hpp b/include/TGUI/Widgets/ListBox.hpp index 5273b8ab8..8b48791a8 100644 --- a/include/TGUI/Widgets/ListBox.hpp +++ b/include/TGUI/Widgets/ListBox.hpp @@ -707,13 +707,7 @@ namespace tgui Color m_selectedTextColorHoverCached; TextStyles m_textStyleCached; TextStyles m_selectedTextStyleCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_LIST_BOX_HPP diff --git a/include/TGUI/Widgets/ListView.hpp b/include/TGUI/Widgets/ListView.hpp index c262ac5d5..a5feb25d2 100644 --- a/include/TGUI/Widgets/ListView.hpp +++ b/include/TGUI/Widgets/ListView.hpp @@ -1166,13 +1166,7 @@ namespace tgui Color m_textColorHoverCached; Color m_selectedTextColorCached; Color m_selectedTextColorHoverCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_LIST_VIEW_HPP diff --git a/include/TGUI/Widgets/MenuBar.hpp b/include/TGUI/Widgets/MenuBar.hpp index 0137a9362..ac1bc2c0a 100644 --- a/include/TGUI/Widgets/MenuBar.hpp +++ b/include/TGUI/Widgets/MenuBar.hpp @@ -511,10 +511,6 @@ namespace tgui int m_visibleMenu = -1; Sprite m_spriteBackground; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_MENU_BAR_HPP diff --git a/include/TGUI/Widgets/MessageBox.hpp b/include/TGUI/Widgets/MessageBox.hpp index abad55780..ffd9dbece 100644 --- a/include/TGUI/Widgets/MessageBox.hpp +++ b/include/TGUI/Widgets/MessageBox.hpp @@ -313,10 +313,6 @@ namespace tgui Label::Ptr m_label = Label::create(); }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_MESSAGE_BOX_HPP diff --git a/include/TGUI/Widgets/Panel.hpp b/include/TGUI/Widgets/Panel.hpp index cd0227a80..0432fdae3 100644 --- a/include/TGUI/Widgets/Panel.hpp +++ b/include/TGUI/Widgets/Panel.hpp @@ -229,13 +229,7 @@ namespace tgui // Will be set to true after the first click, but gets reset to false when the second click does not occur soon after bool m_possibleDoubleClick = false; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_PANEL_HPP diff --git a/include/TGUI/Widgets/PanelListBox.hpp b/include/TGUI/Widgets/PanelListBox.hpp index ed870b43f..6561235f1 100644 --- a/include/TGUI/Widgets/PanelListBox.hpp +++ b/include/TGUI/Widgets/PanelListBox.hpp @@ -477,13 +477,7 @@ namespace tgui Color m_itemsBackgroundColorHoverCached; Color m_selectedItemsBackgroundColorCached; Color m_selectedItemsBackgroundColorHoverCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_PANEL_LIST_BOX_HPP diff --git a/include/TGUI/Widgets/Picture.hpp b/include/TGUI/Widgets/Picture.hpp index ac7119ffd..7484725fd 100644 --- a/include/TGUI/Widgets/Picture.hpp +++ b/include/TGUI/Widgets/Picture.hpp @@ -217,10 +217,6 @@ namespace tgui // Will be set to true after the first click, but gets reset to false when the second click does not occur soon after bool m_possibleDoubleClick = false; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_PICTURE_HPP diff --git a/include/TGUI/Widgets/ProgressBar.hpp b/include/TGUI/Widgets/ProgressBar.hpp index b548df83d..7cd4900ff 100644 --- a/include/TGUI/Widgets/ProgressBar.hpp +++ b/include/TGUI/Widgets/ProgressBar.hpp @@ -296,10 +296,6 @@ namespace tgui Color m_backgroundColorCached; Color m_fillColorCached; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_PROGRESS_BAR_HPP diff --git a/include/TGUI/Widgets/RadioButton.hpp b/include/TGUI/Widgets/RadioButton.hpp index de7d16b49..590f86055 100644 --- a/include/TGUI/Widgets/RadioButton.hpp +++ b/include/TGUI/Widgets/RadioButton.hpp @@ -357,10 +357,6 @@ namespace tgui Color m_backgroundColorCheckedDisabledCached; float m_textDistanceRatioCached = 0.2f; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_RADIO_BUTTON_HPP diff --git a/include/TGUI/Widgets/RadioButtonGroup.hpp b/include/TGUI/Widgets/RadioButtonGroup.hpp index 84195de53..2da723e1a 100644 --- a/include/TGUI/Widgets/RadioButtonGroup.hpp +++ b/include/TGUI/Widgets/RadioButtonGroup.hpp @@ -94,13 +94,7 @@ namespace tgui // Makes a copy of the widget //////////////////////////////////////////////////////////////////////////////////////////////////////////////// [[nodiscard]] Widget::Ptr clone() const override; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_RADIO_BUTTON_GROUP_HPP diff --git a/include/TGUI/Widgets/RangeSlider.hpp b/include/TGUI/Widgets/RangeSlider.hpp index d54c600ec..8e0acdf38 100644 --- a/include/TGUI/Widgets/RangeSlider.hpp +++ b/include/TGUI/Widgets/RangeSlider.hpp @@ -325,10 +325,6 @@ namespace tgui Color m_selectedTrackColorCached; Color m_selectedTrackColorHoverCached; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_RANGE_SLIDER_HPP diff --git a/include/TGUI/Widgets/RichTextLabel.hpp b/include/TGUI/Widgets/RichTextLabel.hpp index 1c233c8a5..b81bd4556 100644 --- a/include/TGUI/Widgets/RichTextLabel.hpp +++ b/include/TGUI/Widgets/RichTextLabel.hpp @@ -151,13 +151,7 @@ namespace tgui std::vector m_images; std::map, String> m_links; // Key = indices for text piece in m_lines std::map m_imageLinks; // Key = index in m_images - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_RICH_TEXT_LABEL_HPP diff --git a/include/TGUI/Widgets/ScrollablePanel.hpp b/include/TGUI/Widgets/ScrollablePanel.hpp index 83a48e444..93311cdbd 100644 --- a/include/TGUI/Widgets/ScrollablePanel.hpp +++ b/include/TGUI/Widgets/ScrollablePanel.hpp @@ -469,13 +469,7 @@ namespace tgui std::unordered_map m_connectedPositionCallbacks; std::unordered_map m_connectedSizeCallbacks; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_SCROLLABLE_PANEL_HPP diff --git a/include/TGUI/Widgets/Scrollbar.hpp b/include/TGUI/Widgets/Scrollbar.hpp index c5475c5d3..3883ed7c0 100644 --- a/include/TGUI/Widgets/Scrollbar.hpp +++ b/include/TGUI/Widgets/Scrollbar.hpp @@ -776,10 +776,6 @@ namespace tgui ScrollbarAccessor m_verticalScrollbarAccessor; ScrollbarAccessor m_horizontalScrollbarAccessor; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_SCROLLBAR_HPP diff --git a/include/TGUI/Widgets/SeparatorLine.hpp b/include/TGUI/Widgets/SeparatorLine.hpp index 762d9b3eb..e1ddeaa9d 100644 --- a/include/TGUI/Widgets/SeparatorLine.hpp +++ b/include/TGUI/Widgets/SeparatorLine.hpp @@ -118,13 +118,7 @@ namespace tgui protected: // Cached renderer properties Color m_colorCached = Color::Black; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_SEPARATOR_LINE_HPP diff --git a/include/TGUI/Widgets/Slider.hpp b/include/TGUI/Widgets/Slider.hpp index aff8ca5da..89771693b 100644 --- a/include/TGUI/Widgets/Slider.hpp +++ b/include/TGUI/Widgets/Slider.hpp @@ -375,10 +375,6 @@ namespace tgui Color m_trackColorHoverCached; bool m_thumbWithinTrackCached = false; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_SLIDER_HPP diff --git a/include/TGUI/Widgets/SpinButton.hpp b/include/TGUI/Widgets/SpinButton.hpp index 952d790c4..36b582519 100644 --- a/include/TGUI/Widgets/SpinButton.hpp +++ b/include/TGUI/Widgets/SpinButton.hpp @@ -331,10 +331,6 @@ namespace tgui Color m_arrowColorHoverCached; float m_borderBetweenArrowsCached = 0; }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_SPIN_BUTTON_HPP diff --git a/include/TGUI/Widgets/SpinControl.hpp b/include/TGUI/Widgets/SpinControl.hpp index 154f7facc..1159e6d25 100644 --- a/include/TGUI/Widgets/SpinControl.hpp +++ b/include/TGUI/Widgets/SpinControl.hpp @@ -341,10 +341,6 @@ namespace tgui SpinButton::Ptr m_spinButton = SpinButton::create(); EditBox::Ptr m_spinText = EditBox::create(); }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_SPIN_CONTROL_HPP diff --git a/include/TGUI/Widgets/SplitContainer.hpp b/include/TGUI/Widgets/SplitContainer.hpp index 19ccceb11..2ee2aeba5 100644 --- a/include/TGUI/Widgets/SplitContainer.hpp +++ b/include/TGUI/Widgets/SplitContainer.hpp @@ -335,13 +335,7 @@ namespace tgui // Cached renderer properties Color m_splitterColorCached; Color m_splitterColorHoverCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_SPLIT_CONTAINER_HPP diff --git a/include/TGUI/Widgets/TabContainer.hpp b/include/TGUI/Widgets/TabContainer.hpp index 0fce48a33..b202c9417 100644 --- a/include/TGUI/Widgets/TabContainer.hpp +++ b/include/TGUI/Widgets/TabContainer.hpp @@ -348,10 +348,6 @@ namespace tgui float m_tabFixedSize = 0.0f; // Stores the tab fixed size for fixed size alignment, default is 0.0f. }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_TAB_CONTAINER_HPP diff --git a/include/TGUI/Widgets/Tabs.hpp b/include/TGUI/Widgets/Tabs.hpp index 1c837aea7..02ff27721 100644 --- a/include/TGUI/Widgets/Tabs.hpp +++ b/include/TGUI/Widgets/Tabs.hpp @@ -208,13 +208,7 @@ namespace tgui float m_maximumTabWidth = 0; float m_minimumTabWidth = 0; bool m_autoSize = true; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_TABS_HPP diff --git a/include/TGUI/Widgets/TextArea.hpp b/include/TGUI/Widgets/TextArea.hpp index ae7335193..1ec9e4628 100644 --- a/include/TGUI/Widgets/TextArea.hpp +++ b/include/TGUI/Widgets/TextArea.hpp @@ -719,13 +719,7 @@ namespace tgui Color m_selectedTextBackgroundColorCached; float m_caretWidthCached = 1; float m_roundedBorderRadiusCached = 0; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_TEXT_AREA_HPP diff --git a/include/TGUI/Widgets/ToggleButton.hpp b/include/TGUI/Widgets/ToggleButton.hpp index 17b78bae7..442df5917 100644 --- a/include/TGUI/Widgets/ToggleButton.hpp +++ b/include/TGUI/Widgets/ToggleButton.hpp @@ -139,10 +139,6 @@ namespace tgui public: SignalBool onToggle = {"Toggled"}; //!< Button state was toggled. Optional parameter: bool containing whether the button is down or not }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_TOGGLE_BUTTON_HPP diff --git a/include/TGUI/Widgets/TreeView.hpp b/include/TGUI/Widgets/TreeView.hpp index 0c09bccdf..981ea3d7c 100644 --- a/include/TGUI/Widgets/TreeView.hpp +++ b/include/TGUI/Widgets/TreeView.hpp @@ -616,13 +616,7 @@ namespace tgui Color m_selectedBackgroundColorHoverCached; Color m_backgroundColorHoverCached; TextStyles m_textStyleCached; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_TREE_VIEW_HPP diff --git a/include/TGUI/Widgets/VerticalLayout.hpp b/include/TGUI/Widgets/VerticalLayout.hpp index 939046f44..02aafbd9e 100644 --- a/include/TGUI/Widgets/VerticalLayout.hpp +++ b/include/TGUI/Widgets/VerticalLayout.hpp @@ -86,13 +86,7 @@ namespace tgui // @brief Makes a copy of the widget //////////////////////////////////////////////////////////////////////////////////////////////////////////////// [[nodiscard]] Widget::Ptr clone() const override; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_VERTICAL_LAYOUT_HPP diff --git a/include/TGUI/Widgets/VerticalTabs.hpp b/include/TGUI/Widgets/VerticalTabs.hpp index 844c379ed..1eb90ae5a 100644 --- a/include/TGUI/Widgets/VerticalTabs.hpp +++ b/include/TGUI/Widgets/VerticalTabs.hpp @@ -153,13 +153,7 @@ namespace tgui protected: float m_tabHeight = 0; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } // namespace tgui -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #endif // TGUI_VERTICAL_TABS_HPP diff --git a/src/Container.cpp b/src/Container.cpp index aeb1f5c13..b6848dc62 100644 --- a/src/Container.cpp +++ b/src/Container.cpp @@ -157,7 +157,7 @@ namespace tgui for (const auto& childNode : node->children) makePathsRelativeToForm(childNode, formPath); } - } // namespace + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Font.cpp b/src/Font.cpp index 972ae0ca3..86e038c31 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -35,7 +35,7 @@ namespace tgui namespace { Font globalFont; - } + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Global.cpp b/src/Global.cpp index be51f1e00..135102758 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -63,7 +63,7 @@ namespace return stream.view(); } }; -} // namespace +} // anonymous namespace #endif namespace tgui @@ -75,7 +75,7 @@ namespace tgui Duration globalDoubleClickTime = std::chrono::milliseconds(500); Duration globalEditBlinkRate = std::chrono::milliseconds(500); Filesystem::Path globalResourcePath; - } // namespace + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Loading/DataIO.cpp b/src/Loading/DataIO.cpp index 807739aa8..f64e5a6ed 100644 --- a/src/Loading/DataIO.cpp +++ b/src/Loading/DataIO.cpp @@ -547,7 +547,7 @@ namespace tgui output.emplace_back("}"); return output; } - } // namespace + } // anonymous namespace std::unique_ptr DataIO::parse(std::stringstream& stream) { diff --git a/src/Loading/Deserializer.cpp b/src/Loading/Deserializer.cpp index deaf006a4..7877010b0 100644 --- a/src/Loading/Deserializer.cpp +++ b/src/Loading/Deserializer.cpp @@ -473,7 +473,7 @@ namespace tgui } //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - } // namespace + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Loading/Serializer.cpp b/src/Loading/Serializer.cpp index 61dc93004..fd8077f6f 100644 --- a/src/Loading/Serializer.cpp +++ b/src/Loading/Serializer.cpp @@ -286,7 +286,7 @@ namespace tgui DataIO::emit(node, ss); return ss.str(); } - } // namespace + } // anonymous namespace std::unordered_map Serializer::m_serializers = {{ObjectConverter::Type::None, serializeEmptyObject}, diff --git a/src/Loading/Theme.cpp b/src/Loading/Theme.cpp index fa6e0fa5f..efd41791e 100644 --- a/src/Loading/Theme.cpp +++ b/src/Loading/Theme.cpp @@ -380,7 +380,7 @@ namespace tgui pair.second->connectedTheme = this; } }; - } // namespace + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Renderers/GroupRenderer.cpp b/src/Renderers/GroupRenderer.cpp index 6def2e183..199d76acf 100644 --- a/src/Renderers/GroupRenderer.cpp +++ b/src/Renderers/GroupRenderer.cpp @@ -30,4 +30,4 @@ namespace tgui { TGUI_RENDERER_PROPERTY_OUTLINE(GroupRenderer, Padding) -} +} // namespace tgui diff --git a/src/Renderers/MenuBarRenderer.cpp b/src/Renderers/MenuBarRenderer.cpp index 08ef801f1..a077e4392 100644 --- a/src/Renderers/MenuBarRenderer.cpp +++ b/src/Renderers/MenuBarRenderer.cpp @@ -30,4 +30,4 @@ namespace tgui { TGUI_RENDERER_PROPERTY_TEXTURE(MenuBarRenderer, TextureBackground) -} +} // namespace tgui diff --git a/src/Renderers/PictureRenderer.cpp b/src/Renderers/PictureRenderer.cpp index 934d08e27..a6cf6329d 100644 --- a/src/Renderers/PictureRenderer.cpp +++ b/src/Renderers/PictureRenderer.cpp @@ -30,4 +30,4 @@ namespace tgui { TGUI_RENDERER_PROPERTY_TEXTURE(PictureRenderer, Texture) -} +} // namespace tgui diff --git a/src/Renderers/SeparatorLineRenderer.cpp b/src/Renderers/SeparatorLineRenderer.cpp index 090417064..83a952645 100644 --- a/src/Renderers/SeparatorLineRenderer.cpp +++ b/src/Renderers/SeparatorLineRenderer.cpp @@ -30,4 +30,4 @@ namespace tgui { TGUI_RENDERER_PROPERTY_COLOR(SeparatorLineRenderer, Color, Color::Black) -} +} // namespace tgui diff --git a/src/Timer.cpp b/src/Timer.cpp index 62bee317c..65d2e2764 100644 --- a/src/Timer.cpp +++ b/src/Timer.cpp @@ -50,7 +50,7 @@ namespace tgui return timer; } - } // namespace + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Widgets/Knob.cpp b/src/Widgets/Knob.cpp index 825a6ddb2..e58f7969c 100644 --- a/src/Widgets/Knob.cpp +++ b/src/Widgets/Knob.cpp @@ -39,7 +39,7 @@ namespace { return std::abs(x - y) < 0.0000001f; } -} // namespace +} // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Widgets/PanelListBox.cpp b/src/Widgets/PanelListBox.cpp index ac087c73a..28e0b3c15 100644 --- a/src/Widgets/PanelListBox.cpp +++ b/src/Widgets/PanelListBox.cpp @@ -33,7 +33,7 @@ namespace tgui const float defaultWidth = 160; const float defaultHeight = 140; const float defaultPanelHeight = 40; - } // namespace + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Widgets/TreeView.cpp b/src/Widgets/TreeView.cpp index 5b3b9fd5e..5a1e236ba 100644 --- a/src/Widgets/TreeView.cpp +++ b/src/Widgets/TreeView.cpp @@ -233,7 +233,7 @@ namespace tgui parentNode->children.push_back(std::move(itemNode)); } } - } // namespace + } // anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/Widgets/TextArea.cpp b/tests/Widgets/TextArea.cpp index b16d404e8..50258b35a 100644 --- a/tests/Widgets/TextArea.cpp +++ b/tests/Widgets/TextArea.cpp @@ -41,7 +41,7 @@ namespace #endif return event; } -} // namespace +} // anonymous namespace TEST_CASE("[TextArea]") {