Detailed Description
The PList class represents a generic container which handle an ordered collection of PObject; NOT thread-safe.
You can store different type of Papillon objects in a same list.
PList relies on a resizable-array implementation.
How to iterate over a PList?
To copy the list container, you can use Clone(); warning: you will obtain a separate container but elements themselves are not cloned.
#include <PList.h>
Constructor & Destructor Documentation
◆ PList() [1/2]
PList::PList | ( | ) |
Constructs an empty list.
◆ PList() [2/2]
◆ ~PList()
|
virtual |
Destroys this object.
Member Function Documentation
◆ Add()
Adds the specified element at the end of this list.
Calls to Add() can be chained.
◆ AddFirst()
Adds the specified element at the beginning of this list.
Calls to Add() can be chained.
◆ Append()
Appends all the elements of the specified list to this list.
◆ Clear()
void PList::Clear | ( | ) |
Clears this list.
- See also
- IsEmpty()
◆ Clone()
PList PList::Clone | ( | ) | const |
Returns a copy of this list.
The container is cloned but elements are not.
◆ Contains()
bool PList::Contains | ( | const PObject & | element | ) | const |
Returns true if the list contains at least an occurrence of the specified element, otherwise returns false.
◆ Get()
Gets the element at the specified index; the index must be valid.
Returns PResult::C_OK if success, another result otherwise (e.g. invalid index).
◆ IsEmpty()
bool PList::IsEmpty | ( | ) | const |
Returns true if this list of strings is empty, false otherwise.
- See also
- Size()
◆ operator=()
Performs a shared copy of other to this object.
- See also
- Clone()
◆ Remove()
PResult PList::Remove | ( | papillon::int32 | index | ) |
Removes the nth element in is list, effectively reducing the container size by one.
Returns PResult::C_OK if success, another result otherwise (e.g. if the container is empty).
◆ RemoveFirst()
PResult PList::RemoveFirst | ( | ) |
Removes the first element in this list, effectively reducing the container size by one.
Returns PResult::C_OK if success, another result otherwise (e.g. if the container is empty).
◆ RemoveLast()
PResult PList::RemoveLast | ( | ) |
Removes the last element in is list, effectively reducing the container size by one.
Returns PResult::C_OK if success, another result otherwise (e.g. if the container is empty).
◆ Set()
Sets the element at the specified index; the index must be valid.
Returns PResult::C_OK if success, another result otherwise (e.g. invalid index).
◆ Size()
papillon::int32 PList::Size | ( | ) | const |
Returns the number of elements in this list.
- See also
- IsEmpty()