diff --git a/src/SFML/System/CMakeLists.txt b/src/SFML/System/CMakeLists.txt index 87475629..0283d50f 100644 --- a/src/SFML/System/CMakeLists.txt +++ b/src/SFML/System/CMakeLists.txt @@ -22,6 +22,8 @@ set(SRC ${INCROOT}/Time.inl ${INCROOT}/Utf.hpp ${INCROOT}/Utf.inl + ${SRCROOT}/Utils.hpp + ${SRCROOT}/Utils.cpp ${SRCROOT}/Vector2.cpp ${INCROOT}/Vector2.hpp ${INCROOT}/Vector2.inl diff --git a/src/SFML/System/Utils.cpp b/src/SFML/System/Utils.cpp new file mode 100644 index 00000000..90ab528d --- /dev/null +++ b/src/SFML/System/Utils.cpp @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +#include + +#include + + +namespace sf +{ +std::string toLower(std::string str) +{ + for (char& c : str) + c = static_cast(std::tolower(static_cast(c))); + return str; +} + +std::string formatDebugPathInfo(const std::filesystem::path& path) +{ + std::ostringstream oss; + oss << " Provided path: " << path << '\n' // + << " Absolute path: " << std::filesystem::absolute(path); + return oss.str(); +} + +} // namespace sf diff --git a/src/SFML/System/Utils.hpp b/src/SFML/System/Utils.hpp index 2f855513..8fd78241 100644 --- a/src/SFML/System/Utils.hpp +++ b/src/SFML/System/Utils.hpp @@ -27,29 +27,16 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include -#include -#include +#include -#include +#include +#include namespace sf { -[[nodiscard]] inline std::string toLower(std::string str) -{ - for (char& c : str) - c = static_cast(std::tolower(static_cast(c))); - return str; -} - -[[nodiscard]] inline std::string formatDebugPathInfo(const std::filesystem::path& path) -{ - std::ostringstream stream; - stream << " Provided path: " << path << '\n'; - stream << " Absolute path: " << std::filesystem::absolute(path); - return stream.str(); -} +[[nodiscard]] SFML_SYSTEM_API std::string toLower(std::string str); +[[nodiscard]] SFML_SYSTEM_API std::string formatDebugPathInfo(const std::filesystem::path& path); // Convert byte sequence into integer // toInteger(0x12, 0x34, 0x56) == 0x563412