~tatokis/unity/gcc-72-errors

« back to all changes in this revision

Viewing changes to UnityCore/ModelIterator-inl.h

  • Committer: Pawel Stolowski
  • Date: 2013-05-16 10:58:57 UTC
  • mfrom: (3008.2.136 libunity-7.0-breakage)
  • mto: This revision was merged to the branch mainline in revision 3325.
  • Revision ID: pawel.stolowski@canonical.com-20130516105857-j51uiapol2zc8vr8
Merged smart scopes branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Authored by: Gordon Allott <gord.allott@canonical.com>
18
18
 */
19
19
 
20
 
#include "ResultIterator.h"
21
 
#include <NuxCore/Logger.h>
 
20
 
22
21
namespace unity
23
22
{
24
23
namespace dash
25
24
{
26
 
DECLARE_LOGGER(logger, "unity.dash.resultiterator");
27
25
 
28
 
ResultIterator::ResultIterator(glib::Object<DeeModel> model)
 
26
template<class Adaptor>
 
27
ModelIterator<Adaptor>::ModelIterator(glib::Object<DeeModel> model)
29
28
  : model_(model)
30
29
  , iter_(model ? dee_model_get_first_iter(model) : NULL)
31
30
  , tag_(NULL)
33
32
{
34
33
}
35
34
 
36
 
ResultIterator::ResultIterator(glib::Object<DeeModel> model, DeeModelIter* iter, DeeModelTag* tag)
 
35
template<class Adaptor>
 
36
ModelIterator<Adaptor>::ModelIterator(glib::Object<DeeModel> model, DeeModelIter* iter, DeeModelTag* tag)
37
37
  : model_(model)
38
38
  , iter_(iter)
39
39
  , tag_(tag)
41
41
{
42
42
}
43
43
 
44
 
ResultIterator ResultIterator::operator[](int value)
 
44
template<class Adaptor>
 
45
ModelIterator<Adaptor> ModelIterator<Adaptor>::operator[](int value)
45
46
{
46
 
  return ResultIterator(model_, dee_model_get_iter_at_row(model_, value), tag_);
 
47
  return ModelIterator<Adaptor>(model_, dee_model_get_iter_at_row(model_, value), tag_);
47
48
}
48
49
 
49
 
ResultIterator& ResultIterator::operator=(ResultIterator const& rhs)
 
50
template<class Adaptor>
 
51
ModelIterator<Adaptor>& ModelIterator<Adaptor>::operator=(ModelIterator const& rhs)
50
52
{
51
53
  model_ = rhs.model_;
52
54
  iter_ = rhs.iter_;
56
58
  return *this;
57
59
}
58
60
 
59
 
ResultIterator& ResultIterator::operator++()
 
61
template<class Adaptor>
 
62
ModelIterator<Adaptor>& ModelIterator<Adaptor>::operator++()
60
63
{
61
64
  iter_ = dee_model_next(model_, iter_);
62
65
  return *this;
63
66
}
64
67
 
65
 
ResultIterator& ResultIterator::operator+=(int count)
 
68
template<class Adaptor>
 
69
ModelIterator<Adaptor>& ModelIterator<Adaptor>::operator+=(int count)
66
70
{
67
71
  if (dee_model_is_last(model_, iter_))
68
72
    return *this;
73
77
  return *this;
74
78
}
75
79
 
76
 
ResultIterator ResultIterator::operator++(int)
 
80
template<class Adaptor>
 
81
ModelIterator<Adaptor> ModelIterator<Adaptor>::operator++(int)
77
82
{
78
 
  ResultIterator tmp(*this);
 
83
  ModelIterator tmp(*this);
79
84
  operator++();
80
85
  return tmp;
81
86
}
82
87
 
83
 
ResultIterator ResultIterator::operator+(int count) const
 
88
template<class Adaptor>
 
89
ModelIterator<Adaptor> ModelIterator<Adaptor>::operator+(int count) const
84
90
{
85
 
  ResultIterator tmp(*this);
 
91
  ModelIterator tmp(*this);
86
92
  tmp += count;
87
93
  return tmp;
88
94
}
89
95
 
90
 
ResultIterator& ResultIterator::operator--()
 
96
template<class Adaptor>
 
97
ModelIterator<Adaptor>& ModelIterator<Adaptor>::operator--()
91
98
{
92
99
  iter_ = dee_model_prev(model_, iter_);
93
100
  return *this;
94
101
}
95
102
 
96
 
ResultIterator& ResultIterator::operator-=(int count)
 
103
template<class Adaptor>
 
104
ModelIterator<Adaptor>& ModelIterator<Adaptor>::operator-=(int count)
97
105
{
98
106
  if (dee_model_is_first(model_, iter_))
99
107
    return *this;
104
112
  return *this;
105
113
}
106
114
 
107
 
ResultIterator ResultIterator::operator--(int)
 
115
template<class Adaptor>
 
116
ModelIterator<Adaptor> ModelIterator<Adaptor>::operator--(int)
108
117
{
109
 
  ResultIterator tmp(*this);
 
118
  ModelIterator<Adaptor> tmp(*this);
110
119
  operator--();
111
120
  return tmp;
112
121
}
113
122
 
114
 
ResultIterator ResultIterator::operator-(int count) const
 
123
template<class Adaptor>
 
124
ModelIterator<Adaptor> ModelIterator<Adaptor>::operator-(int count) const
115
125
{
116
 
  ResultIterator tmp(*this);
 
126
  ModelIterator<Adaptor> tmp(*this);
117
127
  tmp -= count;
118
128
  return tmp;
119
129
}
120
130
 
121
 
Result& ResultIterator::operator*()
 
131
template<class Adaptor>
 
132
Adaptor& ModelIterator<Adaptor>::operator*()
122
133
{
123
134
  iter_result_.SetTarget(model_, iter_, tag_);
124
135
  return iter_result_;
125
136
}
126
137
 
127
 
bool ResultIterator::IsLast()
 
138
template<class Adaptor>
 
139
bool ModelIterator<Adaptor>::IsLast()
128
140
{
129
141
  if (!model_) return true;
130
142
  return (dee_model_is_last(model_, iter_));
131
143
}
132
144
 
133
 
bool ResultIterator::IsFirst()
 
145
template<class Adaptor>
 
146
bool ModelIterator<Adaptor>::IsFirst()
134
147
{
135
148
  if (!model_) return true;
136
149
  return (dee_model_is_first(model_, iter_));