351 class iterator_base :
public std::iterator<std::bidirectional_iterator_tag, value_type> {
381 iterator
end() {
return iterator(); }
383 iterator
rend() {
return iterator(); }
402 const_iterator
end()
const {
return const_iterator(); }
404 const_iterator
rend()
const {
return const_iterator(); }
434 )
const {
return dynamic_cast<T &
>(this->
GetReferenceAt(index)); }
454 #define PLIST(cls, T) typedef PList<T> cls
467 #define PDECLARE_LIST(cls, T) \
468 PLIST(cls##_PTemplate, T); \
469 PDECLARE_CLASS(cls, PList<T>) \
471 cls(int dummy, const cls * c) \
472 : PList<T>(dummy, c) { } \
476 virtual PObject * Clone() const \
477 { return PNEW cls(0, this); } \
554 #define PQUEUE(cls, T) typedef PQueue<T> cls
569 #define PDECLARE_QUEUE(cls, T) \
570 PQUEUE(cls##_PTemplate, T); \
571 PDECLARE_CLASS(cls, cls##_PTemplate) \
573 cls(int dummy, const cls * c) \
574 : cls##_PTemplate(dummy, c) { } \
577 : cls##_PTemplate() { } \
578 virtual PObject * Clone() const \
579 { return PNEW cls(0, this); } \
670 #define PSTACK(cls, T) typedef PStack<T> cls
685 #define PDECLARE_STACK(cls, T) \
686 PSTACK(cls##_PTemplate, T); \
687 PDECLARE_CLASS(cls, cls##_PTemplate) \
689 cls(int dummy, const cls * c) \
690 : cls##_PTemplate(dummy, c) { } \
693 : cls##_PTemplate() { } \
694 virtual PObject * Clone() const \
695 { return PNEW cls(0, this); } \
1003 )
const {
return dynamic_cast<T &
>(*this->
GetAt(index)); }
1026 class iterator_base :
public std::iterator<std::bidirectional_iterator_tag, value_type> {
1033 bool Valid()
const {
return PAssert(this->m_list != NULL && this->m_element != NULL && this->m_element != &m_list->m_info->nil,
PInvalidArrayIndex); }
1034 void Next() {
if (Valid()) this->m_list->NextElement(this->m_element); }
1035 void Prev() {
if (Valid()) this->m_list->PrevElement(this->m_element); }
1036 value_type * Ptr()
const {
return dynamic_cast<value_type *
>(Valid() ? this->m_element->m_data : NULL); }
1061 iterator
end() {
return iterator(); }
1063 iterator
rend() {
return iterator(); }
1080 const_iterator
end()
const {
return const_iterator(); }
1082 const_iterator
rend()
const {
return const_iterator(); }
1116 #define PSORTED_LIST(cls, T) typedef PSortedList<T> cls
1131 #define PDECLARE_SORTED_LIST(cls, T) \
1132 PSORTED_LIST(cls##_PTemplate, T); \
1133 PDECLARE_CLASS(cls, PSortedList<T>) \
1135 cls(int dummy, const cls * c) \
1136 : PSortedList<T>(dummy, c) { } \
1139 : PSortedList<T>() { } \
1140 virtual PObject * Clone() const \
1141 { return PNEW cls(0, this); } \
1144 #endif // PTLIB_LISTS_H
const value_type * operator->() const
Definition: lists.h:1075
virtual PBoolean IsEmpty() const
Determine if the container is empty.
__inline void pop()
Definition: lists.h:638
value_type & operator*() const
Definition: lists.h:377
virtual PObject * Clone() const
Make a complete duplicate of the list.
Definition: lists.h:985
virtual T & Top()
Get the element that is currently on top of the stack without removing it.
Definition: lists.h:646
iterator end()
Definition: lists.h:381
virtual PObject * Clone() const
Make a complete duplicate of the list.
Definition: lists.h:514
bool operator==(const iterator_base &it) const
Definition: lists.h:361
PQueue(int dummy, const PQueue *c)
Definition: lists.h:536
__inline void erase(const const_iterator &it)
Definition: lists.h:412
PSortedListElement * Successor(PSortedListElement *node) const
iterator rbegin()
Definition: lists.h:382
virtual P_DEPRECATED PBoolean ReplaceAt(PINDEX index, PObject *val)
Set the object at the specified ordinal position to the new value.
iterator(PSortedList< T > *l, PSortedListElement *e)
Definition: lists.h:1049
const_iterator operator--()
Definition: lists.h:393
value_type & back()
Definition: lists.h:1085
PINLINE PObject & GetReferenceAt(PINDEX index) const
iterator(PListElement *e=NULL)
Definition: lists.h:369
enum PSortedListElement::@5 m_colour
const_iterator rend() const
Definition: lists.h:1082
const_iterator()
Definition: lists.h:1067
PListElement * FindElement(PINDEX index) const
iterator rend()
Definition: lists.h:383
__inline void pop_back()
Definition: lists.h:416
PINDEX m_subTreeSize
Definition: lists.h:709
PSortedListElement * m_left
Definition: lists.h:706
virtual PBoolean SetSize(PINDEX newSize)
This function is meaningless for lists.
__inline void pop_back()
Definition: lists.h:1096
value_type * operator->() const
Definition: lists.h:1056
T value_type
Definition: lists.h:349
void erase(const iterator &it)
Definition: lists.h:1092
#define PINLINE
Definition: object.h:194
iterator operator++()
Definition: lists.h:371
const_iterator operator++(int)
Definition: lists.h:394
PSortedList()
Create a new, empty, sorted list.
Definition: lists.h:976
virtual PINDEX Insert(const PObject &before, PObject *obj)
Add a new object to the collection.
const_iterator(const PSortedList< T > *l, PSortedListElement *e)
Definition: lists.h:1068
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
virtual void RemoveAll()
Remove all of the elements in the collection.
virtual PINDEX GetValuesIndex(const PObject &obj) const
Search the collection for the specified value of the object.
iterator find(const value_type &obj)
Definition: lists.h:1089
PSortedList(int dummy, const PSortedList *c)
Definition: lists.h:1100
A Pop() was made of a stack with no elements.
Definition: object.h:376
iterator operator++()
Definition: lists.h:1051
PSortedListElement * m_right
Definition: lists.h:707
virtual PBoolean SetAt(PINDEX index, PObject *val)
This method simply returns false as the list order is mantained by the class.
PSortedListElement * OrderSelect(PINDEX index) const
Definition: lists.h:725
iterator_base(PListElement *e)
Definition: lists.h:353
iterator()
Definition: lists.h:1048
const_iterator(PListElement *e=NULL)
Definition: lists.h:390
bool operator!=(const PObject &obj) const
Compare the two objects.
Definition: object.h:2318
void insert(const iterator &pos, value_type *obj)
Definition: lists.h:385
virtual PObject * Clone() const
Make a complete duplicate of the stack.
Definition: lists.h:616
virtual PINDEX GetObjectsIndex(const PObject *obj) const
Search the collection for the specific instance of the object.
void Next()
Definition: lists.h:356
#define P_POP_MSVC_WARNINGS()
Definition: object.h:154
PListElement Element
Definition: lists.h:311
void InsertElement(PListElement *element, PObject *obj)
virtual PINDEX Append(PObject *obj)
Append a new object to the collection.
An index into an array was negative.
Definition: object.h:374
PQueue()
Create a new, empty, queue.
Definition: lists.h:505
const_iterator operator++(int)
Definition: lists.h:1072
virtual PBoolean Remove(const PObject *obj)
Remove the object from the collection.
const_iterator find(const value_type &obj) const
Definition: lists.h:1090
PList()
Create a new, empty, list.
Definition: lists.h:334
const value_type & operator*() const
Definition: lists.h:398
value_type & back() const
Definition: lists.h:409
iterator operator--()
Definition: lists.h:1052
PSortedListElement * OrderSelect(PSortedListElement *node, PINDEX index) const
This template class maps the PAbstractList to a specific object type.
Definition: lists.h:322
iterator rbegin()
Definition: lists.h:1062
const_iterator begin() const
Definition: lists.h:401
PSortedListElement * m_root
Definition: lists.h:720
PINDEX ValueSelect(PSortedListElement *node, const PObject &obj, PSortedListElement *&element) const
void RemoveElement(PSortedListElement *node)
PListInfo()
Definition: lists.h:53
PINLINE PAbstractList()
Create a new, empty, list.
virtual T * Dequeue()
Remove an object that was added to the queue.
Definition: lists.h:531
iterator operator--()
Definition: lists.h:372
iterator find(const value_type &obj)
Definition: lists.h:384
virtual void Enqueue(T *obj)
Add a new object to the queue.
Definition: lists.h:523
friend class iterator_base
Definition: lists.h:1009
virtual Comparison Compare(const PObject &obj) const
Get the relative rank of the two lists.
const_iterator operator--(int)
Definition: lists.h:395
virtual P_DEPRECATED PINDEX InsertAt(PINDEX index, PObject *obj)
Insert a new object at the specified ordinal index.
PList(int dummy, const PList *c)
Definition: lists.h:438
virtual PINDEX Append(PObject *obj)
Add a new object to the collection.
virtual T * Pop()
Remove the last object pushed onto the stack.
Definition: lists.h:636
void insert(const iterator &pos, const value_type &obj)
Definition: lists.h:386
PSortedListElement nil
Definition: lists.h:719
PSortedListElement(PSortedListElement *nil=NULL, PObject *obj=NULL)
__inline void erase(const iterator &it)
Definition: lists.h:411
iterator end()
Definition: lists.h:1061
virtual PObject * GetAt(PINDEX index) const
Get the object at the specified ordinal position.
virtual PObject * RemoveHead()
Remove the head object from the list.
Definition: lists.h:207
virtual P_DEPRECATED PObject * RemoveAt(PINDEX index)
Remove the object at the specified ordinal index from the collection.
PDECLARE_POOL_ALLOCATOR(PSortedListElement)
virtual PBoolean Remove(const PObject *obj)
Remove the object from the collection.
bool operator!=(const iterator_base &it) const
Definition: lists.h:362
void RightRotate(PSortedListElement *node)
void erase(const const_iterator &it)
Definition: lists.h:1093
#define PAssertNULL(ptr)
This macro is used to assert that a pointer must be non-null.
Definition: object.h:428
PObject * m_data
Definition: lists.h:708
virtual PINDEX GetSize() const
Get the current size of the container.
__inline void push_back(const value_type &value)
Definition: lists.h:414
virtual PINDEX GetObjectsIndex(const PObject *obj) const
Search the collection for the specific instance of the object.
PDECLARE_POOL_ALLOCATOR(PListElement)
bool operator==(const PObject &obj) const
Compare the two objects.
Definition: object.h:2309
bool PBoolean
Definition: object.h:174
virtual void Push(T *obj)
Add an object to the stack.
Definition: lists.h:626
PObject * RemoveElement(PListElement *element)
virtual Comparison Compare(const PObject &obj) const
Get the relative rank of the two lists.
This class is a collection of objects which are descendents of the PObject class. ...
Definition: lists.h:80
value_type & front()
Definition: lists.h:1084
PObject * data
Definition: lists.h:46
iterator begin()
Definition: lists.h:380
virtual PObject * RemoveAt(PINDEX index)
Remove the object at the specified ordinal index from the collection.
virtual PINDEX GetValuesIndex(const PObject &obj) const
Search the collection for the specified value of the object.
The character string class.
Definition: pstring.h:108
const_iterator begin() const
Definition: lists.h:1079
PStack(int dummy, const PStack *c)
Definition: lists.h:652
#define P_PUSH_MSVC_WARNINGS(warnings)
Definition: object.h:153
value_type & operator*() const
Definition: lists.h:1057
This template class maps the PAbstractList to a specific object type, and adds functionality that all...
Definition: lists.h:492
const value_type & front() const
Definition: lists.h:1086
PListElement * prev
Definition: lists.h:44
const_iterator operator++()
Definition: lists.h:1070
PSortedListElement * FindElement(const PObject &obj, PINDEX *index) const
bool deleteObjects
Definition: contain.h:67
const value_type & back() const
Definition: lists.h:1087
virtual PINDEX Insert(const PObject &before, PObject *obj)
Insert a new object immediately before the specified object.
T & operator[](PINDEX index) const
Retrieve a reference to the object in the list.
Definition: lists.h:432
iterator operator--(int)
Definition: lists.h:374
PAbstractSortedList()
Create a new, empty, sorted list.
virtual PINDEX InsertAt(PINDEX index, PObject *obj)
Add a new object to the collection.
T value_type
Definition: lists.h:1008
PDECLARE_POOL_ALLOCATOR(PSortedListInfo)
const_iterator rend() const
Definition: lists.h:404
virtual void Prepend(PObject *obj)
Append a new object to the collection.
__inline void push(T *obj)
Definition: lists.h:629
value_type & front() const
Definition: lists.h:408
PStack()
Create a new, empty, stack.
Definition: lists.h:607
const_iterator operator--()
Definition: lists.h:1071
iterator operator++(int)
Definition: lists.h:373
virtual PObject * Clone() const
Make a complete duplicate of the list.
Definition: lists.h:343
PDECLARE_POOL_ALLOCATOR(PListInfo)
virtual PObject * RemoveTail()
Remove the tail object from the list.
Definition: lists.h:216
__inline void push_front(const value_type &value)
Definition: lists.h:413
const value_type * operator->() const
Definition: lists.h:397
PListElement(PObject *theData)
iterator operator++(int)
Definition: lists.h:1053
virtual P_DEPRECATED PBoolean SetAt(PINDEX index, PObject *val)
Set the object at the specified ordinal position to the new value.
const_iterator end() const
Definition: lists.h:1080
This template class maps the PAbstractSortedList to a specific object type.
Definition: lists.h:964
iterator rend()
Definition: lists.h:1063
This template class maps the PAbstractList to a specific object type, and adds functionality that all...
Definition: lists.h:594
PListElement * tail
Definition: lists.h:55
PListElement * head
Definition: lists.h:54
__inline void pop_front()
Definition: lists.h:415
value_type * Ptr() const
Definition: lists.h:358
#define PAssert(b, msg)
This macro is used to assert that a condition must be true.
Definition: object.h:400
PSortedListElement * Predecessor(PSortedListElement *node) const
const_iterator rbegin() const
Definition: lists.h:1081
virtual PObject * Clone() const
Create a copy of the class on the heap.
#define P_DEPRECATED
Definition: object.h:141
T & operator[](PINDEX index) const
Retrieve a reference to the object in the list.
Definition: lists.h:1001
const_iterator operator++()
Definition: lists.h:392
__inline void insert(const value_type &value)
Definition: lists.h:1094
This class is a collection of objects which are descendents of the PObject class. ...
Definition: lists.h:758
virtual P_DEPRECATED PObject * GetAt(PINDEX index) const
Get the object at the specified ordinal position.
iterator begin()
Definition: lists.h:1060
const value_type & operator*() const
Definition: lists.h:1076
virtual PBoolean SetSize(PINDEX newSize)
This function is meaningless for lists.
__inline T & front()
Definition: lists.h:648
void DeleteSubTrees(PSortedListElement *node, bool deleteObject)
PContainerReference * reference
Definition: contain.h:288
__inline void pop_front()
Definition: lists.h:1095
PSortedListInfo()
Definition: lists.h:717
const_iterator operator--(int)
Definition: lists.h:1073
PListElement * next
Definition: lists.h:45
This object describes the information associated with one part of a multi-part body.
Definition: mime.h:294
void LeftRotate(PSortedListElement *node)
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
PSortedListInfo * m_info
Definition: lists.h:953
value_type * operator->() const
Definition: lists.h:376
A collection is a container that collects together descendents of the PObject class.
Definition: contain.h:392
A logic error occurred.
Definition: object.h:370
PListElement * element
Definition: lists.h:354
const_iterator find(const value_type &obj) const
Definition: lists.h:405
PListInfo * m_info
Definition: lists.h:312
const_iterator rbegin() const
Definition: lists.h:403
void DisallowDeleteObjects()
Disallow the deletion of the objects contained in the collection.
void Prev()
Definition: lists.h:357
const_iterator end() const
Definition: lists.h:402
iterator operator--(int)
Definition: lists.h:1054
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:1896
PINDEX ValueSelect(const PObject &obj, PSortedListElement *&element) const
Definition: lists.h:727
PSortedListElement * m_parent
Definition: lists.h:705