Flutter iOS Embedder
flutter::TextRange Class Reference

#include <text_range.h>

Public Member Functions

 TextRange (size_t position)
 
 TextRange (size_t base, size_t extent)
 
 TextRange (const TextRange &)=default
 
TextRangeoperator= (const TextRange &)=default
 
virtual ~TextRange ()=default
 
size_t base () const
 
void set_base (size_t pos)
 
size_t extent () const
 
void set_extent (size_t pos)
 
size_t start () const
 
void set_start (size_t pos)
 
size_t end () const
 
void set_end (size_t pos)
 
size_t position () const
 
size_t length () const
 
bool collapsed () const
 
bool reversed () const
 
bool Contains (size_t position) const
 
bool Contains (const TextRange &range) const
 
bool operator== (const TextRange &other) const
 

Detailed Description

Definition at line 19 of file text_range.h.

Constructor & Destructor Documentation

◆ TextRange() [1/3]

flutter::TextRange::TextRange ( size_t  position)
inlineexplicit

Definition at line 21 of file text_range.h.

21 : base_(position), extent_(position) {}

◆ TextRange() [2/3]

flutter::TextRange::TextRange ( size_t  base,
size_t  extent 
)
inlineexplicit

Definition at line 22 of file text_range.h.

23  : base_(base), extent_(extent) {}

◆ TextRange() [3/3]

flutter::TextRange::TextRange ( const TextRange )
default

◆ ~TextRange()

virtual flutter::TextRange::~TextRange ( )
virtualdefault

Member Function Documentation

◆ base()

size_t flutter::TextRange::base ( ) const
inline

Definition at line 30 of file text_range.h.

30 { return base_; }

Referenced by flutter::TextInputModel::SelectToBeginning(), flutter::TextInputModel::SelectToEnd(), and flutter::TEST().

◆ collapsed()

◆ Contains() [1/2]

bool flutter::TextRange::Contains ( const TextRange range) const
inline

Definition at line 88 of file text_range.h.

88  {
89  return range.start() >= start() && range.end() <= end();
90  }

References end(), and start().

◆ Contains() [2/2]

bool flutter::TextRange::Contains ( size_t  position) const
inline

Definition at line 83 of file text_range.h.

83  {
84  return position >= start() && position <= end();
85  }

References end(), position(), and start().

Referenced by flutter::TEST().

◆ end()

◆ extent()

size_t flutter::TextRange::extent ( ) const
inline

◆ length()

size_t flutter::TextRange::length ( ) const
inline

Definition at line 74 of file text_range.h.

74 { return end() - start(); }

References end(), and start().

Referenced by flutter::TextInputModel::AddText(), flutter::TEST(), and flutter::TextInputModel::UpdateComposingText().

◆ operator=()

TextRange& flutter::TextRange::operator= ( const TextRange )
default

◆ operator==()

bool flutter::TextRange::operator== ( const TextRange other) const
inline

Definition at line 92 of file text_range.h.

92  {
93  return base_ == other.base_ && extent_ == other.extent_;
94  }

◆ position()

◆ reversed()

bool flutter::TextRange::reversed ( ) const
inline

Definition at line 80 of file text_range.h.

80 { return base_ > extent_; }

Referenced by flutter::TEST().

◆ set_base()

void flutter::TextRange::set_base ( size_t  pos)
inline

Definition at line 33 of file text_range.h.

33 { base_ = pos; }

Referenced by flutter::TEST().

◆ set_end()

void flutter::TextRange::set_end ( size_t  pos)
inline

Definition at line 57 of file text_range.h.

57  {
58  if (base_ <= extent_) {
59  extent_ = pos;
60  } else {
61  base_ = pos;
62  }
63  }

Referenced by flutter::TextInputModel::AddText(), flutter::TextInputModel::Backspace(), flutter::TextInputModel::Delete(), flutter::TextInputModel::DeleteSurrounding(), flutter::TEST(), and flutter::TextInputModel::UpdateComposingText().

◆ set_extent()

void flutter::TextRange::set_extent ( size_t  pos)
inline

Definition at line 39 of file text_range.h.

39 { extent_ = pos; }

Referenced by flutter::TEST().

◆ set_start()

void flutter::TextRange::set_start ( size_t  pos)
inline

Definition at line 45 of file text_range.h.

45  {
46  if (base_ <= extent_) {
47  base_ = pos;
48  } else {
49  extent_ = pos;
50  }
51  }

Referenced by flutter::TEST().

◆ start()


The documentation for this class was generated from the following file:
flutter::TextRange::end
size_t end() const
Definition: text_range.h:54
flutter::TextRange::position
size_t position() const
Definition: text_range.h:68
flutter::TextRange::base
size_t base() const
Definition: text_range.h:30
flutter::TextRange::extent
size_t extent() const
Definition: text_range.h:36
flutter::TextRange::start
size_t start() const
Definition: text_range.h:42