mirror of
https://github.com/marzer/tomlplusplus.git
synced 2024-10-06 06:49:43 +00:00
fix conflict with Windows.h (closes #99)
This commit is contained in:
parent
dca69453f6
commit
c4e00f9a56
@ -39,7 +39,7 @@ paths = [ 'images' ]
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
[defines]
|
[macros]
|
||||||
'TOML_ASYMMETRICAL_EQUALITY_OPS(...)' = 'static_assert(true)'
|
'TOML_ASYMMETRICAL_EQUALITY_OPS(...)' = 'static_assert(true)'
|
||||||
'TOML_ABI_NAMESPACE_START(...)' = 'static_assert(true)'
|
'TOML_ABI_NAMESPACE_START(...)' = 'static_assert(true)'
|
||||||
'TOML_ABI_NAMESPACE_BOOL(...)' = 'static_assert(true)'
|
'TOML_ABI_NAMESPACE_BOOL(...)' = 'static_assert(true)'
|
||||||
|
@ -204,19 +204,32 @@ TOML_NAMESPACE_END;
|
|||||||
// implementations of windows wide string nonsense
|
// implementations of windows wide string nonsense
|
||||||
#if TOML_WINDOWS_COMPAT
|
#if TOML_WINDOWS_COMPAT
|
||||||
|
|
||||||
|
#ifndef _WINDOWS_
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
int __stdcall WideCharToMultiByte(
|
||||||
|
unsigned int CodePage,
|
||||||
|
unsigned long dwFlags,
|
||||||
|
const wchar_t* lpWideCharStr,
|
||||||
|
int cchWideChar,
|
||||||
|
char* lpMultiByteStr,
|
||||||
|
int cbMultiByte,
|
||||||
|
const char* lpDefaultChar,
|
||||||
|
int* lpUsedDefaultChar
|
||||||
|
);
|
||||||
|
int __stdcall MultiByteToWideChar(
|
||||||
|
unsigned int CodePage,
|
||||||
|
unsigned long dwFlags,
|
||||||
|
const char* lpMultiByteStr,
|
||||||
|
int cbMultiByte,
|
||||||
|
wchar_t* lpWideCharStr,
|
||||||
|
int cchWideChar
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif // _WINDOWS_
|
||||||
|
|
||||||
TOML_IMPL_NAMESPACE_START
|
TOML_IMPL_NAMESPACE_START
|
||||||
{
|
{
|
||||||
namespace winapi
|
|
||||||
{
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
int __stdcall WideCharToMultiByte(unsigned int CodePage, unsigned long dwFlags, const wchar_t* lpWideCharStr, int cchWideChar,
|
|
||||||
char* lpMultiByteStr, int cbMultiByte, const char* lpDefaultChar, int* lpUsedDefaultChar);
|
|
||||||
int __stdcall MultiByteToWideChar(unsigned int CodePage, unsigned long dwFlags, const char* lpMultiByteStr, int cbMultiByte,
|
|
||||||
wchar_t* lpWideCharStr, int cchWideChar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TOML_API
|
TOML_API
|
||||||
TOML_EXTERNAL_LINKAGE
|
TOML_EXTERNAL_LINKAGE
|
||||||
std::string narrow(std::wstring_view str) noexcept
|
std::string narrow(std::wstring_view str) noexcept
|
||||||
@ -225,13 +238,13 @@ TOML_IMPL_NAMESPACE_START
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
const auto len = winapi::WideCharToMultiByte(
|
const auto len = WideCharToMultiByte(
|
||||||
65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0, nullptr, nullptr
|
65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0, nullptr, nullptr
|
||||||
);
|
);
|
||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
s.resize(static_cast<size_t>(len));
|
s.resize(static_cast<size_t>(len));
|
||||||
winapi::WideCharToMultiByte(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len, nullptr, nullptr);
|
WideCharToMultiByte(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -244,11 +257,11 @@ TOML_IMPL_NAMESPACE_START
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
std::wstring s;
|
std::wstring s;
|
||||||
const auto len = winapi::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0);
|
const auto len = MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0);
|
||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
s.resize(static_cast<size_t>(len));
|
s.resize(static_cast<size_t>(len));
|
||||||
winapi::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len);
|
MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@
|
|||||||
<None Include="CODE_OF_CONDUCT.md" />
|
<None Include="CODE_OF_CONDUCT.md" />
|
||||||
<None Include="CONTRIBUTING.md" />
|
<None Include="CONTRIBUTING.md" />
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
<None Include="docs\Doxyfile" />
|
|
||||||
<None Include="docs\pages\main_page.dox" />
|
<None Include="docs\pages\main_page.dox" />
|
||||||
<None Include="docs\poxy.toml" />
|
<None Include="docs\poxy.toml" />
|
||||||
<None Include="LICENSE" />
|
<None Include="LICENSE" />
|
||||||
|
@ -96,9 +96,6 @@
|
|||||||
<None Include=".circleci\config.yml">
|
<None Include=".circleci\config.yml">
|
||||||
<Filter>.circleci</Filter>
|
<Filter>.circleci</Filter>
|
||||||
</None>
|
</None>
|
||||||
<None Include="docs\Doxyfile">
|
|
||||||
<Filter>docs</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="tools\ci_single_header_check.py">
|
<None Include="tools\ci_single_header_check.py">
|
||||||
<Filter>tools</Filter>
|
<Filter>tools</Filter>
|
||||||
</None>
|
</None>
|
||||||
|
43
toml.hpp
43
toml.hpp
@ -12021,19 +12021,32 @@ TOML_NAMESPACE_END;
|
|||||||
// implementations of windows wide string nonsense
|
// implementations of windows wide string nonsense
|
||||||
#if TOML_WINDOWS_COMPAT
|
#if TOML_WINDOWS_COMPAT
|
||||||
|
|
||||||
|
#ifndef _WINDOWS_
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
int __stdcall WideCharToMultiByte(
|
||||||
|
unsigned int CodePage,
|
||||||
|
unsigned long dwFlags,
|
||||||
|
const wchar_t* lpWideCharStr,
|
||||||
|
int cchWideChar,
|
||||||
|
char* lpMultiByteStr,
|
||||||
|
int cbMultiByte,
|
||||||
|
const char* lpDefaultChar,
|
||||||
|
int* lpUsedDefaultChar
|
||||||
|
);
|
||||||
|
int __stdcall MultiByteToWideChar(
|
||||||
|
unsigned int CodePage,
|
||||||
|
unsigned long dwFlags,
|
||||||
|
const char* lpMultiByteStr,
|
||||||
|
int cbMultiByte,
|
||||||
|
wchar_t* lpWideCharStr,
|
||||||
|
int cchWideChar
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif // _WINDOWS_
|
||||||
|
|
||||||
TOML_IMPL_NAMESPACE_START
|
TOML_IMPL_NAMESPACE_START
|
||||||
{
|
{
|
||||||
namespace winapi
|
|
||||||
{
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
int __stdcall WideCharToMultiByte(unsigned int CodePage, unsigned long dwFlags, const wchar_t* lpWideCharStr, int cchWideChar,
|
|
||||||
char* lpMultiByteStr, int cbMultiByte, const char* lpDefaultChar, int* lpUsedDefaultChar);
|
|
||||||
int __stdcall MultiByteToWideChar(unsigned int CodePage, unsigned long dwFlags, const char* lpMultiByteStr, int cbMultiByte,
|
|
||||||
wchar_t* lpWideCharStr, int cchWideChar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TOML_API
|
TOML_API
|
||||||
TOML_EXTERNAL_LINKAGE
|
TOML_EXTERNAL_LINKAGE
|
||||||
std::string narrow(std::wstring_view str) noexcept
|
std::string narrow(std::wstring_view str) noexcept
|
||||||
@ -12042,13 +12055,13 @@ TOML_IMPL_NAMESPACE_START
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
const auto len = winapi::WideCharToMultiByte(
|
const auto len = WideCharToMultiByte(
|
||||||
65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0, nullptr, nullptr
|
65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0, nullptr, nullptr
|
||||||
);
|
);
|
||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
s.resize(static_cast<size_t>(len));
|
s.resize(static_cast<size_t>(len));
|
||||||
winapi::WideCharToMultiByte(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len, nullptr, nullptr);
|
WideCharToMultiByte(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -12061,11 +12074,11 @@ TOML_IMPL_NAMESPACE_START
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
std::wstring s;
|
std::wstring s;
|
||||||
const auto len = winapi::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0);
|
const auto len = MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0);
|
||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
s.resize(static_cast<size_t>(len));
|
s.resize(static_cast<size_t>(len));
|
||||||
winapi::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len);
|
MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
misk>=0.4.0
|
misk>=0.4.0
|
||||||
poxy>=0.3.0
|
poxy>=0.3.1
|
||||||
pyyaml
|
pyyaml
|
||||||
python-dateutil
|
python-dateutil
|
||||||
|
Loading…
Reference in New Issue
Block a user