Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::String::CodePointIterator Class Reference

#include <object.h>

Inheritance diagram for dart::String::CodePointIterator:
dart::ValueObject

Public Member Functions

 CodePointIterator (const String &str)
 
 CodePointIterator (const String &str, intptr_t start, intptr_t length)
 
int32_t Current () const
 
bool Next ()
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 10160 of file object.h.

Constructor & Destructor Documentation

◆ CodePointIterator() [1/2]

dart::String::CodePointIterator::CodePointIterator ( const String str)
inlineexplicit

Definition at line 10162 of file object.h.

10163 : str_(str), ch_(0), index_(-1), end_(str.Length()) {
10164 ASSERT(!str_.IsNull());
10165 }
bool IsNull() const
Definition object.h:363
#define ASSERT(E)

◆ CodePointIterator() [2/2]

dart::String::CodePointIterator::CodePointIterator ( const String str,
intptr_t  start,
intptr_t  length 
)
inline

Definition at line 10167 of file object.h.

10168 : str_(str), ch_(0), index_(start - 1), end_(start + length) {
10169 ASSERT(start >= 0);
10170 ASSERT(end_ <= str.Length());
10171 }
size_t length

Member Function Documentation

◆ Current()

int32_t dart::String::CodePointIterator::Current ( ) const
inline

Definition at line 10173 of file object.h.

10173 {
10174 ASSERT(index_ >= 0);
10175 ASSERT(index_ < end_);
10176 return ch_;
10177 }

◆ Next()

bool dart::String::CodePointIterator::Next ( )

Definition at line 24397 of file object.cc.

24397 {
24398 ASSERT(index_ >= -1);
24399 intptr_t length = Utf16::Length(ch_);
24400 if (index_ < (end_ - length)) {
24401 index_ += length;
24402 ch_ = str_.CharAt(index_);
24403 if (Utf16::IsLeadSurrogate(ch_) && (index_ < (end_ - 1))) {
24404 int32_t ch2 = str_.CharAt(index_ + 1);
24405 if (Utf16::IsTrailSurrogate(ch2)) {
24406 ch_ = Utf16::Decode(ch_, ch2);
24407 }
24408 }
24409 return true;
24410 }
24411 index_ = end_;
24412 return false;
24413}
uint16_t CharAt(intptr_t index) const
Definition object.h:10238
static int32_t Decode(uint16_t lead, uint16_t trail)
Definition unicode.h:151
static bool IsLeadSurrogate(uint32_t ch)
Definition unicode.h:126
static intptr_t Length(int32_t ch)
Definition unicode.h:118
static bool IsTrailSurrogate(uint32_t ch)
Definition unicode.h:131

The documentation for this class was generated from the following files: