C++: Exclude std::codecvt from Visual Studio < 2019 (#94)

This commit is contained in:
Katy Coe
2020-11-25 16:50:11 +01:00
parent c8497a0d7f
commit 84f2e5e579
2 changed files with 6 additions and 2 deletions

View File

@@ -137,7 +137,7 @@ namespace Il2CppInspector.Properties {
///// Helper function to open a new console window and redirect stdout there ///// Helper function to open a new console window and redirect stdout there
///void il2cppi_new_console(); ///void il2cppi_new_console();
/// ///
///// Helper [rest of string was truncated]&quot;;. ///#if _MSC_V [rest of string was truncated]&quot;;.
/// </summary> /// </summary>
internal static string Cpp_HelpersH { internal static string Cpp_HelpersH {
get { get {

View File

@@ -185,6 +185,7 @@ void il2cppi_new_console() {
freopen_s((FILE**) stdout, "CONOUT$", "w", stdout); freopen_s((FILE**) stdout, "CONOUT$", "w", stdout);
} }
#if _MSC_VER >= 1920
// Helper function to convert Il2CppString to std::string // Helper function to convert Il2CppString to std::string
std::string il2cppi_to_string(Il2CppString* str) { std::string il2cppi_to_string(Il2CppString* str) {
std::u16string u16(reinterpret_cast&lt;const char16_t*&gt;(str-&gt;chars)); std::u16string u16(reinterpret_cast&lt;const char16_t*&gt;(str-&gt;chars));
@@ -195,7 +196,8 @@ std::string il2cppi_to_string(Il2CppString* str) {
std::string il2cppi_to_string(app::String* str) { std::string il2cppi_to_string(app::String* str) {
std::u16string u16(reinterpret_cast&lt;const char16_t*&gt;(&amp;str-&gt;fields.m_firstChar)); std::u16string u16(reinterpret_cast&lt;const char16_t*&gt;(&amp;str-&gt;fields.m_firstChar));
return std::wstring_convert&lt;std::codecvt_utf8_utf16&lt;char16_t&gt;, char16_t&gt;{}.to_bytes(u16); return std::wstring_convert&lt;std::codecvt_utf8_utf16&lt;char16_t&gt;, char16_t&gt;{}.to_bytes(u16);
}</value> }
#endif</value>
</data> </data>
<data name="Cpp-HelpersH" xml:space="preserve"> <data name="Cpp-HelpersH" xml:space="preserve">
<value>// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty <value>// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
@@ -218,11 +220,13 @@ void il2cppi_log_write(std::string text);
// Helper function to open a new console window and redirect stdout there // Helper function to open a new console window and redirect stdout there
void il2cppi_new_console(); void il2cppi_new_console();
#if _MSC_VER >= 1920
// Helper function to convert Il2CppString to std::string // Helper function to convert Il2CppString to std::string
std::string il2cppi_to_string(Il2CppString* str); std::string il2cppi_to_string(Il2CppString* str);
// Helper function to convert System.String to std::string // Helper function to convert System.String to std::string
std::string il2cppi_to_string(app::String* str); std::string il2cppi_to_string(app::String* str);
#endif
// Helper function to check if a metadata usage pointer is initialized // Helper function to check if a metadata usage pointer is initialized
template&lt;typename T&gt; bool il2cppi_is_initialized(T* metadataItem) { template&lt;typename T&gt; bool il2cppi_is_initialized(T* metadataItem) {