V8 Project
unibrow::Utf16 Class Reference

#include <unicode.h>

+ Collaboration diagram for unibrow::Utf16:

Static Public Member Functions

static bool IsSurrogatePair (int lead, int trail)
 
static bool IsLeadSurrogate (int code)
 
static bool IsTrailSurrogate (int code)
 
static int CombineSurrogatePair (uchar lead, uchar trail)
 
static uint16_t LeadSurrogate (uint32_t char_code)
 
static uint16_t TrailSurrogate (uint32_t char_code)
 

Static Public Attributes

static const int kNoPreviousCharacter = -1
 
static const uchar kMaxNonSurrogateCharCode = 0xffff
 
static const int kMaxExtraUtf8BytesForOneUtf16CodeUnit = 3
 
static const int kUtf8BytesToCodeASurrogate = 3
 

Detailed Description

Definition at line 80 of file unicode.h.

Member Function Documentation

◆ CombineSurrogatePair()

static int unibrow::Utf16::CombineSurrogatePair ( uchar  lead,
uchar  trail 
)
inlinestatic

Definition at line 94 of file unicode.h.

94  {
95  return 0x10000 + ((lead & 0x3ff) << 10) + (trail & 0x3ff);
96  }

Referenced by unibrow::Utf8::Encode().

+ Here is the caller graph for this function:

◆ IsLeadSurrogate()

static bool unibrow::Utf16::IsLeadSurrogate ( int  code)
inlinestatic

Definition at line 85 of file unicode.h.

85  {
86  if (code == kNoPreviousCharacter) return false;
87  return (code & 0xfc00) == 0xd800;
88  }
static const int kNoPreviousCharacter
Definition: unicode.h:97

References kNoPreviousCharacter.

Referenced by unibrow::Utf8::Encode(), IsSurrogatePair(), unibrow::Utf8::Length(), and v8::Utf8LengthHelper::Visitor::VisitTwoByteString().

+ Here is the caller graph for this function:

◆ IsSurrogatePair()

static bool unibrow::Utf16::IsSurrogatePair ( int  lead,
int  trail 
)
inlinestatic

Definition at line 82 of file unicode.h.

82  {
83  return IsLeadSurrogate(lead) && IsTrailSurrogate(trail);
84  }
static bool IsTrailSurrogate(int code)
Definition: unicode.h:89
static bool IsLeadSurrogate(int code)
Definition: unicode.h:85

References IsLeadSurrogate(), and IsTrailSurrogate().

Referenced by unibrow::Utf8::Encode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsTrailSurrogate()

static bool unibrow::Utf16::IsTrailSurrogate ( int  code)
inlinestatic

Definition at line 89 of file unicode.h.

89  {
90  if (code == kNoPreviousCharacter) return false;
91  return (code & 0xfc00) == 0xdc00;
92  }

References kNoPreviousCharacter.

Referenced by unibrow::Utf8::Encode(), IsSurrogatePair(), unibrow::Utf8::Length(), and v8::Utf8LengthHelper::Visitor::VisitTwoByteString().

+ Here is the caller graph for this function:

◆ LeadSurrogate()

static uint16_t unibrow::Utf16::LeadSurrogate ( uint32_t  char_code)
inlinestatic

Definition at line 108 of file unicode.h.

108  {
109  return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff);
110  }

Referenced by v8::internal::StringHasher::ComputeUtf8Hash(), v8::internal::Utf8ToUtf16CharacterStream::CopyChars(), v8::internal::String::IsUtf8EqualTo(), unibrow::Utf8DecoderBase::Reset(), v8::internal::WriteTwoByteData(), and unibrow::Utf8DecoderBase::WriteUtf16Slow().

+ Here is the caller graph for this function:

◆ TrailSurrogate()

static uint16_t unibrow::Utf16::TrailSurrogate ( uint32_t  char_code)
inlinestatic

Definition at line 111 of file unicode.h.

111  {
112  return 0xdc00 + (char_code & 0x3ff);
113  }

Referenced by v8::internal::StringHasher::ComputeUtf8Hash(), v8::internal::Utf8ToUtf16CharacterStream::CopyChars(), v8::internal::String::IsUtf8EqualTo(), unibrow::Utf8DecoderBase::Reset(), v8::internal::WriteTwoByteData(), and unibrow::Utf8DecoderBase::WriteUtf16Slow().

+ Here is the caller graph for this function:

Member Data Documentation

◆ kMaxExtraUtf8BytesForOneUtf16CodeUnit

const int unibrow::Utf16::kMaxExtraUtf8BytesForOneUtf16CodeUnit = 3
static

Definition at line 104 of file unicode.h.

◆ kMaxNonSurrogateCharCode

◆ kNoPreviousCharacter

◆ kUtf8BytesToCodeASurrogate

const int unibrow::Utf16::kUtf8BytesToCodeASurrogate = 3
static

Definition at line 107 of file unicode.h.


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