AK: Add a is_null() method to Utf{8,32}View

Both of these can be null as well as empty, and there's a difference.
This commit is contained in:
Ali Mohammad Pur 2021-07-18 05:01:18 +04:30 committed by Ali Mohammad Pur
parent 2961982277
commit 55fa51b4e2
2 changed files with 2 additions and 0 deletions

View file

@ -83,6 +83,7 @@ public:
const u32* code_points() const { return m_code_points; }
bool is_empty() const { return m_length == 0; }
bool is_null() const { return !m_code_points; }
size_t length() const { return m_length; }
size_t iterator_offset(const Utf32CodePointIterator& it) const

View file

@ -74,6 +74,7 @@ public:
Utf8View unicode_substring_view(size_t code_point_offset) const { return unicode_substring_view(code_point_offset, length() - code_point_offset); }
bool is_empty() const { return m_string.is_empty(); }
bool is_null() const { return m_string.is_null(); }
bool starts_with(const Utf8View&) const;
bool contains(u32) const;