V8 Project
v8::internal::LineEndsWrapper Class Reference
+ Collaboration diagram for v8::internal::LineEndsWrapper:

Public Member Functions

 LineEndsWrapper (Handle< String > string)
 
int length ()
 
int GetLineStart (int index)
 
int GetLineEnd (int index)
 

Private Member Functions

int GetPosAfterNewLine (int index)
 

Private Attributes

Handle< FixedArrayends_array_
 
int string_len_
 

Detailed Description

Definition at line 404 of file liveedit.cc.

Constructor & Destructor Documentation

◆ LineEndsWrapper()

v8::internal::LineEndsWrapper::LineEndsWrapper ( Handle< String string)
inlineexplicit

Definition at line 406 of file liveedit.cc.

407  : ends_array_(String::CalculateLineEnds(string, false)),
408  string_len_(string->length()) {
409  }
Handle< FixedArray > ends_array_
Definition: liveedit.cc:434
static Handle< FixedArray > CalculateLineEnds(Handle< String > string, bool include_ending_line)
Definition: objects.cc:8483

Member Function Documentation

◆ GetLineEnd()

int v8::internal::LineEndsWrapper::GetLineEnd ( int  index)
inline

Definition at line 422 of file liveedit.cc.

422  {
423  if (index == ends_array_->length()) {
424  // End of the last line is always an end of the whole string.
425  // If the string ends with a new line character, the last line is an
426  // empty string after this character.
427  return string_len_;
428  } else {
429  return GetPosAfterNewLine(index);
430  }
431  }
int GetPosAfterNewLine(int index)
Definition: liveedit.cc:437

References ends_array_, GetPosAfterNewLine(), and string_len_.

Referenced by v8::internal::LineArrayCompareInput::Equals(), and GetLineStart().

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

◆ GetLineStart()

int v8::internal::LineEndsWrapper::GetLineStart ( int  index)
inline

Definition at line 415 of file liveedit.cc.

415  {
416  if (index == 0) {
417  return 0;
418  } else {
419  return GetLineEnd(index - 1);
420  }
421  }

References GetLineEnd().

Referenced by v8::internal::TokenizingLineArrayCompareOutput::AddChunk(), and v8::internal::LineArrayCompareInput::Equals().

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

◆ GetPosAfterNewLine()

int v8::internal::LineEndsWrapper::GetPosAfterNewLine ( int  index)
inlineprivate

Definition at line 437 of file liveedit.cc.

437  {
438  return Smi::cast(ends_array_->get(index))->value() + 1;
439  }

References ends_array_.

Referenced by GetLineEnd().

+ Here is the caller graph for this function:

◆ length()

int v8::internal::LineEndsWrapper::length ( )
inline

Definition at line 410 of file liveedit.cc.

410  {
411  return ends_array_->length() + 1;
412  }

References ends_array_.

Member Data Documentation

◆ ends_array_

Handle<FixedArray> v8::internal::LineEndsWrapper::ends_array_
private

Definition at line 434 of file liveedit.cc.

Referenced by GetLineEnd(), GetPosAfterNewLine(), and length().

◆ string_len_

int v8::internal::LineEndsWrapper::string_len_
private

Definition at line 435 of file liveedit.cc.

Referenced by GetLineEnd().


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