class GPosition: protected GCont

Generic iterator class.

Inheritance:


Public Methods

[more] GPosition()
Creates a null GPosition object.
[more] GPosition(const GPosition &ref)
Creates a copy of a GPosition object.
[more] operator int() const
Tests whether this GPosition object is non null.
[more]int operator !() const
Tests whether this GPosition object is null.
[more]GPosition& operator ++()
Moves this GPosition object to the next object in the container.
[more]GPosition& operator --()
Moves this GPosition object to the previous object in the container.


Documentation

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:
    void print_list(GList<GString> a)
    {
      for (GPosition i = a ; i; ++i) 
        printf("%s\n", (const char*) a[i] );
    }

    void print_list_backwards(GList<GString> a)
    {
      for (GPosition i = a.lastpos() ; i; --i) 
        printf("%s\n", (const char*) a[i] );
    }
    
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.)
o GPosition()
Creates a null GPosition object.

o GPosition(const GPosition &ref)
Creates a copy of a GPosition object.

o operator int() const
Tests whether this GPosition object is non null.

oint operator !() const
Tests whether this GPosition object is null.

oGPosition& operator ++()
Moves this GPosition object to the next object in the container.

oGPosition& operator --()
Moves this GPosition object to the previous object in the container.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.