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

#include <canonical_tables.h>

Public Member Functions

 StringSlice (const String &str, intptr_t begin_index, intptr_t length)
 
StringPtr ToSymbol () const
 
bool Equals (const String &other) const
 
uword Hash () const
 

Detailed Description

Definition at line 44 of file canonical_tables.h.

Constructor & Destructor Documentation

◆ StringSlice()

dart::StringSlice::StringSlice ( const String str,
intptr_t  begin_index,
intptr_t  length 
)
inline

Definition at line 46 of file canonical_tables.h.

47 : str_(str), begin_index_(begin_index), len_(length) {
48 hash_ = is_all() ? str.Hash() : String::Hash(str, begin_index, length);
49 }
uword Hash() const
Definition object.h:10195
size_t length

Member Function Documentation

◆ Equals()

bool dart::StringSlice::Equals ( const String other) const
inline

Definition at line 51 of file canonical_tables.h.

51 {
52 ASSERT(other.HasHash());
53 if (other.Hash() != hash_) {
54 return false;
55 }
56 return other.Equals(str_, begin_index_, len_);
57 }
#define ASSERT(E)

◆ Hash()

uword dart::StringSlice::Hash ( ) const
inline

Definition at line 58 of file canonical_tables.h.

58{ return hash_; }

◆ ToSymbol()

StringPtr dart::StringSlice::ToSymbol ( ) const

Definition at line 46 of file symbols.cc.

46 {
47 if (is_all() && str_.IsOld()) {
48 str_.SetCanonical();
49 return str_.ptr();
50 } else {
51 String& result =
52 String::Handle(String::SubString(str_, begin_index_, len_, Heap::kOld));
53 result.SetCanonical();
54 result.SetHash(hash_);
55 return result.ptr();
56 }
57}
@ kOld
Definition heap.h:39
ObjectPtr ptr() const
Definition object.h:332
bool IsOld() const
Definition object.h:391
void SetCanonical() const
Definition object.h:336
static Object & Handle()
Definition object.h:407
static StringPtr SubString(const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
Definition object.cc:24159
GAsyncResult * result

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