Evo C++ Library v0.5.1
|
#include <evo/sublist.h>
Reference and access existing list data.
T | Item type to use |
TSize | Size type to use for size/index values (must be unsigned integer) – default: SizeT |
C++11:
Output:
Public Types | |
typedef void | EvoContainerType |
Identify Evo container type. More... | |
typedef T | Item |
Item type (same as Value) More... | |
typedef DataCopy< T >::PassType | ItemVal |
Item type as parameter (POD types passed by value, otherwise by const-ref) More... | |
typedef IteratorRa< ThisType >::Const | Iter |
Iterator (const) - IteratorRa. More... | |
typedef Size | Key |
Key type (item index) More... | |
typedef ListBase< T, Size > | ListBaseType |
List base type for any Evo list More... | |
typedef TSize | Size |
List size integer type. More... | |
typedef SubList< T, Size > | SubListType |
SubList base type More... | |
typedef SubList< T, Size > | ThisType |
This list type. More... | |
typedef T | Value |
Value type (same as Item) More... | |
Public Member Functions | |
SubList () | |
Default constructor sets as null. More... | |
SubList (const ThisType &data) | |
Copy constructor to reference source data. More... | |
SubList (const ListBaseType &data) | |
Copy constructor to reference source data. More... | |
SubList (const ListBaseType &data, Key index, Size size=ALL) | |
Copy constructor to reference source data. More... | |
SubList (const ListBaseType *data) | |
Copy constructor to reference source data from pointer. More... | |
SubList (const Item *data, Size size) | |
Constructor to reference data pointer. More... | |
SubList (const Item *data, ValNull v, ItemVal term=0) | |
Constructor to reference terminated data pointer. More... | |
SubList (ThisType &&src) | |
Move constructor (C++11). More... | |
const ThisType & | asconst () const |
Explicitly use a const reference to this. 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 ListBaseType &data) const |
Comparison. More... | |
bool | contains (ItemVal item) const |
Check whether contains given item. More... | |
bool | contains (const Item *data, Size size) const |
Check if contains given data. More... | |
bool | contains (const ListBaseType &data) const |
Check if contains given data. More... | |
const Item * | data () const |
Get data pointer. More... | |
bool | empty () const |
Get whether empty. More... | |
Iter | end () const |
Get iterator at end (const). More... | |
bool | ends (ItemVal item) const |
Check if this ends with given item. More... | |
bool | ends (const Item *items, Size size) const |
Check if this ends with given items. More... | |
bool | ends (const ListBaseType &items) const |
Check if this ends with given items. More... | |
Key | find (ItemVal item, Key start=0, Key end=END) const |
Find first occurrence of item with forward search. More... | |
Key | findany (const Item *items, Size count, Key start=0, Key end=END) const |
Find first occurrence of any given items with forward search. More... | |
Key | findanyr (const Item *items, Size count, Key start=0, Key end=END) const |
Find last occurrence of any given items with reverse search. More... | |
Key | findr (ItemVal item, Key start=0, Key end=END) const |
Find last occurrence of item with reverse search. More... | |
const Item * | first () const |
Get first item (const). More... | |
ulong | hash (ulong seed=0) const |
Get data hash value. More... | |
Key | iend (Size offset=0) const |
Get index from last item using offset. More... | |
const Item & | item (Key index) const |
Get item at position. More... | |
const Item * | last () const |
Get last item (const). More... | |
bool | null () const |
Get whether null. More... | |
bool | operator!= (const ListBaseType &data) const |
Inequality operator. More... | |
ThisType & | operator= (ThisType &&src) |
Move assignment operator (C++11). More... | |
ThisType & | operator= (const ThisType &src) |
Assignment operator. More... | |
ThisType & | operator= (const ValNull &val) |
Assignment operator sets as null. More... | |
ThisType & | operator= (const ValEmpty &val) |
Assignment operator sets as null. More... | |
ThisType & | operator= (const ListBaseType &data) |
Assignment operator sets as reference to source data. More... | |
ThisType & | operator= (const ListBaseType *data) |
Assignment operator sets as reference to source data from pointer. More... | |
bool | operator== (const ListBaseType &data) const |
Equality operator. More... | |
const Item & | operator[] (Key index) const |
Get item at position. More... | |
ThisType & | set () |
Set as null. More... | |
ThisType & | set (const ListBaseType &data) |
Set as reference to source data. More... | |
ThisType & | set (const ListBaseType &data, Key index, Key size=ALL) |
Set as reference to source data. More... | |
ThisType & | set (const ListBaseType *data) |
Set as reference to source data by pointer. More... | |
ThisType & | set (const Item *data, Size size) |
Set as reference to data pointer. More... | |
ThisType & | set2 (const ListBaseType &data, Key index1, Key index2) |
Set as reference to subset of source data using start/end positions. More... | |
ThisType & | setempty () |
Set as empty but not null. More... | |
bool | shared () const |
Get whether shared (false). More... | |
Size | size () const |
Get size. More... | |
ThisType & | slice (Key index) |
Slice beginning items. More... | |
ThisType & | slice (Key index, Size size) |
Slice to given subset. More... | |
ThisType & | slice2 (Key index1, Key index2) |
Slice to given subset using start/end positions. More... | |
template<class T1 , class T2 > | |
bool | splitat (Key index, T1 &left, T2 &right) const |
Split into left/right sublists at index. More... | |
template<class T1 > | |
bool | splitat (Key index, T1 &left) const |
Split into left sublist at index. More... | |
template<class T2 > | |
bool | splitat (Key index, ValNull left, T2 &right) const |
Split into right sublist at index. More... | |
bool | splitat_setl (Key index) |
Split at index and set as left sublist. More... | |
template<class T2 > | |
bool | splitat_setl (Key index, T2 &right) |
Split at index, set as left sublist, and save right sublist. More... | |
bool | splitat_setr (Key index) |
Split at index and set as right sublist. More... | |
template<class T1 > | |
bool | splitat_setr (Key index, T1 &left) |
Split at index, set as right sublist, and save left sublist. More... | |
bool | starts (ItemVal item) const |
Check if this starts with given item. More... | |
bool | starts (const Item *items, Size size) const |
Check if starts with given items. More... | |
bool | starts (const ListBaseType &items) const |
Check if this starts with given items. More... | |
void | swap (ThisType &list) |
Swap with another sublist. More... | |
ThisType & | triml (Size size) |
Trim left (beginning) items. More... | |
ThisType & | trimr (Size size) |
Trim right (ending) items. More... | |
ThisType & | truncate (Size size) |
Truncate to given size. More... | |
ThisType & | unshare () |
Make data unique – no-op. More... | |
Public Attributes | |
T * | data_ |
Data pointer, NULL if null. More... | |
TSize | size_ |
Data size as item count, 0 if empty or null. More... | |
typedef void EvoContainerType |
Identify Evo container type.
typedef T Item |
Item type (same as Value)
Item type as parameter (POD types passed by value, otherwise by const-ref)
typedef IteratorRa<ThisType>::Const Iter |
Iterator (const) - IteratorRa.
typedef ListBase<T,Size> ListBaseType |
List base type for any Evo list
typedef SubList<T,Size> SubListType |
SubList base type
typedef T Value |
Value type (same as Item)
|
inline |
Default constructor sets as null.
Copy constructor to reference source data.
data | Data to reference |
|
inline |
Copy constructor to reference source data.
data | Data to reference |
|
inline |
Copy constructor to reference source data.
data | Data to reference |
index | Start index of data to reference, END to set as empty |
size | Size as item count, ALL for all from index |
|
inline |
Copy constructor to reference source data from pointer.
data | Data pointer to reference, calls set() if NULL |
Constructor to reference data pointer.
data | Data to reference |
size | Data size as item count |
Constructor to reference terminated data pointer.
data | Data to reference |
v | vNULL to indicate data is terminated |
term | Terminator to use (defaults to NULL) |
|
inline |
Explicitly use a const reference to this.
|
inline |
|
inline |
|
inline |
|
inline |
Clear by removing all items.
|
inline |
Comparison.
data | Data to compare to |
|
inline |
Check whether contains given item.
item | Item to check for |
Check if contains given data.
data | Data to check for |
size | Size as item count to check for |
|
inline |
Check if contains given data.
data | Data to check for |
|
inline |
Get data pointer.
|
inline |
|
inline |
|
inline |
Check if this ends with given item.
item | Item to check |
Check if this ends with given items.
items | Items to check |
size | Item count to check |
|
inline |
Check if this ends with given items.
items | Items to check |
Find first occurrence of item with forward search.
item | Item to find |
start | Starting index for search |
end | End index for search, END for end of list |
Find first occurrence of any given items with forward search.
items | Items to search for |
count | Count of items to search for |
start | Starting index for search |
end | End index for search, END for end of list |
Find last occurrence of any given items with reverse search.
items | Items to search for |
count | Count of items to search for |
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 |
Find last occurrence of item with reverse search.
item | 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 item (const).
|
inline |
Get data hash value.
seed | Seed value for hashing multiple values, 0 if none |
Get index from last item using offset.
offset | Offset from end, 0 for last item, 1 for second-last, etc |
Get item at position.
index | Item index |
|
inline |
Get last item (const).
|
inline |
Get whether null.
|
inline |
Inequality operator.
data | Data to compare to |
Move assignment operator (C++11).
src | Source to move |
Assignment operator.
src | Source to copy |
Assignment operator sets as null.
val | vNULL |
Assignment operator sets as null.
val | vEMPTY |
|
inline |
Assignment operator sets as reference to source data.
data | Data to reference |
|
inline |
Assignment operator sets as reference to source data from pointer.
data | Data pointer to reference, calls set() if NULL |
|
inline |
Equality operator.
data | Data to compare to |
Get item at position.
index | Item index |
|
inline |
Set as null.
|
inline |
Set as reference to source data.
data | Data to reference |
|
inline |
Set as reference to source data.
data | Data to reference |
index | Start index of data to reference, END to set as empty |
size | Size as item count, ALL for all from index |
|
inline |
Set as reference to source data by pointer.
data | Pointer to data to reference, null if NULL |
Set as reference to data pointer.
data | Data to reference |
size | Data size as item count |
|
inline |
Set as reference to subset of source data using start/end positions.
data | Data to reference |
index1 | Start index of data to reference, END to set as empty |
index2 | End index of data (this item not included), END for all after index1 |
|
inline |
Set as empty but not null.
|
inline |
Get whether shared (false).
|
inline |
Get size.
Slice beginning items.
index | Start index of new slice, END to set as empty (or leave null if null) |
Slice to given subset.
index | Start index of new slice, END to set as empty (or leave null if null) |
size | Slice size as item count, ALL for all from index |
Slice to given subset using start/end positions.
index1 | Start index of new slice, END to set as empty (or leave null if null) |
index2 | End index of new slice (this item not included), END for all after index1 |
|
inline |
Split into left/right sublists at index.
T1 | List type to store left sublist |
T2 | List type to store right sublist |
index | Index to split at, bad index (NONE or out-of-bounds) splits at end |
left | Set to sublist before index, set to this if bad index [out] |
right | Set to sublist after index, null if bad index [out] |
|
inline |
Split into left sublist at index.
T1 | List type to store left sublist |
index | Index to split at, bad index (NONE or out-of-bounds) splits at end |
left | Set to sublist before index, set to this if bad index [out] |
Split into right sublist at index.
T2 | List type to store right sublist |
index | Index to split at, bad index (NONE or out-of-bounds) splits at end |
left | vNULL (ignored) |
right | Set to sublist after index, null if bad index [out] |
|
inline |
Split at index and set as left sublist.
index | Index to split at, bad index (NONE or out-of-bounds) splits at end (i.e. unchanged) |
|
inline |
Split at index, set as left sublist, and save right sublist.
index | Index to split at, bad index (NONE or out-of-bounds) splits at end (i.e. unchanged) |
right | Set to sublist after index, null if bad index [out] |
|
inline |
|
inline |
Split at index, set as right sublist, and save left sublist.
index | Index to split at, bad index (NONE or out-of-bounds) splits at end |
left | Set to sublist before index, set to this if bad index [out] |
|
inline |
Check if this starts with given item.
item | Item to check |
Check if starts with given items.
items | Items to check |
size | Size as item count to check |
|
inline |
Check if this starts with given items.
items | Items to check |
|
inline |
Swap with another sublist.
list | List to swap with |
Trim left (beginning) items.
size | Trim size as item count to remove |
Trim right (ending) items.
size | Trim size as item count to remove |
Truncate to given size.
size | Size to truncate to as item count |
|
inline |
Make data unique – no-op.
|
inherited |
Data pointer, NULL if null.
|
inherited |
Data size as item count, 0 if empty or null.