SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Represents a group of ordered items, not accessible by an external key. More...
#include <rw/dlistcol.h>
Public Member Functions | |
virtual RWCollectable * | newSpecies () const |
virtual RWClassID | isA () const |
RWDlistCollectables () | |
RWDlistCollectables (RWCollectable *a) | |
virtual | ~RWDlistCollectables () |
bool | operator== (const RWDlistCollectables &d) const |
virtual RWCollectable * | append (RWCollectable *a) |
virtual void | apply (RWapplyCollectable ap, void *x) |
virtual RWCollectable *& | at (size_t i) |
virtual const RWCollectable * | at (size_t i) const |
virtual void | clear () |
virtual bool | contains (const RWCollectable *a) const |
virtual size_t | entries () const |
virtual RWCollectable * | find (const RWCollectable *target) const |
virtual RWCollectable * | first () const |
virtual size_t | index (const RWCollectable *c) const |
virtual RWCollectable * | insert (RWCollectable *c) |
virtual RWCollectable * | insertAt (size_t inx, RWCollectable *e) |
virtual bool | isEmpty () const |
virtual bool | isEqual (const RWCollectable *) const |
virtual RWCollectable * | last () const |
virtual size_t | occurrencesOf (const RWCollectable *target) const |
virtual RWCollectable * | prepend (RWCollectable *a) |
virtual RWCollectable * | remove (const RWCollectable *target) |
bool | containsReference (const RWCollectable *e) const |
RWCollectable * | findReference (const RWCollectable *e) const |
RWCollectable * | get () |
size_t | occurrencesOfReference (const RWCollectable *e) const |
RWCollectable * | removeReference (const RWCollectable *e) |
virtual RWIterator * | newIterator () |
virtual RWConstIterator * | newConstIterator () const |
Static Public Member Functions | |
static RWClassID | classIsA () |
Class RWDlistCollectables represents a group of ordered items, not accessible by an external key. Duplicates are allowed. The ordering of elements is determined externally, generally by the order of insertion and removal. An object stored by RWDlistCollectables must inherit the abstract base class RWCollectable.
Class RWDlistCollectables is implemented as a doubly-linked list, which allows for efficient insertion and removal, as well as for movement in either direction.
#include <rw/dlistcol.h> RWDlistCollectables a;
Polymorphic
RWDlistCollectables::RWDlistCollectables | ( | ) | [inline] |
Constructs an empty doubly-linked list.
RWDlistCollectables::RWDlistCollectables | ( | RWCollectable * | a | ) | [inline] |
Constructs a linked list with a single item a.
virtual RWDlistCollectables::~RWDlistCollectables | ( | ) | [inline, virtual] |
Empty Destructor.
virtual RWCollectable* RWDlistCollectables::append | ( | RWCollectable * | a | ) | [inline, virtual] |
Inserts the item at the end of the collection and returns it. Returns rwnil if the insertion was unsuccessful.
Implements RWSequenceable.
virtual void RWDlistCollectables::apply | ( | RWapplyCollectable | ap, | |
void * | x | |||
) | [inline, virtual] |
Applies the user-supplied function pointed to by ap to each member of the collection, in order, from first to last.
Implements RWSequenceable.
virtual const RWCollectable* RWDlistCollectables::at | ( | size_t | i | ) | const [inline, virtual] |
Allows access to the i th element of the collection. The value i must be between zero and the number of items in the collection less one, or the function throws an exception of type RWBoundsErr. Note that for a linked list, these functions must traverse all the links, making them particularly inefficient.
Implements RWSequenceable.
virtual RWCollectable*& RWDlistCollectables::at | ( | size_t | i | ) | [inline, virtual] |
Allows access to the i th element of the collection. The value i must be between zero and the number of items in the collection less one, or the function throws an exception of type RWBoundsErr. Note that for a linked list, these functions must traverse all the links, making them particularly inefficient.
Implements RWSequenceable.
static RWClassID RWDlistCollectables::classIsA | ( | ) | [static] |
Returns the RWClassID of this class.
Reimplemented from RWCollectable.
virtual void RWDlistCollectables::clear | ( | ) | [inline, virtual] |
Removes all objects from the collection. Does not delete the objects themselves.
Implements RWSequenceable.
virtual bool RWDlistCollectables::contains | ( | const RWCollectable * | target | ) | const [inline, virtual] |
Returns true
if the collection contains an item where the virtual function find() returns non-nil.
Reimplemented from RWCollection.
bool RWDlistCollectables::containsReference | ( | const RWCollectable * | e | ) | const [inline] |
Returns true if the list contains an item that is identical to the item pointed to by e (that is, that has the address e).
virtual size_t RWDlistCollectables::entries | ( | ) | const [inline, virtual] |
Returns the total number of items in the collection.
Implements RWSequenceable.
virtual RWCollectable* RWDlistCollectables::find | ( | const RWCollectable * | target | ) | const [inline, virtual] |
Returns the first item that isEqual() to the item pointed to by target, or rwnil if no item is found.
Implements RWSequenceable.
RWCollectable* RWDlistCollectables::findReference | ( | const RWCollectable * | e | ) | const [inline] |
Returns the first item that is identical to the item pointed to by e (that is, that has the address e), or rwnil if none is found.
virtual RWCollectable* RWDlistCollectables::first | ( | ) | const [inline, virtual] |
Returns the item at the beginning of the list.
Implements RWSequenceable.
RWCollectable* RWDlistCollectables::get | ( | ) | [inline] |
Returns and removes the item at the beginning of the list.
virtual size_t RWDlistCollectables::index | ( | const RWCollectable * | c | ) | const [inline, virtual] |
Returns the index of the first item that isEqual() to the item pointed to by c, or RW_NPOS if there is no such index.
Implements RWSequenceable.
virtual RWCollectable* RWDlistCollectables::insert | ( | RWCollectable * | c | ) | [inline, virtual] |
Adds the item to the end of the collection and returns it. Returns rwnil if the insertion was unsuccessful.
Implements RWSequenceable.
virtual RWCollectable* RWDlistCollectables::insertAt | ( | size_t | inx, | |
RWCollectable * | e | |||
) | [inline, virtual] |
Adds a new item to the collection at position inx. The item previously at position i is moved to i + 1, and so forth. The index inx must be between zero and the number of items in the collection, or the function throws an exception of type RWBoundsErr.
Implements RWSequenceable.
virtual RWClassID RWDlistCollectables::isA | ( | ) | const [virtual] |
Returns the unique ID for RWDlistCollectables.
Reimplemented from RWCollection.
virtual bool RWDlistCollectables::isEmpty | ( | ) | const [inline, virtual] |
Returns true
if the collection is empty, otherwise returns false
.
Implements RWSequenceable.
virtual bool RWDlistCollectables::isEqual | ( | const RWCollectable * | t | ) | const [virtual] |
Returns true
if the collectable object "matches" the object at address t. The default definition is:
return this == t;
i.e., both objects have the same address (a test for identity). The definition may be redefined in any consistent way.
Reimplemented from RWCollectable.
virtual RWCollectable* RWDlistCollectables::last | ( | ) | const [inline, virtual] |
Returns the item at the end of the list.
Implements RWSequenceable.
virtual RWConstIterator* RWDlistCollectables::newConstIterator | ( | ) | const [virtual] |
Returns a const pointer to a dynamically allocated iterator for the collection.
Implements RWCollection.
virtual RWIterator* RWDlistCollectables::newIterator | ( | ) | [virtual] |
Returns a dynamically allocated iterator for the collection.
Implements RWCollection.
virtual RWCollectable* RWDlistCollectables::newSpecies | ( | ) | const [virtual] |
Allocates a new object off the heap of the same type as self and returns a pointer to it. You are responsible for deleting the object when done with it.
Reimplemented from RWCollectable.
virtual size_t RWDlistCollectables::occurrencesOf | ( | const RWCollectable * | target | ) | const [inline, virtual] |
Returns the number of items that isEqual() to the item pointed to by target.
Implements RWSequenceable.
size_t RWDlistCollectables::occurrencesOfReference | ( | const RWCollectable * | e | ) | const [inline] |
Returns the number of items that are identical to the item pointed to by e (that is, that have the address e).
bool RWDlistCollectables::operator== | ( | const RWDlistCollectables & | d | ) | const |
Returns true
if self and d have the same number of items and if, for every item in self, the corresponding item in the same position in d isEqual() to the item in self.
virtual RWCollectable* RWDlistCollectables::prepend | ( | RWCollectable * | a | ) | [inline, virtual] |
Adds the item to the beginning of the collection and returns it. Returns rwnil if the insertion was unsuccessful.
Implements RWSequenceable.
virtual RWCollectable* RWDlistCollectables::remove | ( | const RWCollectable * | target | ) | [inline, virtual] |
Removes and returns the first item that isEqual() to the item pointed to by target. Returns rwnil if there is no such item.
Implements RWSequenceable.
RWCollectable* RWDlistCollectables::removeReference | ( | const RWCollectable * | e | ) | [inline] |
Removes and returns the first item that is identical to the item pointed to by e (that is, that has the address e). Returns rwnil if there is no such item.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.