summaryrefslogtreecommitdiffhomepage
path: root/vendor/toml++/impl/std_string.inl
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-08-11 23:31:39 +0200
committerAmlal <amlal@nekernel.org>2025-08-11 23:31:39 +0200
commitd987d62459d59a6d95ffb815d5e6eccd8dbde1dd (patch)
treed91d1351193a9f758daa9dad964e40f5a84ece7f /vendor/toml++/impl/std_string.inl
parent4c462511485168cfc831a1447267fd76145d5183 (diff)
meta: ran format command.v0.0.3-release
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'vendor/toml++/impl/std_string.inl')
-rw-r--r--vendor/toml++/impl/std_string.inl116
1 files changed, 47 insertions, 69 deletions
diff --git a/vendor/toml++/impl/std_string.inl b/vendor/toml++/impl/std_string.inl
index a20d662..9cbf989 100644
--- a/vendor/toml++/impl/std_string.inl
+++ b/vendor/toml++/impl/std_string.inl
@@ -1,15 +1,15 @@
-//# This file is a part of toml++ and is subject to the the terms of the MIT license.
-//# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
-//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
-// SPDX-License-Identifier: MIT
+// # This file is a part of toml++ and is subject to the the terms of the MIT license.
+// # Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
+// # See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
+// SPDX-License-Identifier: MIT
#pragma once
-//# {{
+// # {{
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
-//# }}
+// # }}
#if TOML_WINDOWS
#include "std_string.hpp"
@@ -18,82 +18,60 @@
#include <Windows.h>
#else
-extern "C" __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int CodePage,
- unsigned long dwFlags,
- const wchar_t* lpWideCharStr,
- int cchWideChar,
- char* lpMultiByteStr,
- int cbMultiByte,
- const char* lpDefaultChar,
- int* lpUsedDefaultChar);
+extern "C" __declspec(dllimport) int __stdcall WideCharToMultiByte(
+ unsigned int CodePage, unsigned long dwFlags, const wchar_t* lpWideCharStr, int cchWideChar,
+ char* lpMultiByteStr, int cbMultiByte, const char* lpDefaultChar, int* lpUsedDefaultChar);
-extern "C" __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int CodePage,
- unsigned long dwFlags,
- const char* lpMultiByteStr,
- int cbMultiByte,
- wchar_t* lpWideCharStr,
- int cchWideChar);
+extern "C" __declspec(dllimport) int __stdcall MultiByteToWideChar(
+ unsigned int CodePage, unsigned long dwFlags, const char* lpMultiByteStr, int cbMultiByte,
+ wchar_t* lpWideCharStr, int cchWideChar);
-#endif // TOML_INCLUDE_WINDOWS_H
-#endif // _WINDOWS_
+#endif // TOML_INCLUDE_WINDOWS_H
+#endif // _WINDOWS_
#include "header_start.hpp"
-TOML_IMPL_NAMESPACE_START
-{
- TOML_EXTERNAL_LINKAGE
- std::string narrow(std::wstring_view str)
- {
- if (str.empty())
- return {};
+TOML_IMPL_NAMESPACE_START {
+ TOML_EXTERNAL_LINKAGE
+ std::string narrow(std::wstring_view str) {
+ if (str.empty()) return {};
- std::string s;
- const auto len =
- ::WideCharToMultiByte(65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0, nullptr, nullptr);
- if (len)
- {
- s.resize(static_cast<size_t>(len));
- ::WideCharToMultiByte(65001,
- 0,
- str.data(),
- static_cast<int>(str.length()),
- s.data(),
- len,
- nullptr,
- nullptr);
- }
- return s;
- }
+ std::string s;
+ const auto len = ::WideCharToMultiByte(65001, 0, str.data(), static_cast<int>(str.length()),
+ nullptr, 0, nullptr, nullptr);
+ if (len) {
+ s.resize(static_cast<size_t>(len));
+ ::WideCharToMultiByte(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len,
+ nullptr, nullptr);
+ }
+ return s;
+ }
- TOML_EXTERNAL_LINKAGE
- std::wstring widen(std::string_view str)
- {
- if (str.empty())
- return {};
+ TOML_EXTERNAL_LINKAGE
+ std::wstring widen(std::string_view str) {
+ if (str.empty()) return {};
- std::wstring s;
- const auto len = ::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0);
- if (len)
- {
- s.resize(static_cast<size_t>(len));
- ::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len);
- }
- return s;
- }
+ std::wstring s;
+ const auto len =
+ ::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), nullptr, 0);
+ if (len) {
+ s.resize(static_cast<size_t>(len));
+ ::MultiByteToWideChar(65001, 0, str.data(), static_cast<int>(str.length()), s.data(), len);
+ }
+ return s;
+ }
#if TOML_HAS_CHAR8
- TOML_EXTERNAL_LINKAGE
- std::wstring widen(std::u8string_view str)
- {
- if (str.empty())
- return {};
+ TOML_EXTERNAL_LINKAGE
+ std::wstring widen(std::u8string_view str) {
+ if (str.empty()) return {};
- return widen(std::string_view{ reinterpret_cast<const char*>(str.data()), str.length() });
- }
+ return widen(std::string_view{reinterpret_cast<const char*>(str.data()), str.length()});
+ }
-#endif // TOML_HAS_CHAR8
+#endif // TOML_HAS_CHAR8
}
TOML_IMPL_NAMESPACE_END;
#include "header_end.hpp"
-#endif // TOML_WINDOWS
+#endif // TOML_WINDOWS