kviewshell
GPosition Class Reference
Generic iterator class. More...
#include <GContainer.h>
Public Member Functions | |
const Node * | check (void *c) const |
Node * | check (void *c) |
GPosition (Node *p, void *c) | |
GPosition (const GPosition &ref) | |
GPosition () | |
operator int () const | |
int | operator! () const |
GPosition & | operator++ () |
GPosition & | operator-- () |
Protected Member Functions | |
void | throw_invalid (void *c) const no_return |
Protected Attributes | |
void * | cont |
Node * | ptr |
Detailed Description
Generic iterator class.This class represents a position in a list (see {GList}) or a map (see {GMap}). As demonstrated by the following examples, this class should be used to iterate over the objects contained in a list or a map: {verbatim} void print_list(GList<GString> a) { for (GPosition i = a ; i; ++i) DjVuPrintMessage("%s\n", (const char*) a[i] ); }
void print_list_backwards(GList<GString> a) { for (GPosition i = a.lastpos() ; i; --i) DjVuPrintMessage("%s\n", (const char*) a[i] ); } {verbatim} GPosition objects should only be used with the list or map for which they have been created (using the member functions firstpos# or lastpos# of the container). Furthermore, you should never use a GPosition object which designates a list element which has been removed from the list (using member function del# or by other means.)
Definition at line 691 of file GContainer.h.
Constructor & Destructor Documentation
GPosition::GPosition | ( | ) | [inline] |
GPosition::GPosition | ( | const GPosition & | ref | ) | [inline] |
GPosition::GPosition | ( | Node * | p, | |
void * | c | |||
) | [inline] |
Definition at line 711 of file GContainer.h.
Member Function Documentation
const Node* GPosition::check | ( | void * | c | ) | const [inline] |
Definition at line 715 of file GContainer.h.
Node* GPosition::check | ( | void * | c | ) | [inline] |
Definition at line 713 of file GContainer.h.
GPosition::operator int | ( | void | ) | const [inline] |
int GPosition::operator! | ( | ) | const [inline] |
GPosition& GPosition::operator++ | ( | ) | [inline] |
Moves this GPosition object to the next object in the container.
Definition at line 705 of file GContainer.h.
GPosition& GPosition::operator-- | ( | ) | [inline] |
Moves this GPosition object to the previous object in the container.
Definition at line 708 of file GContainer.h.
void GPosition::throw_invalid | ( | void * | c | ) | const [protected] |
Definition at line 357 of file GContainer.cpp.
Member Data Documentation
void* GPosition::cont [protected] |
Definition at line 725 of file GContainer.h.
Node* GPosition::ptr [protected] |
Definition at line 724 of file GContainer.h.
The documentation for this class was generated from the following files: