TreeFrogFramework 2.10
Loading...
Searching...
No Matches
tsqlqueryormapperiterator.h
Go to the documentation of this file.
1#pragma once
2#include <TSqlQueryORMapper>
3
4
5template <class T>
7public:
9 m(&mapper), it(0) { }
10
11 bool hasNext() const { return (it >= 0 && it < m->size()); }
12 bool hasPrevious() const { return (it > 0 && it <= m->size()); }
13 T next();
14 T previous();
15 void toBack()
16 {
17 m->last();
18 it = m->size();
19 }
20 void toFront()
21 {
22 m->first();
23 it = 0;
24 }
25 T value() const { return m->value(); }
26
27private:
30
32 int it;
33};
34
35
39template <class T>
41{
42 if (it++ != m->at()) {
43 m->next();
44 }
45 return m->value();
46}
47
52template <class T>
54{
55 if (--it != m->at()) {
56 m->previous();
57 }
58 return m->value();
59}
60
The TSqlQueryORMapperIterator class provides a Java-style iterator for TSqlQueryORMapper.
Definition tsqlqueryormapperiterator.h:6
T value() const
Returns the current object and does not move the iterator.
Definition tsqlqueryormapperiterator.h:25
void toBack()
Moves the iterator to the back of the results (after the last object).
Definition tsqlqueryormapperiterator.h:15
T previous()
Returns the previous object and moves the iterator back by one position.
Definition tsqlqueryormapperiterator.h:53
bool hasPrevious() const
Returns true if there is at least one object behind the iterator; otherwise returns false.
Definition tsqlqueryormapperiterator.h:12
TSqlQueryORMapperIterator(TSqlQueryORMapper< T > &mapper)
Constructs a TSqlQueryORMapperIterator object using the mapper mapper.
Definition tsqlqueryormapperiterator.h:8
void toFront()
Moves the iterator to the front of the results (before the first object).
Definition tsqlqueryormapperiterator.h:20
T next()
Returns the next object and advances the iterator by one position.
Definition tsqlqueryormapperiterator.h:40
bool hasNext() const
Returns true if there is at least one object ahead of the iterator; otherwise returns false.
Definition tsqlqueryormapperiterator.h:11
The TSqlQueryORMapper class is a template class that creates ORM objects by executing and manipulatin...
Definition tsqlqueryormapper.h:18
bool next()
Definition tsqlqueryormapper.h:170