Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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) {}
size_t position() const
Definition: text_range.h:68

◆ 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) {}
size_t extent() const
Definition: text_range.h:36

◆ 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_; }

◆ collapsed()

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

Definition at line 77 of file text_range.h.

77{ return base_ == extent_; }

◆ 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 }
size_t start() const
Definition: text_range.h:42
size_t end() const
Definition: text_range.h:54

◆ 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 }

◆ end()

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

Definition at line 54 of file text_range.h.

54{ return std::max(base_, extent_); }
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ extent()

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

Definition at line 36 of file text_range.h.

36{ return extent_; }

◆ length()

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

Definition at line 74 of file text_range.h.

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

◆ 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()

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

Definition at line 68 of file text_range.h.

68 {
69 FML_DCHECK(base_ == extent_);
70 return extent_;
71 }
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ reversed()

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

Definition at line 80 of file text_range.h.

80{ return base_ > extent_; }

◆ set_base()

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

Definition at line 33 of file text_range.h.

33{ base_ = pos; }
SkPoint pos

◆ 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 }

◆ set_extent()

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

Definition at line 39 of file text_range.h.

39{ extent_ = pos; }

◆ 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 }

◆ start()

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

Definition at line 42 of file text_range.h.

42{ return std::min(base_, extent_); }
static float min(float r, float g, float b)
Definition: hsl.cpp:48

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