An abstract position in a searchable object. More...
#include <klfsearchbar.h>
Classes | |
struct | PosData |
A Base class for storing abstract position data. More... | |
Public Member Functions | |
Pos () | |
Pos (const Pos &other) | |
~Pos () | |
Pos & | operator= (const Pos &other) |
bool | valid () const |
bool | equals (const Pos &other) const |
template<class TT > | |
TT * | data () const |
A shorthand for retrieving the posdata cast into the custom type. More... | |
Public Attributes | |
KLFRefPtr< PosData > | posdata |
Stores the actual position data, see PosData. More... | |
An abstract position in a searchable object.
Used by KLFPosSearchable to store search result positions.
A position can be invalid, or valid. The actual data representing the position is stored in a custom sub-class of PosData, to which a pointer is held in posdata
.
You can construct an invalid position with the default constructor. Then just assign a data pointer to it and it becomes valid, e.g.
Definition at line 97 of file klfsearchbar.h.
|
inline |
Constructs an invalid position. This initializes the data pointer to NULL.
Definition at line 146 of file klfsearchbar.h.
|
inline |
Definition at line 150 of file klfsearchbar.h.
|
inline |
Definition at line 154 of file klfsearchbar.h.
|
inline |
A shorthand for retrieving the posdata
cast into the custom type.
Example:
Additionally, a warning is issued if posdata
is NULL
or if posdata
cannot by cast (with dynamic_cast<>
) to the required type.
Definition at line 212 of file klfsearchbar.h.
References KLFRefPtr< T >::dyn_cast(), and KLF_ASSERT_NOT_NULL.
Referenced by equals(), and KLFIteratorSearchable< QModelIndex >::searchCurrentIterPos().
|
inline |
Is equal to other
if:
posdata
's equals() test is true;PosData's
equals() test called if and only if both this and the other position are valid, i.e. have non-NULL posdata
pointer. Definition at line 180 of file klfsearchbar.h.
Definition at line 160 of file klfsearchbar.h.
References KLF_DEBUG_BLOCK, KLF_FUNC_NAME, and posdata.
|
inline |
A position is valid if it has a non-NULL posdata pointer. It is invalid otherwise.
Definition at line 168 of file klfsearchbar.h.
References KLF_DEBUG_BLOCK, KLF_FUNC_NAME, and klfDbg.
Referenced by KLFSearchBar::emitFoundSignals(), equals(), KLFIteratorSearchable< QModelIndex >::searchCurrentIterPos(), and KLFSearchable::searchFind().
Stores the actual position data, see PosData.
This pointer is set up by KLFPosSearchable subclasses to instanciate valid Pos objects. They may use this object transparently, just as a regular PosData*
pointer, see KLFRefPtr.
Definition at line 196 of file klfsearchbar.h.
Referenced by operator<<(), operator=(), KLFIteratorSearchable< QModelIndex >::searchCurrentIterPos(), and KLFSearchable::searchFind().