All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Fields | Related Functions
as_hashmap_iterator Struct Reference

Detailed Description

Iterator for as_hashmap.

To use the iterator, you can either initialize a stack allocated variable, use as_hashmap_iterator_init():

Or you can create a new heap allocated variable using as_hashmap_iterator_new():

To iterate, use as_hashmap_iterator_has_next() and as_hashmap_iterator_next():

const as_val * val = as_hashmap_iterator_next(&it);
}

When you are finished using the iterator, then you should release the iterator and associated resources:

The as_hashmap_iterator is a subtype of as_iterator. This allows you to alternatively use as_iterator functions, by typecasting as_hashmap_iterator to as_iterator.

Each of the as_iterator functions proxy to the as_hashmap_iterator functions. So, calling as_iterator_destroy() is equivalent to calling as_hashmap_iterator_destroy().

Definition at line 90 of file as_hashmap_iterator.h.

#include "as_hashmap_iterator.h"

+ Inheritance diagram for as_hashmap_iterator:
+ Collaboration diagram for as_hashmap_iterator:

Data Fields

as_iterator _
 
void * curr
 
void * htable
 
void * next
 
uint32_t pos
 
uint32_t size
 
- Data Fields inherited from as_iterator
void * data
 
struct as_iterator_hooks_s * hooks
 

Related Functions

(Note that these are not member functions.)

void as_hashmap_iterator_destroy (as_hashmap_iterator *iterator)
 
bool as_hashmap_iterator_has_next (const as_hashmap_iterator *iterator)
 
as_hashmap_iteratoras_hashmap_iterator_init (as_hashmap_iterator *iterator, const as_hashmap *map)
 
as_hashmap_iteratoras_hashmap_iterator_new (const as_hashmap *map)
 
const as_valas_hashmap_iterator_next (as_hashmap_iterator *iterator)
 

Friends And Related Function Documentation

void as_hashmap_iterator_destroy ( as_hashmap_iterator iterator)
related

Destroy the iterator and releases resources used by the iterator.

Parameters
iteratorThe iterator to release
bool as_hashmap_iterator_has_next ( const as_hashmap_iterator iterator)
related

Tests if there are more values available in the iterator.

Parameters
iteratorThe iterator to be tested.
Returns
true if there are more values. Otherwise false.
as_hashmap_iterator * as_hashmap_iterator_init ( as_hashmap_iterator iterator,
const as_hashmap map 
)
related

Initializes a stack allocated as_iterator for the given as_hashmap.

Parameters
iteratorThe iterator to initialize.
mapThe map to iterate.
Returns
On success, the initialized iterator. Otherwise NULL.
as_hashmap_iterator * as_hashmap_iterator_new ( const as_hashmap map)
related

Creates a heap allocated as_iterator for the given as_hashmap.

Parameters
mapThe map to iterate.
Returns
On success, the new iterator. Otherwise NULL.
const as_val * as_hashmap_iterator_next ( as_hashmap_iterator iterator)
related

Attempts to get the next value from the iterator. This will return the next value, and iterate past the value.

Parameters
iteratorThe iterator to get the next value from.
Returns
The next value in the list if available. Otherwise NULL.

Field Documentation

as_iterator as_hashmap_iterator::_

Definition at line 92 of file as_hashmap_iterator.h.

void* as_hashmap_iterator::curr

Current entry

Definition at line 102 of file as_hashmap_iterator.h.

void* as_hashmap_iterator::htable

The hashmap

Definition at line 97 of file as_hashmap_iterator.h.

void* as_hashmap_iterator::next

Next entry

Definition at line 107 of file as_hashmap_iterator.h.

uint32_t as_hashmap_iterator::pos

Position

Definition at line 112 of file as_hashmap_iterator.h.

uint32_t as_hashmap_iterator::size

Number of entries

Definition at line 117 of file as_hashmap_iterator.h.


The documentation for this struct was generated from the following file: