Container of Numbers Cursor. More...
#include <rnumcursor.h>
Public Member Functions | |
RNumCursor (void) | |
RNumCursor (const RNumCursor &cur) | |
template<bool o> | |
RNumCursor (const RNumContainer< I, o > &cont, size_t min=0, size_t max=SIZE_MAX) | |
template<bool o> | |
void | Set (const RNumContainer< I, o > &cont, size_t min=0, size_t max=SIZE_MAX) |
size_t | GetNb (void) const |
void | Start (void) |
void | StartFromEnd (void) |
bool | End (void) const |
bool | Begin (void) const |
void | GoTo (size_t idx) |
void | Next (size_t inc=1) |
void | Prev (size_t inc=1) |
I | operator() (void) const |
I & | operator() (void) |
size_t | GetPos (void) const |
Private Attributes | |
size_t | NbInt |
I * | List |
I * | Parse |
size_t | Pos |
size_t | First |
size_t | Last |
Detailed Description
template<class I>
class R::RNumCursor< I >
Container of Numbers Cursor.
The RNumCursor class provides a cursor over a container of number.
- Template Parameters
-
I Type (int, double, etc.).
Constructor & Destructor Documentation
RNumCursor | ( | void | ) |
Construct a null cursor.
RNumCursor | ( | const RNumCursor< I > & | cur | ) |
Copy constructor.
- Parameters
-
cur Cursor to copy.
RNumCursor | ( | const RNumContainer< I, o > & | cont, |
size_t | min = 0 , |
||
size_t | max = SIZE_MAX |
||
) |
Construct a cursor over a given container.
- Template Parameters
-
o Determine if the container is ordered.
- Parameters
-
cont Container of numbers. min Minimum position of the elements to iterate. max Maximum position of the elements to iterate (included max). If SZE_MAX, iterate until the end of the container.
Member Function Documentation
void Set | ( | const RNumContainer< I, o > & | cont, |
size_t | min = 0 , |
||
size_t | max = SIZE_MAX |
||
) |
Set a cursor to a given container.
- Template Parameters
-
o Determine if the container is ordered.
- Parameters
-
cont Container of numbers. min Minimum position of the elements to iterate. max Maximum position of the elements to iterate (included max). If SZE_MAX, iterate until the end of the container.
size_t GetNb | ( | void | ) | const |
Get the number of values in the list.
- Returns
- size_t
void Start | ( | void | ) |
Start the iterator to go trough the list.
void StartFromEnd | ( | void | ) |
Start the iterator at the end of the container.
bool End | ( | void | ) | const |
Test if the end of the list is reached.
bool Begin | ( | void | ) | const |
Test if the begin of the list is reached.
void GoTo | ( | size_t | idx | ) |
Go to the i-th position of the cursor.
- Parameters
-
idx Index of the element to get.
void Next | ( | size_t | inc = 1 | ) |
Go to a given number of next elements. If the end is reached, go to the beginning.
- Parameters
-
inc Number of elements to go to.
void Prev | ( | size_t | inc = 1 | ) |
Go to a given number of previous elements. If the begin is reached, go to the end.
- Parameters
-
inc Number of elements to go to.
I operator() | ( | void | ) | const |
Return the current element (const version).
I& operator() | ( | void | ) |
Return the current element.
size_t GetPos | ( | void | ) | const |
Return the actual position in the cursor.
Field Documentation
|
private |
Number of values in the list.
|
private |
The array representing the values.
|
private |
Pointer used to parse the list.
|
private |
Current position parsed.
|
private |
The first position in the array handled by the cursor.
|
private |
The last position in the array handled by the cursor.