aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-11-14 22:44:59 +0800
committercrupest <crupest@outlook.com>2021-11-14 22:44:59 +0800
commit63b4956c3a802ee1c0fd92d1ce56e9330b6de4d2 (patch)
treef13f592d810b797c4c64803719acbd258565ebce /include/cru/common
parenta744ed1fea0eaf4d946909da7fdc0a4c0f9c5ec0 (diff)
downloadcru-63b4956c3a802ee1c0fd92d1ce56e9330b6de4d2.tar.gz
cru-63b4956c3a802ee1c0fd92d1ce56e9330b6de4d2.tar.bz2
cru-63b4956c3a802ee1c0fd92d1ce56e9330b6de4d2.zip
...
Diffstat (limited to 'include/cru/common')
-rw-r--r--include/cru/common/String.hpp5
-rw-r--r--include/cru/common/StringUtil.hpp5
2 files changed, 6 insertions, 4 deletions
diff --git a/include/cru/common/String.hpp b/include/cru/common/String.hpp
index 0a8d88a0..9996f617 100644
--- a/include/cru/common/String.hpp
+++ b/include/cru/common/String.hpp
@@ -273,6 +273,8 @@ class CRU_BASE_API StringView {
return std::u16string_view(data(), size());
}
+ std::string ToUtf8() const;
+
private:
const char16_t* ptr_;
Index size_;
@@ -402,6 +404,9 @@ inline Index Utf16NextWord(StringView str, Index position,
bool* is_space = nullptr) {
return Utf16NextWord(str.data(), str.size(), position, is_space);
}
+
+String CRU_BASE_API ToLower(StringView s);
+String CRU_BASE_API ToUpper(StringView s);
} // namespace cru
template <>
diff --git a/include/cru/common/StringUtil.hpp b/include/cru/common/StringUtil.hpp
index a24cf924..6c6b47b8 100644
--- a/include/cru/common/StringUtil.hpp
+++ b/include/cru/common/StringUtil.hpp
@@ -74,8 +74,7 @@ class CodePointIterator {
public:
bool operator==(const CodePointIterator& other) const {
// You should compare iterator that iterate on the same string.
- Expects(this->string_.data() == other.string_.data() &&
- this->string_.size() == other.string_.size());
+ Expects(this->ptr_ == other.ptr_ && this->size_ == other.size_);
return this->position_ == other.position_;
}
bool operator!=(const CodePointIterator& other) const {
@@ -222,6 +221,4 @@ Index CRU_BASE_API Utf16NextWord(const char16_t* ptr, Index size,
char16_t CRU_BASE_API ToLower(char16_t c);
char16_t CRU_BASE_API ToUpper(char16_t c);
-std::u16string CRU_BASE_API ToLower(std::u16string_view s);
-std::u16string CRU_BASE_API ToUpper(std::u16string_view s);
} // namespace cru