diff --git a/deps/first/File/include/File/Macros.hpp b/deps/first/File/include/File/Macros.hpp index fb27b48a3..b1164b946 100644 --- a/deps/first/File/include/File/Macros.hpp +++ b/deps/first/File/include/File/Macros.hpp @@ -1,15 +1,6 @@ #pragma once -// Set this to 1 to use ANSI (char*) instead of wide strings (wchar_t*) -#ifndef RC_IS_ANSI -#define RC_IS_ANSI 0 -#endif - -#if RC_IS_ANSI == 1 -#define STR(str) u##str -#else -#define STR(str) L##str -#endif +#include #define THROW_INTERNAL_FILE_ERROR(msg) \ RC::File::Internal::StaticStorage::internal_error = true; \ @@ -24,38 +15,12 @@ construct a Targets object and supply your own devices.") \ } //*/ -#include - namespace RC::File { -#if RC_IS_ANSI == 1 - using StringType = std::string; - using StringViewType = std::string_view; - using CharType = char; - using StreamType = std::ifstream; - using ToString = std::tostring; - - constexpr auto ToString = [](auto&& numeric_value) constexpr -> decltype(auto) { - return std::to_string(std::forward(numeric_value)); - }; -#else - using StringType = std::wstring; - using StringViewType = std::wstring_view; - using CharType = wchar_t; - using StreamType = std::wifstream; - - constexpr auto ToString = [](auto&& numeric_value) constexpr -> decltype(auto) { - return std::to_wstring(std::forward(numeric_value)); - }; -#endif + using StringType = RC::StringType; + using StringViewType = RC::StringViewType; + using CharType = RC::CharType; + using StreamIType = RC::StreamIType; + using StreamOType = RC::StreamOType; + using StreamType = StreamIType; } // namespace RC::File - -namespace RC -{ - using StringType = File::StringType; - using StringViewType = File::StringViewType; - using CharType = File::CharType; - using StreamType = File::StreamType; - - constexpr auto ToString = File::ToString; -} // namespace RC diff --git a/deps/first/File/src/FileType/WinFile.cpp b/deps/first/File/src/FileType/WinFile.cpp index 39e79fff7..fcc4a0793 100644 --- a/deps/first/File/src/FileType/WinFile.cpp +++ b/deps/first/File/src/FileType/WinFile.cpp @@ -455,7 +455,7 @@ namespace RC::File auto WinFile::read_all() const -> StringType { - StreamType stream{get_file_path(), std::ios::in | std::ios::binary}; + StreamIType stream{get_file_path(), std::ios::in | std::ios::binary}; if (!stream) { THROW_INTERNAL_FILE_ERROR(fmt::format("[WinFile::read_all] Tried to read entire file but returned error {}", errno)) @@ -463,7 +463,7 @@ namespace RC::File else { // Strip the BOM if it exists - File::StreamType::off_type start{}; + File::StreamIType::off_type start{}; File::CharType bom[3]{}; stream.read(bom, 3); if (bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF) diff --git a/deps/first/File/xmake.lua b/deps/first/File/xmake.lua index c9f7c45a4..f50ee883c 100644 --- a/deps/first/File/xmake.lua +++ b/deps/first/File/xmake.lua @@ -5,6 +5,8 @@ target(projectName) set_languages("cxx20") set_exceptions("cxx") add_rules("ue4ss.dependency") + + add_deps("String") add_includedirs("include", { public = true }) add_headerfiles("include/**.hpp") diff --git a/deps/first/JSON/src/Number.cpp b/deps/first/JSON/src/Number.cpp index 4628a8948..09c9fc776 100644 --- a/deps/first/JSON/src/Number.cpp +++ b/deps/first/JSON/src/Number.cpp @@ -1,5 +1,8 @@ #include +#include +#include + namespace RC::JSON { Number::Number(uint32_t value) @@ -47,6 +50,8 @@ namespace RC::JSON (void)should_format; (void)indent_level; + #define ToString(numeric_value) fmt::format(STR("{}"), numeric_value) + switch (m_stored_type) { case Type::UInt32: diff --git a/deps/first/String/include/String/StringType.hpp b/deps/first/String/include/String/StringType.hpp new file mode 100644 index 000000000..44f4d6170 --- /dev/null +++ b/deps/first/String/include/String/StringType.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +// We will use this once we solve the circular dependency issue +//#include + +// This is a debug flag to force the use of u16string for testing purposes +// char16_t and wchar_t are two different types, so we need to force the use of one of them +// to ensure we have covered all the cases. +// #define FORCE_U16 + +namespace RC { + +#ifdef FORCE_U16 + using CharType = char16_t; + #define STR(str) u ## str +#else + using CharType = wchar_t; + #define STR(str) L ## str +#endif + + using StringType = std::basic_string; + using StringViewType = std::basic_string_view; + using StreamIType = std::basic_ifstream; + using StreamOType = std::basic_ofstream; +} // namespace RC diff --git a/deps/first/String/xmake.lua b/deps/first/String/xmake.lua new file mode 100644 index 000000000..1314b856b --- /dev/null +++ b/deps/first/String/xmake.lua @@ -0,0 +1,10 @@ +local projectName = "String" + +target(projectName) + set_kind("headeronly") + set_languages("cxx20") + set_exceptions("cxx") + add_rules("ue4ss.dependency") + + add_includedirs("include", { public = true }) + add_headerfiles("include/**.hpp") \ No newline at end of file diff --git a/deps/first/xmake.lua b/deps/first/xmake.lua index 875d9ce34..98d615293 100644 --- a/deps/first/xmake.lua +++ b/deps/first/xmake.lua @@ -17,6 +17,7 @@ includes("Profiler") includes("ScopedTimer") includes("SinglePassSigScanner") includes("Unreal") +includes("String") if is_config("patternsleuth", "local") then -- The patternsleuth target is managed by the cargo.build rule.