|
Evo C++ Library v0.5.1
|
#include <evo/ptrlist.h>
Sequential list of managed pointers with random access.
| T | Type to use – an item type will be T* (Item), a pointer to items type will be T** (Item*) |
| TSize | Size type to use for size/index values (must be unsigned integer) – default: SizeT |
C++11:
Classes | |
| struct | Header |
| List data header. More... | |
Public Types | |
| typedef void | EvoContainerType |
| typedef T * | Item |
| Item type (pointer to Value) More... | |
| typedef IteratorRa< ThisType >::Const | Iter |
| Iterator (const) - IteratorRa. More... | |
| typedef IteratorRa< ThisType > | IterM |
| Iterator (mutable) - IteratorRa. More... | |
| typedef Size | Key |
| Key type (item index) More... | |
| typedef TSize | Size |
| List size integer type More... | |
| typedef PtrList< T, Size > | ThisType |
| This list type. More... | |
| typedef T | Value |
| Value type (Item dereferenced, same as T) More... | |
Public Member Functions | |
| PtrList () | |
| Default constructor sets as null. More... | |
| PtrList (const ThisType &data) | |
| Copy constructor. More... | |
| PtrList (std::initializer_list< T > init) | |
| Sequence constructor (C++11). More... | |
| PtrList (ThisType &&src) | |
| Move constructor (C++11). More... | |
| ~PtrList () | |
| Destructor. More... | |
| const ThisType & | asconst () const |
| Explicitly use a const reference to this. More... | |
| IterM | begin () |
| Get iterator at first item (mutable). More... | |
| Iter | begin () const |
| Get iterator at first item (const). More... | |
| Iter | cbegin () const |
| Get iterator at first item (const). More... | |
| Iter | cend () const |
| Get iterator at end (const). More... | |
| ThisType & | clear () |
| Clear by removing all items. More... | |
| int | compare (const ThisType &data) const |
| Comparison. More... | |
| ThisType & | copy (const ThisType &data) |
| Set as full (unshared) copy using data pointer (modifier). More... | |
| const Item * | data () const |
| Get data pointer for direct access (const). More... | |
| Item * | dataM () |
| Get data pointer (mutable). More... | |
| bool | empty () const |
| Get whether empty. More... | |
| IterM | end () |
| Get iterator at end. More... | |
| Iter | end () const |
| Get iterator at end (const). More... | |
| Key | find (const Value &value, Key start=0, Key end=END) const |
| Find first occurrence of item with forward search. More... | |
| Key | findr (const T &value, Key start=0, Key end=END) const |
| Find last occurrence of item with reverse search. More... | |
| const Item | first () const |
| Get first non-null item (const). More... | |
| Value & | get (const Key &key, bool *created=NULL) |
| Get item value for key, creating if needed (mutable). More... | |
| Item | getitem (const Key &key, bool *created=NULL) |
| Get item for key, creating if needed (mutable). More... | |
| Key | iend (Size offset=0) const |
| Get index for last item position using offset. More... | |
| const Item | item (Key index) const |
| Get item at position (const). More... | |
| Item | itemM (Key index) |
| Get item at position (mutable). More... | |
| const Item | last () const |
| Get last non-null item (const). More... | |
| bool | null () const |
| Get whether null. More... | |
| bool | operator!= (const ThisType &data) const |
| Inequality operator. More... | |
| Item | operator() (Key index) |
| Get item at position (mutable). More... | |
| ThisType & | operator= (ThisType &&src) |
| Move assignment operator (C++11). More... | |
| ThisType & | operator= (const ThisType &data) |
| Assignment operator. More... | |
| bool | operator== (const ThisType &data) const |
| Equality operator. More... | |
| const Item | operator[] (Key index) const |
| Get item at position (const). More... | |
| ThisType & | remove (Key key) |
| Remove item and set as null (modifier). More... | |
| ThisType & | resize (Size newsize) |
| Resize while preserving existing data (modifier). More... | |
| ThisType & | resizemin (Size minsize) |
| Resize to minimum size while preserving existing data (modifier). More... | |
| ThisType & | set () |
| Set as null and empty. More... | |
| ThisType & | set (const ThisType &data) |
| Set from another list. More... | |
| ThisType & | setempty () |
| Set as empty but not null. More... | |
| bool | shared () const |
| Get whether shared. More... | |
| Size | size () const |
| Get list size. More... | |
| void | swap (ThisType &list) |
| Swap with another list. More... | |
| ThisType & | unshare () |
| Make sure data is not shared by allocating new buffer if needed (modifier). More... | |
| Size | used () const |
| Get list used size, number of non-null items. More... | |
Protected Attributes | |
| Item * | data_ |
| Data pointer, NULL if null, can be 1 if empty (size_=0) More... | |
| Header * | header_ |
| Data header pointer, NULL if no buffer allocated. More... | |
| Size | size_ |
| Data size (same as header.size), 0 if empty. More... | |
| typedef void EvoContainerType |
| typedef T* Item |
Item type (pointer to Value)
| typedef IteratorRa<ThisType>::Const Iter |
Iterator (const) - IteratorRa.
| typedef IteratorRa<ThisType> IterM |
Iterator (mutable) - IteratorRa.
| typedef TSize Size |
List size integer type
| typedef T Value |
Value type (Item dereferenced, same as T)
|
inline |
Default constructor sets as null.
|
inline |
Destructor.
|
inline |
Sequence constructor (C++11).
| init | Initializer list, passed as comma-separated values in braces { } |
|
inline |
Explicitly use a const reference to this.
|
inline |
|
inline |
Get iterator at first item (const).
|
inline |
|
inline |
|
inline |
Clear by removing all items.
|
inline |
Comparison.
| data | Data to compare to |
Set as full (unshared) copy using data pointer (modifier).
| data | Data to copy |
|
inline |
Get data pointer for direct access (const).
|
inline |
|
inline |
|
inline |
|
inline |
Get iterator at end (const).
Find first occurrence of item with forward search.
| value | Value to find |
| start | Starting index for search |
| end | End index for search, END for end of list |
Find last occurrence of item with reverse search.
| value | Item to find |
| start | Starting index for search range – last item checked in reverse search |
| end | End index for search range (reverse search starting point), END for end of list |
|
inline |
Get first non-null item (const).
Get item value for key, creating if needed (mutable).
| key | Key (index) to use |
| created | Stores whether new item was created, if not NULL |
Get item for key, creating if needed (mutable).
| key | Key (index) to use |
| created | Stores whether new item was created, if not NULL |
Get index for last item position using offset.
| offset | Offset from end, 0 for last item, 1 for second-last, etc |
Get item at position (const).
| index | Item index |
Get item at position (mutable).
| index | Item index |
|
inline |
Get last non-null item (const).
|
inline |
Get whether null.
|
inline |
Inequality operator.
| data | Data to compare to |
Get item at position (mutable).
| index | Item index |
Move assignment operator (C++11).
| src | Source to move |
Assignment operator.
| data | Data to copy |
|
inline |
Equality operator.
| data | Data to compare to |
Get item at position (const).
| index | Item index |
Remove item and set as null (modifier).
| key | Item key (index) to remove |
Resize while preserving existing data (modifier).
| newsize | New size as item count |
Resize to minimum size while preserving existing data (modifier).
| minsize | Minimum size as item count |
|
inline |
Set as null and empty.
Set from another list.
| data | Data to set/copy |
|
inline |
Set as empty but not null.
|
inline |
Get whether shared.
|
inline |
Get list size.
|
inline |
Swap with another list.
| list | List to swap with |
|
inline |
Make sure data is not shared by allocating new buffer if needed (modifier).
|
inline |
Get list used size, number of non-null items.
|
protected |
Data pointer, NULL if null, can be 1 if empty (size_=0)
|
protected |
Data header pointer, NULL if no buffer allocated.
|
protected |
Data size (same as header.size), 0 if empty.
1.8.13