This template class provides a data structure and operations for administrating an ordered set of elements of an arbitrary type. More...
Public Member Functions | |
OFOrderedSet () | |
Default constructor. | |
OFOrderedSet (const OFOrderedSet< T > &src) | |
Copy constructor. | |
virtual | ~OFOrderedSet () |
Destructor. | |
const OFOrderedSet< T > & | operator= (const OFOrderedSet< T > &src) |
operator=. | |
const OFOrderedSet< T > & | assign (const OFOrderedSet< T > &src) |
This function is a workaround for avoiding a compiler warning on Solaris 2.5.1 using compiler SC 2.0.1. | |
virtual OFBool | operator== (const OFOrderedSet< T > &other) const |
Determines if two sets are identical. | |
virtual OFBool | operator!= (const OFOrderedSet< T > &other) const |
Determines if two sets are not identical. | |
virtual void | Insert (const T &item) |
Inserts a new item into the set. | |
virtual void | Insert (const OFOrderedSet< T > &other) |
Inserts all items of another set into this set. | |
virtual void | InsertAt (const T &item, unsigned int idx) |
Inserts a new item at a certain position into the set. | |
virtual void | Remove (const T &item) |
Removes one item from the set. | |
virtual void | RemoveByIndex (unsigned int idx) |
Removes one item from the set. | |
virtual T * | Find (const T &item) const |
Tries to find a given object in the set. | |
virtual OFBool | Contains (const T &item) const |
Determines if a certain item is contained in the set. | |
virtual OFBool | IsSupersetOf (const OFOrderedSet< T > &other) const |
Determines if this is an actual superset of other, i.e. | |
virtual OFBool | IsSubsetOf (const OFOrderedSet< T > &other) const |
Determines if this is an actual subset of other, i.e. | |
OFOrderedSet< T > | Union (const OFOrderedSet< T > &other) const |
Determines the union of the two sets this and other, i.e. | |
OFOrderedSet< T > | Intersection (const OFOrderedSet< T > &other) const |
Determines the intersection of the two sets this and other, i.e. | |
OFOrderedSet< T > | Difference (const OFOrderedSet< T > &other) const |
Determines the difference this - other, i.e. | |
OFOrderedSet< T > | SymmetricDifference (const OFOrderedSet< T > &other) const |
Determines the symmetric difference of this and other, i.e. |
This template class provides a data structure and operations for administrating an ordered set of elements of an arbitrary type.
Note the following properties of this class:
Definition at line 56 of file ofoset.h.
OFOrderedSet< T >::OFOrderedSet | ( | const OFOrderedSet< T > & | src | ) | [inline] |
virtual OFBool OFOrderedSet< T >::Contains | ( | const T & | item | ) | const [inline, virtual] |
Determines if a certain item is contained in the set.
item | - Item which shall be looked for. |
Implements OFSet< T >.
Definition at line 334 of file ofoset.h.
Referenced by OFOrderedSet< T >::Difference(), OFOrderedSet< T >::Intersection(), and OFOrderedSet< T >::IsSupersetOf().
OFOrderedSet<T> OFOrderedSet< T >::Difference | ( | const OFOrderedSet< T > & | other | ) | const [inline] |
Determines the difference this - other, i.e.
the set containing all the items found in this but not in other, and returns the resulting new set.
other | Second parameter for difference. |
Definition at line 457 of file ofoset.h.
References OFOrderedSet< T >::Contains(), OFOrderedSet< T >::Insert(), and OFOrderedSet< T >::Remove().
Referenced by OFOrderedSet< T >::SymmetricDifference().
virtual T* OFOrderedSet< T >::Find | ( | const T & | item | ) | const [inline, virtual] |
Tries to find a given object in the set.
In case the specified object could be found, a pointer to the corresponding element within the set is returned; in case the specified object could not be found, NULL will be returned.
item | Search pattern. |
Implements OFSet< T >.
virtual void OFOrderedSet< T >::Insert | ( | const OFOrderedSet< T > & | other | ) | [inline, virtual] |
Inserts all items of another set into this set.
other | set whose items shall be inserted into the set. |
Definition at line 170 of file ofoset.h.
References OFOrderedSet< T >::Insert().
virtual void OFOrderedSet< T >::Insert | ( | const T & | item | ) | [inline, virtual] |
Inserts a new item into the set.
item | Item which shall be inserted into the set. |
Implements OFSet< T >.
Definition at line 150 of file ofoset.h.
References OFSet< T >::Resize().
Referenced by OFOrderedSet< T >::Difference(), OFOrderedSet< T >::Insert(), OFOrderedSet< T >::InsertAt(), OFOrderedSet< T >::Intersection(), and OFOrderedSet< T >::Union().
virtual void OFOrderedSet< T >::InsertAt | ( | const T & | item, | |
unsigned int | idx | |||
) | [inline, virtual] |
Inserts a new item at a certain position into the set.
item | Item which shall be inserted into the set. | |
idx | Index of the position at which the item shall be inserted. The first position has index 0. Note that in case index is greater than the index of the last item, the new item will be inserted right behind the last item of the set. |
Definition at line 185 of file ofoset.h.
References OFOrderedSet< T >::Insert(), and OFSet< T >::Resize().
OFOrderedSet<T> OFOrderedSet< T >::Intersection | ( | const OFOrderedSet< T > & | other | ) | const [inline] |
Determines the intersection of the two sets this and other, i.e.
the set containing all items which can be found in both this and other, and returns the resulting new set.
other | Second parameter for intersection. |
Definition at line 423 of file ofoset.h.
References OFOrderedSet< T >::Contains(), OFOrderedSet< T >::Insert(), and OFOrderedSet< T >::Remove().
virtual OFBool OFOrderedSet< T >::IsSubsetOf | ( | const OFOrderedSet< T > & | other | ) | const [inline, virtual] |
Determines if this is an actual subset of other, i.e.
if this is completely contained in other and other furthermore has additional elements.
other | - Set which shall be compared with this. |
Definition at line 392 of file ofoset.h.
References OFOrderedSet< T >::IsSupersetOf().
virtual OFBool OFOrderedSet< T >::IsSupersetOf | ( | const OFOrderedSet< T > & | other | ) | const [inline, virtual] |
Determines if this is an actual superset of other, i.e.
if this completely contains other and furthermore has additional elements.
other | - Set which shall be compared with this. |
Definition at line 354 of file ofoset.h.
References OFOrderedSet< T >::Contains(), and OFOrderedSet< T >::Remove().
Referenced by OFOrderedSet< T >::IsSubsetOf().
virtual OFBool OFOrderedSet< T >::operator!= | ( | const OFOrderedSet< T > & | other | ) | const [inline, virtual] |
const OFOrderedSet<T>& OFOrderedSet< T >::operator= | ( | const OFOrderedSet< T > & | src | ) | [inline] |
operator=.
src | Source object whose values will be assigned to this. |
Reimplemented from OFSet< T >.
Definition at line 89 of file ofoset.h.
References OFOrderedSet< T >::assign().
Referenced by OFOrderedSet< T >::assign().
virtual OFBool OFOrderedSet< T >::operator== | ( | const OFOrderedSet< T > & | other | ) | const [inline, virtual] |
Determines if two sets are identical.
Note that for ordered sets not only their elements have to be identical, but also the order of their elements has to be identical.
other | Set which shall be compared with this. |
virtual void OFOrderedSet< T >::Remove | ( | const T & | item | ) | [inline, virtual] |
Removes one item from the set.
item | Item which shall be inserted into the set. |
Implements OFSet< T >.
Definition at line 233 of file ofoset.h.
Referenced by OFOrderedSet< T >::Difference(), OFOrderedSet< T >::Intersection(), and OFOrderedSet< T >::IsSupersetOf().
virtual void OFOrderedSet< T >::RemoveByIndex | ( | unsigned int | idx | ) | [inline, virtual] |
Removes one item from the set.
idx | Index of the item which shall be removed from the set. |
Implements OFSet< T >.
OFOrderedSet<T> OFOrderedSet< T >::SymmetricDifference | ( | const OFOrderedSet< T > & | other | ) | const [inline] |
Determines the symmetric difference of this and other, i.e.
the set containing all the items which can be found either in this or in other but not in the intersection of this and other, and returns the resulting new set.
other | Second parameter for symmetric difference. |
Definition at line 494 of file ofoset.h.
References OFOrderedSet< T >::Difference(), and OFOrderedSet< T >::Union().
OFOrderedSet<T> OFOrderedSet< T >::Union | ( | const OFOrderedSet< T > & | other | ) | const [inline] |
Determines the union of the two sets this and other, i.e.
the set containing all items which can be found either in this or in other, and returns the resulting new set.
other | Second parameter for union. |
Definition at line 404 of file ofoset.h.
References OFOrderedSet< T >::Insert().
Referenced by OFOrderedSet< T >::SymmetricDifference().