|
|
@@ -108,7 +108,7 @@ namespace StringUtilities {
|
|
|
RMLUICORE_API bool StringCompareCaseInsensitive(StringView lhs, StringView rhs);
|
|
|
|
|
|
// Decode the first code point in a zero-terminated UTF-8 string.
|
|
|
- RMLUICORE_API Character ToCharacter(const char* p);
|
|
|
+ RMLUICORE_API Character ToCharacter(const char* p, const char* p_end);
|
|
|
|
|
|
// Encode a single code point as a UTF-8 string.
|
|
|
RMLUICORE_API String ToUTF8(Character character);
|
|
|
@@ -169,6 +169,7 @@ public:
|
|
|
inline const char* begin() const { return p_begin; }
|
|
|
inline const char* end() const { return p_end; }
|
|
|
|
|
|
+ inline bool empty() const { return p_begin == p_end; }
|
|
|
inline size_t size() const { return size_t(p_end - p_begin); }
|
|
|
|
|
|
explicit inline operator String() const { return String(p_begin, p_end); }
|
|
|
@@ -189,6 +190,7 @@ private:
|
|
|
class RMLUICORE_API StringIteratorU8 {
|
|
|
public:
|
|
|
StringIteratorU8(const char* p_begin, const char* p, const char* p_end);
|
|
|
+ StringIteratorU8(StringView string);
|
|
|
StringIteratorU8(const String& string);
|
|
|
StringIteratorU8(const String& string, size_t offset);
|
|
|
StringIteratorU8(const String& string, size_t offset, size_t count);
|
|
|
@@ -199,7 +201,7 @@ public:
|
|
|
StringIteratorU8& operator--();
|
|
|
|
|
|
// Returns the codepoint at the current position. The iterator must be dereferencable.
|
|
|
- inline Character operator*() const { return StringUtilities::ToCharacter(p); }
|
|
|
+ inline Character operator*() const { return StringUtilities::ToCharacter(p, view.end()); }
|
|
|
|
|
|
// Returns false when the iterator is located just outside the valid part of the string.
|
|
|
explicit inline operator bool() const { return (p != view.begin() - 1) && (p != view.end()); }
|