Qt 4.8
Public Functions | Properties | List of all members
QIndexMapper Class Reference

#include <qcompleter_p.h>

Public Functions

void append (int x)
 
int cost () const
 
int count () const
 
int first () const
 
int from () const
 
int indexOf (int x) const
 
bool isEmpty () const
 
bool isValid () const
 
int last () const
 
int operator[] (int index) const
 
 QIndexMapper ()
 
 QIndexMapper (int f, int t)
 
 QIndexMapper (QVector< int > vec)
 
int to () const
 

Properties

int f
 
int t
 
bool v
 
QVector< int > vector
 

Detailed Description

Definition at line 106 of file qcompleter_p.h.

Constructors and Destructors

◆ QIndexMapper() [1/3]

QIndexMapper::QIndexMapper ( )
inline

Definition at line 109 of file qcompleter_p.h.

109 : v(false), f(0), t(-1) { }

◆ QIndexMapper() [2/3]

QIndexMapper::QIndexMapper ( int  f,
int  t 
)
inline

Definition at line 110 of file qcompleter_p.h.

110 : v(false), f(f), t(t) { }

◆ QIndexMapper() [3/3]

QIndexMapper::QIndexMapper ( QVector< int >  vec)
inline

Definition at line 111 of file qcompleter_p.h.

111 : v(true), vector(vec), f(-1), t(-1) { }
QVector< int > vector
Definition: qcompleter_p.h:127

Functions

◆ append()

void QIndexMapper::append ( int  x)
inline

Definition at line 118 of file qcompleter_p.h.

Referenced by QUnsortedModelEngine::buildIndices(), and QCompletionEngine::filterHistory().

118 { Q_ASSERT(v); vector.append(x); }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
QVector< int > vector
Definition: qcompleter_p.h:127

◆ cost()

int QIndexMapper::cost ( ) const
inline

Definition at line 123 of file qcompleter_p.h.

Referenced by QCompletionEngine::saveInCache().

123 { return vector.count()+2; }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
QVector< int > vector
Definition: qcompleter_p.h:127

◆ count()

int QIndexMapper::count ( ) const
inline

Definition at line 113 of file qcompleter_p.h.

Referenced by QUnsortedModelEngine::buildIndices(), QUnsortedModelEngine::filter(), QCompletionModel::index(), and QCompletionModel::mapFromSource().

113 { return v ? vector.count() : t - f + 1; }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
QVector< int > vector
Definition: qcompleter_p.h:127

◆ first()

int QIndexMapper::first ( ) const
inline

Definition at line 119 of file qcompleter_p.h.

Referenced by QSortedModelEngine::indexHint().

119 { return v ? vector.first() : f; }
T & first()
Returns a reference to the first item in the vector.
Definition: qvector.h:260
QVector< int > vector
Definition: qcompleter_p.h:127

◆ from()

int QIndexMapper::from ( ) const
inline

Definition at line 121 of file qcompleter_p.h.

Referenced by QSortedModelEngine::filter().

121 { Q_ASSERT(!v); return f; }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ indexOf()

int QIndexMapper::indexOf ( int  x) const
inline

Definition at line 115 of file qcompleter_p.h.

Referenced by QCompletionModel::mapFromSource().

115 { return v ? vector.indexOf(x) : ((t < f) ? -1 : x - f); }
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the vector, searching forward from ind...
Definition: qvector.h:698
QVector< int > vector
Definition: qcompleter_p.h:127

◆ isEmpty()

bool QIndexMapper::isEmpty ( ) const
inline

Definition at line 117 of file qcompleter_p.h.

117 { return v ? vector.isEmpty() : (t < f); }
QVector< int > vector
Definition: qcompleter_p.h:127
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139

◆ isValid()

bool QIndexMapper::isValid ( ) const
inline

Definition at line 116 of file qcompleter_p.h.

Referenced by QMatchData::isValid().

116 { return !isEmpty(); }
bool isEmpty() const
Definition: qcompleter_p.h:117

◆ last()

int QIndexMapper::last ( ) const
inline

Definition at line 120 of file qcompleter_p.h.

Referenced by QUnsortedModelEngine::filter(), QSortedModelEngine::indexHint(), and QCompletionModel::mapFromSource().

120 { return v ? vector.last() : t; }
QVector< int > vector
Definition: qcompleter_p.h:127
T & last()
Returns a reference to the last item in the vector.
Definition: qvector.h:262

◆ operator[]()

int QIndexMapper::operator[] ( int  index) const
inline

Definition at line 114 of file qcompleter_p.h.

114 { return v ? vector[index] : f + index; }
QVector< int > vector
Definition: qcompleter_p.h:127
quint16 index

◆ to()

int QIndexMapper::to ( ) const
inline

Definition at line 122 of file qcompleter_p.h.

Referenced by QSortedModelEngine::filter().

122 { Q_ASSERT(!v); return t; }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

Properties

◆ f

int QIndexMapper::f
private

Definition at line 128 of file qcompleter_p.h.

◆ t

int QIndexMapper::t
private

Definition at line 128 of file qcompleter_p.h.

◆ v

bool QIndexMapper::v
private

Definition at line 126 of file qcompleter_p.h.

◆ vector

QVector<int> QIndexMapper::vector
private

Definition at line 127 of file qcompleter_p.h.


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