aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/String.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/common/String.h')
-rw-r--r--include/cru/common/String.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/include/cru/common/String.h b/include/cru/common/String.h
index 5d9fc549..21a3db51 100644
--- a/include/cru/common/String.h
+++ b/include/cru/common/String.h
@@ -6,7 +6,6 @@
#include "StringToNumberConverter.h"
#include "StringUtil.h"
-#include <double-conversion/double-conversion.h>
#include <filesystem>
#include <initializer_list>
#include <iterator>
@@ -221,16 +220,14 @@ class CRU_BASE_API String {
Index* processed_characters_count, unsigned flags, int base) const;
int ParseToInt(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags,
- int base = 0) const;
+ StringToNumberFlag flags = {}, int base = 0) const;
long long ParseToLongLong(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags,
- int base = 0) const;
+ StringToNumberFlag flags = {}, int base = 0) const;
float ParseToFloat(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags) const;
+ StringToNumberFlag flags = {}) const;
double ParseToDouble(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags) const;
+ StringToNumberFlag flags = {}) const;
std::vector<float> ParseToFloatList(value_type separator = u' ') const;
std::vector<double> ParseToDoubleList(value_type separator = u' ') const;
@@ -261,6 +258,8 @@ class CRU_BASE_API String {
Index capacity_ = 0; // always 1 smaller than real buffer size
};
+std::ostream& CRU_BASE_API operator<<(std::ostream& os, const String& value);
+
class CRU_BASE_API StringView {
public:
using value_type = char16_t;
@@ -357,23 +356,24 @@ class CRU_BASE_API StringView {
template <typename TInteger>
std::enable_if_t<std::is_signed_v<TInteger>, TInteger> ParseToInteger(
- Index* processed_characters_count, unsigned flags, int base) const {
- auto result = StringToIntegerConverterImpl(flags, base)
- .Parse(data(), size(), processed_characters_count);
+ Index* processed_characters_count, StringToNumberFlag flags,
+ int base) const {
+ auto utf8_string = ToUtf8();
+ auto result = StringToIntegerConverter(flags, base)
+ .Parse(utf8_string.data(), utf8_string.size(),
+ processed_characters_count);
return result.negate ? -result.value : result.value;
}
int ParseToInt(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags,
- int base = 0) const;
+ StringToNumberFlag flags = {}, int base = 0) const;
long long ParseToLongLong(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags,
- int base = 0) const;
+ StringToNumberFlag flags = {}, int base = 0) const;
float ParseToFloat(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags) const;
+ StringToNumberFlag flags = {}) const;
double ParseToDouble(Index* processed_characters_count = nullptr,
- unsigned flags = StringToNumberFlags::kNoFlags) const;
+ StringToNumberFlag flags = {}) const;
std::vector<float> ParseToFloatList(value_type separator = u' ') const;
std::vector<double> ParseToDoubleList(value_type separator = u' ') const;