42 template<
typename StrType>
48 constexpr operator bool() const noexcept
55 requires (std::is_integral_v<T> || std::is_floating_point_v<T>)
59 std::from_chars_result fc_res;
60 if constexpr (std::is_integral_v<T>)
62 fc_res = std::from_chars(
70#if ISP_COMPILER_CLANG < 20 || ISP_WEBAPP || ISP_ANDROID
73 fc_res.ec = std::errc{};
74 char* ptr_end =
nullptr;
75 out_value = strtof(str.
begin(), &ptr_end);
79 fc_res = std::from_chars(
83 std::chars_format::general
88 if (fc_res.ec == std::errc::result_out_of_range)
92 else if (fc_res.ec == std::errc::invalid_argument)
104 requires (std::is_integral_v<T> || std::is_floating_point_v<T>)
108 std::from_chars_result fc_res;
109 if constexpr (std::is_integral_v<T>)
111 fc_res = std::from_chars(str_beg, str_end, out_value);
115#if ISP_COMPILER_CLANG < 20 || ISP_WEBAPP || ISP_ANDROID
118 fc_res.ec = std::errc{};
119 char* ptr_end =
nullptr;
120 out_value = strtof(str_beg, &ptr_end);
122 fc_res.ptr = ptr_end;
124 fc_res = std::from_chars(str_beg, str_end, out_value, std::chars_format::general);
128 if (fc_res.ec == std::errc::result_out_of_range)
132 else if (fc_res.ec == std::errc::invalid_argument)
139 .remaining = fc_res.ptr
144 requires (std::is_integral_v<T> || std::is_floating_point_v<T>)
158 out_value = bool(temp_out);
173 template<
typename Fn>
177 while(contents.not_empty())
180 ice::nindex const separator_pos = contents.find_first_of(separator);
181 ice::String const line = contents.substr(0, separator_pos);
182 if (ice::forward<Fn>(fn)(line) ==
false)
186 contents = contents.substr(separator_pos + 1);
#define ICE_ASSERT_CORE(expression)
Definition assert_core.hxx:43
Definition path_utils.hxx:10
Definition editable_operations.hxx:9
constexpr auto for_each_split(ice::String contents, ice::String separators, Fn &&fn) noexcept -> ice::u32
Definition string_utils.hxx:174
SPDX-License-Identifier: MIT.
Definition array.hxx:12
ice::BasicString< char > String
Definition string.hxx:82
auto wide_to_utf8_size(ice::WString path) noexcept -> ice::u32
static constexpr ice::ErrorCode E_InvalidArgument
Definition error_codes.hxx:16
std::int8_t i8
Definition types.hxx:19
auto alloc(ice::usize size) noexcept -> ice::AllocResult
std::uint64_t u64
Definition types.hxx:27
ice::BasicString< wchar_t > WString
Definition string.hxx:83
auto ptr_distance(void const *ptr_from, void const *ptr_to) noexcept -> ice::usize
Definition mem_arithmetic.hxx:54
auto utf8_to_wide_size(ice::String path) noexcept -> ice::u32
constexpr auto count(T const (&)[Size]) noexcept -> ice::u32
Definition base.hxx:43
auto utf8_to_wide(ice::Allocator &alloc, ice::String path) noexcept -> ice::HeapString< ice::wchar >
CaseSensitive
Definition string_utils.hxx:29
@ Yes
Definition string_utils.hxx:29
@ No
Definition string_utils.hxx:29
std::uint32_t u32
Definition types.hxx:26
static constexpr ice::ErrorCode E_OutOfRange
Definition error_codes.hxx:17
bool utf8_to_wide_append(ice::String path, ice::HeapString< ice::wchar > &out_str) noexcept
CompareResult
Definition string_utils.hxx:30
@ Smaller
Definition string_utils.hxx:30
@ Larger
Definition string_utils.hxx:30
@ Equal
Definition string_utils.hxx:30
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition mem_types.hxx:25
bool wide_to_utf8_append(ice::WString path, ice::HeapString<> &out_str) noexcept
static constexpr ice::ErrorCodeSuccess S_Ok
Definition error_codes.hxx:10
auto from_chars(ice::String str, T &out_value) noexcept -> ice::FromCharsResult< ice::String >
Definition string_utils.hxx:56
auto wide_to_utf8(ice::Allocator &alloc, ice::WString path) noexcept -> ice::HeapString<>
auto compare(ice::String left, ice::String right, ice::CaseSensitive=CaseSensitive::No) noexcept -> ice::CompareResult
constexpr auto size() const noexcept -> SizeType
Definition string.hxx:57
Definition string_utils.hxx:44
StrType remaining
Definition string_utils.hxx:46
ice::ErrorCode ec
Definition string_utils.hxx:45
Definition heap_string.hxx:15
constexpr auto end(this Self const &self) noexcept -> typename Self::ConstIterator
Definition readonly_operations.hxx:279
constexpr auto begin(this Self const &self) noexcept -> typename Self::ConstIterator
Definition readonly_operations.hxx:273