MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / iterator

Class iterator

src/common/classes/Hash.h:267–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265
266 public:
267 class iterator
268 {
269 private:
270 const HashTable* hash;
271 FB_SIZE_T elem;
272 Entry* current;
273
274 iterator(const iterator& i);
275 iterator& operator= (const iterator& i);
276
277 void next()
278 {
279 while (!current)
280 {
281 if (++elem >= HASHSIZE)
282 {
283 break;
284 }
285 current = hash->data[elem];
286 }
287 }
288
289 public:
290 explicit iterator(const HashTable& h)
291 : hash(&h), elem(0), current(hash->data[elem])
292 {
293 next();
294 }
295
296 iterator& operator++()
297 {
298 if (hasData())
299 {
300 current = current->next();
301 next();
302 }
303 return *this;
304 }
305
306 bool hasData() const
307 {
308 return current ? true : false;
309 }
310
311 operator C*() const
312 {
313 fb_assert(hasData());
314 return current->get();
315 }
316
317 C* operator ->() const
318 {
319 fb_assert(hasData());
320 return current->get();
321 }
322
323 bool operator== (const iterator& h) const
324 {

Callers

nothing calls this directly

Calls 3

nextFunction · 0.50
nextMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected