SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDlistCollectables Class Reference

Represents a group of ordered items, not accessible by an external key. More...

#include <rw/dlistcol.h>

Inheritance diagram for RWDlistCollectables:
RWSequenceable RWCollection RWCollectable

Public Member Functions

 RWDlistCollectables ()
 
 RWDlistCollectables (const RWDlistCollectables &lst)
 
 RWDlistCollectables (RWCollectable *a)
 
 RWDlistCollectables (RWDlistCollectables &&lst)
 
virtual ~RWDlistCollectables ()
 
virtual RWCollectableappend (RWCollectable *a)
 
virtual void apply (RWapplyCollectable ap, void *x)
 
virtual RWCollectable *& at (size_t i)
 
virtual const RWCollectableat (size_t i) const
 
virtual void clear ()
 
virtual bool contains (const RWCollectable *a) const
 
bool containsReference (const RWCollectable *e) const
 
virtual RWCollectablecopy () const
 
virtual size_t entries () const
 
virtual RWCollectablefind (const RWCollectable *target) const
 
RWCollectablefindReference (const RWCollectable *e) const
 
virtual RWCollectablefirst () const
 
RWCollectableget ()
 
virtual size_t index (const RWCollectable *c) const
 
virtual RWCollectableinsert (RWCollectable *c)
 
virtual RWCollectableinsertAt (size_t inx, RWCollectable *e)
 
virtual RWClassID isA () const
 
virtual bool isEmpty () const
 
virtual bool isEqual (const RWCollectable *) const
 
virtual RWCollectablelast () const
 
virtual RWConstIteratornewConstIterator () const
 
virtual RWIteratornewIterator ()
 
virtual RWCollectablenewSpecies () const
 
virtual size_t occurrencesOf (const RWCollectable *target) const
 
size_t occurrencesOfReference (const RWCollectable *e) const
 
RWDlistCollectablesoperator= (const RWDlistCollectables &rhs)
 
RWDlistCollectablesoperator= (RWDlistCollectables &&rhs)
 
bool operator== (const RWDlistCollectables &d) const
 
virtual RWCollectableprepend (RWCollectable *a)
 
virtual RWCollectableremove (const RWCollectable *target)
 
RWCollectableremoveReference (const RWCollectable *e)
 
- Public Member Functions inherited from RWCollection
virtual ~RWCollection ()
 
RWBag asBag () const
 
RWBinaryTree asBinaryTree () const
 
RWOrdered asOrderedCollection () const
 
RWSet asSet () const
 
RWBinaryTree asSortedCollection () const
 
virtual RWspace binaryStoreSize () const
 
virtual void clearAndDestroy ()
 
void operator+= (const RWCollection &c)
 
void operator-= (const RWCollection &c)
 
virtual void removeAndDestroy (const RWCollectable *target)
 
virtual void restoreGuts (RWFile &)
 
virtual void restoreGuts (RWvistream &)
 
virtual void saveGuts (RWFile &) const
 
virtual void saveGuts (RWvostream &) const
 
RWCollectionselect (RWtestCollectable tst, void *vp) const
 
- Public Member Functions inherited from RWCollectable
virtual ~RWCollectable ()
 
virtual int compareTo (const RWCollectable *) const
 
virtual unsigned hash () const
 
RWspace recursiveStoreSize () const
 
RWStringID stringID () const
 

Static Public Member Functions

static RWClassID classIsA ()
 
- Static Public Member Functions inherited from RWCollectable
static RWClassID classID (const RWStringID &name)
 
static RWClassID classIsA ()
 
static bool isAtom (RWClassID id)
 
static RWspace nilStoreSize ()
 

Friends

class RWDlistCollectablesIterator
 

Additional Inherited Members

- Static Public Attributes inherited from RWCollection
static size_t DEFAULT_CAPACITY
 

Detailed Description

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.

Synopsis
#include <rw/dlistcol.h>
Represents a group of ordered items, not accessible by an external key.
Definition dlistcol.h:49
Persistence
Polymorphic

Constructor & Destructor Documentation

◆ RWDlistCollectables() [1/4]

RWDlistCollectables::RWDlistCollectables ( )
inline

Constructs an empty doubly-linked list.

◆ RWDlistCollectables() [2/4]

RWDlistCollectables::RWDlistCollectables ( RWCollectable * a)
inline

Constructs a linked list with a single item a.

◆ RWDlistCollectables() [3/4]

RWDlistCollectables::RWDlistCollectables ( const RWDlistCollectables & lst)
inline

Makes a shallow copy of lst.

◆ ~RWDlistCollectables()

virtual RWDlistCollectables::~RWDlistCollectables ( )
inlinevirtual

Empty Destructor.

◆ RWDlistCollectables() [4/4]

RWDlistCollectables::RWDlistCollectables ( RWDlistCollectables && lst)
inline

Move constructor. The constructed RWDlistCollectables takes ownership of the data owned by lst.

Condition:
This method is available only on platforms with rvalue reference support.

Member Function Documentation

◆ append()

virtual RWCollectable * RWDlistCollectables::append ( RWCollectable * a)
inlinevirtual

Inserts the item at the end of the collection and returns it. Returns rwnil if the insertion was unsuccessful.

Implements RWSequenceable.

◆ apply()

virtual void RWDlistCollectables::apply ( RWapplyCollectable ap,
void * x )
inlinevirtual

Invokes the function pointer ap on each member in the collection, in order, from first to last.

Implements RWSequenceable.

◆ at() [1/2]

virtual RWCollectable *& RWDlistCollectables::at ( size_t i)
inlinevirtual

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.

◆ at() [2/2]

virtual const RWCollectable * RWDlistCollectables::at ( size_t i) const
inlinevirtual

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.

◆ classIsA()

static RWClassID RWDlistCollectables::classIsA ( )
static

Returns the RWClassID of this class.

◆ clear()

virtual void RWDlistCollectables::clear ( )
inlinevirtual

Removes all objects from the collection. Does not delete the objects themselves.

Implements RWSequenceable.

◆ contains()

virtual bool RWDlistCollectables::contains ( const RWCollectable * target) const
inlinevirtual

Returns true if the collection contains an item where the virtual function find() returns non-nil.

Reimplemented from RWCollection.

◆ containsReference()

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).

◆ copy()

virtual RWCollectable * RWDlistCollectables::copy ( ) const
virtual

Returns a new, copy-constructed object of the same type as self. The caller is responsible for deleting the object.

Reimplemented from RWCollectable.

◆ entries()

virtual size_t RWDlistCollectables::entries ( ) const
inlinevirtual

Returns the total number of items in the collection.

Implements RWSequenceable.

◆ find()

virtual RWCollectable * RWDlistCollectables::find ( const RWCollectable * target) const
inlinevirtual

Returns the first item that RWCollecatble::isEqual() to the item pointed to by target, or rwnil if no item is found.

Implements RWSequenceable.

◆ findReference()

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.

◆ first()

virtual RWCollectable * RWDlistCollectables::first ( ) const
inlinevirtual

Returns the item at the beginning of the list.

Implements RWSequenceable.

◆ get()

RWCollectable * RWDlistCollectables::get ( )
inline

Returns and removes the item at the beginning of the list.

◆ index()

virtual size_t RWDlistCollectables::index ( const RWCollectable * c) const
inlinevirtual

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.

◆ insert()

virtual RWCollectable * RWDlistCollectables::insert ( RWCollectable * c)
inlinevirtual

Adds the item to the end of the collection and returns it. Returns rwnil if the insertion was unsuccessful.

Implements RWSequenceable.

◆ insertAt()

virtual RWCollectable * RWDlistCollectables::insertAt ( size_t inx,
RWCollectable * e )
inlinevirtual

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.

◆ isA()

virtual RWClassID RWDlistCollectables::isA ( ) const
virtual

Returns the unique ID for RWDlistCollectables.

Reimplemented from RWCollection.

◆ isEmpty()

virtual bool RWDlistCollectables::isEmpty ( ) const
inlinevirtual

Returns true if the collection is empty, otherwise returns false.

Implements RWSequenceable.

◆ isEqual()

virtual bool RWDlistCollectables::isEqual ( const RWCollectable * t) const
virtual

Behaves as if compareTo(t) was invoked, returning true if the result equals 0, false otherwise.

Reimplemented from RWCollectable.

◆ last()

virtual RWCollectable * RWDlistCollectables::last ( ) const
inlinevirtual

Returns the item at the end of the list.

Implements RWSequenceable.

◆ newConstIterator()

virtual RWConstIterator * RWDlistCollectables::newConstIterator ( ) const
virtual

Returns a const pointer to a dynamically allocated iterator for the collection.

Implements RWCollection.

◆ newIterator()

virtual RWIterator * RWDlistCollectables::newIterator ( )
virtual

Returns a dynamically allocated iterator for the collection.

Implements RWCollection.

◆ newSpecies()

virtual RWCollectable * RWDlistCollectables::newSpecies ( ) const
virtual

Returns a new, default-constructed object of the same type as self. The caller is responsible for deleting the object.

Reimplemented from RWCollectable.

◆ occurrencesOf()

virtual size_t RWDlistCollectables::occurrencesOf ( const RWCollectable * target) const
inlinevirtual

Returns the number of items that isEqual() to the item pointed to by target.

Implements RWSequenceable.

◆ occurrencesOfReference()

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).

◆ operator=() [1/2]

RWDlistCollectables & RWDlistCollectables::operator= ( const RWDlistCollectables & rhs)
inline

Assignment operator. Makes a shallow copy of rhs.

◆ operator=() [2/2]

RWDlistCollectables & RWDlistCollectables::operator= ( RWDlistCollectables && rhs)
inline

Move assignment. Self takes ownership of the data owned by rhs.

Condition:
This method is available only on platforms with rvalue reference support.

◆ operator==()

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.

◆ prepend()

virtual RWCollectable * RWDlistCollectables::prepend ( RWCollectable * a)
inlinevirtual

Adds the item to the beginning of the collection and returns it. Returns rwnil if the insertion was unsuccessful.

Implements RWSequenceable.

◆ remove()

virtual RWCollectable * RWDlistCollectables::remove ( const RWCollectable * target)
inlinevirtual

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.

◆ removeReference()

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 © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.