#include <itemarray.h>
Public Member Functions | |
void | allocated (uint32 size) |
uint32 | allocated () const |
virtual void | append (const Item &ndata) |
Append an item at the end of the sequence. | |
virtual Item & | at (int32 pos) |
virtual const Item & | at (int32 pos) const |
virtual const Item & | back () const |
Returns the first element of the sequence. | |
bool | change (const ItemArray &other, int32 begin, int32 end) |
virtual void | clear () |
Removes all the items in the sequence. | |
virtual FalconData * | clone () const |
void | compact () |
Reduce the memory used by this array to exactly its size. | |
bool | copyOnto (const ItemArray &src, uint32 first=0, uint32 amount=0xFFFFFFFF) |
Copy part or all of another vector on this vector. | |
bool | copyOnto (uint32 from, const ItemArray &src, uint32 first=0, uint32 amount=0xFFFFFFFF) |
Copy part or all of another vector on this vector. | |
void | elements (Item *d) |
Item * | elements () const |
virtual bool | empty () const |
Tells if the series is empty. | |
int32 | esize (int32 count=1) const |
An inline utility to compute element size. | |
int32 | find (const Item &itm) const |
virtual const Item & | front () const |
Returns the first element of the sequence. | |
virtual void | gcMark (uint32 mark) |
bool | insert (const ItemArray &other, int32 pos) |
bool | insert (const Item &ndata, int32 pos) |
bool | insertSpace (uint32 pos, uint32 size) |
ItemArray (uint32 prealloc) | |
ItemArray (const ItemArray &other) | |
ItemArray () | |
void | length (uint32 size) |
uint32 | length () const |
void | merge (const ItemArray &other) |
void | merge_front (const ItemArray &other) |
const Item & | operator[] (int32 pos) const throw () |
Item & | operator[] (int32 pos) throw () |
ItemArray * | partition (int32 start, int32 end) const |
virtual void | prepend (const Item &ndata) |
Prepend an item at the beginning of the sequence. | |
bool | remove (int32 first, int32 last) |
bool | remove (int32 pos) |
void | reserve (uint32 size) |
void | resize (uint32 size) |
virtual | ~ItemArray () |
Protected Member Functions | |
virtual void | copyIterator (Iterator &tgt, const Iterator &source) const |
Copy an iterator so that the two points to the same item. | |
virtual bool | equalIterator (const Iterator &first, const Iterator &second) const |
virtual void | erase (Iterator &iter) |
Deletes the element at position indicated by the iterator. | |
virtual Item & | getCurrent (const Iterator &iter) |
virtual Item & | getCurrentKey (const Iterator &iter) |
virtual void | getIterator (Iterator &tgt, bool tail=false) const |
Gets an Iterator valid for this sequence. | |
virtual bool | hasCurrent (const Iterator &iter) const |
virtual bool | hasNext (const Iterator &iter) const |
virtual bool | hasPrev (const Iterator &iter) const |
virtual void | insert (Iterator &iter, const Item &data) |
Inserts an element in a position indicated by the iterator. | |
virtual bool | next (Iterator &iter) const |
virtual bool | onCriterion (Iterator *elem) const |
Criterion called back by disposeIteratorOnCriterion(). | |
virtual bool | prev (Iterator &iter) const |
Friends | |
class | CoreArray |
class | CoreTable |
Falcon::ItemArray::ItemArray | ( | ) |
Falcon::ItemArray::ItemArray | ( | const ItemArray & | other | ) |
Falcon::ItemArray::ItemArray | ( | uint32 | prealloc | ) |
virtual Falcon::ItemArray::~ItemArray | ( | ) | [virtual] |
void Falcon::ItemArray::allocated | ( | uint32 | size | ) | [inline] |
uint32 Falcon::ItemArray::allocated | ( | ) | const [inline] |
virtual void Falcon::ItemArray::append | ( | const Item & | data | ) | [virtual] |
virtual const Item& Falcon::ItemArray::back | ( | ) | const [inline, virtual] |
Returns the first element of the sequence.
If the sequence has not an underlying storage, it may generate a temporary item, as the item is immediately copied into some destination by the caller.
This method is never used by the engine to modify the underlying item.
Guarantees are taken so that this method is never called when v_empty() returns false.
Implements Falcon::Sequence.
virtual void Falcon::ItemArray::clear | ( | ) | [inline, virtual] |
virtual FalconData* Falcon::ItemArray::clone | ( | ) | const [virtual] |
Implements Falcon::FalconData.
void Falcon::ItemArray::compact | ( | ) |
Reduce the memory used by this array to exactly its size.
virtual void Falcon::ItemArray::copyIterator | ( | Iterator & | tgt, | |
const Iterator & | source | |||
) | const [protected, virtual] |
Copy an iterator so that the two points to the same item.
The source iterator may point to the past-end element, but must not be invalid.
Reimplemented from Falcon::Sequence.
bool Falcon::ItemArray::copyOnto | ( | const ItemArray & | src, | |
uint32 | first = 0 , |
|||
uint32 | amount = 0xFFFFFFFF | |||
) | [inline] |
Copy part or all of another vector on this vector.
Shortcut for copyOnto starting from element 0 of this vector.
src | The source array | |
first | The first element in the array to be copied. | |
amount | Number of elements to be copied. |
bool Falcon::ItemArray::copyOnto | ( | uint32 | from, | |
const ItemArray & | src, | |||
uint32 | first = 0 , |
|||
uint32 | amount = 0xFFFFFFFF | |||
) |
Copy part or all of another vector on this vector.
This method performs a flat copy of another array into this one. It is possible to copy part of the target array, specifying the first and amount parameters. Also, it's possible to select a starting position different from the beginning through the from parameter.
If the from parameter is larger than the size of this array, or if the first parameter is larger than the size of the source array, the function returns false.
If the required amount of items to be copied is greater than the number of items in the source array (starting from the first), then it's rounded down to copy all the items starting from first.
If this array is not large enough to store all the items starting from the from parameter, it is enlarged.
from | The first item from which to start copying. | |
src | The source array | |
first | The first element in the array to be copied. | |
amount | Number of elements to be copied. |
void Falcon::ItemArray::elements | ( | Item * | d | ) | [inline] |
Item* Falcon::ItemArray::elements | ( | ) | const [inline] |
virtual bool Falcon::ItemArray::empty | ( | ) | const [inline, virtual] |
Tells if the series is empty.
Implements Falcon::Sequence.
virtual bool Falcon::ItemArray::equalIterator | ( | const Iterator & | first, | |
const Iterator & | second | |||
) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual void Falcon::ItemArray::erase | ( | Iterator & | iter | ) | [protected, virtual] |
Deletes the element at position indicated by the iterator.
The implementation must check that the iterator is a valid iterator created by this object and pointing to a valid position.
Deletion happens at given position, shifting all the remaining elements backward; after a successful erase, the iterator must point to the element that was previously next in the series, or must be invalidated if the removed element was the last.
If the sequence is empty or the iterator is invalid, an AccessError must be thrown. If the iterator is referencing another sequence, a CodeError must be thrown.
iter | an iterator (possibly invalid or not generated by this class). |
Implements Falcon::Sequence.
An inline utility to compute element size.
count | numbrer of elements |
virtual const Item& Falcon::ItemArray::front | ( | ) | const [inline, virtual] |
Returns the first element of the sequence.
If the sequence has not an underlying storage, it may generate a temporary item, as the item is immediately copied into some destination by the caller.
Guarantees are taken so that this method is never called when v_empty() returns false.
Implements Falcon::Sequence.
virtual void Falcon::ItemArray::gcMark | ( | uint32 | mark | ) | [virtual] |
Reimplemented from Falcon::Sequence.
Implements Falcon::Sequence.
Implements Falcon::Sequence.
virtual void Falcon::ItemArray::getIterator | ( | Iterator & | tgt, | |
bool | tail = false | |||
) | const [protected, virtual] |
Gets an Iterator valid for this sequence.
If you need an iterator as a pointer or in the target stack, use Iterator( Sequence*, bool) instead.
The iterator constructor calls back this method to be configured.
It is possible to call this method thereafter to reset the iterator, even if it's gone invalid.
However, it is not legal to call this method with an iterator coming from another sequence; this will cause the program to throw a CodeError.
An | Iterator to be set. | |
tail | if false, get an iterator to the first element, else get an iterator to the last element. |
Reimplemented from Falcon::Sequence.
virtual bool Falcon::ItemArray::hasCurrent | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::ItemArray::hasNext | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::ItemArray::hasPrev | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
Inserts an element in a position indicated by the iterator.
The implementation must check that the iterator is a valid iterator created by this object and pointing to a valid position.
Insertion happens at given position, shifting all the remaining elements forward; after a successful insert, the iterator must point to the newly inserted element, and the previously current element is found safely in the next() position of the iterator.
Valid iterators (generated by this owner) pointing to invalid positions must be treated as pointing to last-past-one element; insertion causes append on tail, and at return they must be valid and point to the last valid element (the one just inserted).
If the iterator cannot be used, for example because their owner is not this item, this method will raise a CodeError.
iterator | an iterator. | |
data | the item to be inserted |
Implements Falcon::Sequence.
void Falcon::ItemArray::length | ( | uint32 | size | ) | [inline] |
uint32 Falcon::ItemArray::length | ( | ) | const [inline] |
void Falcon::ItemArray::merge | ( | const ItemArray & | other | ) |
void Falcon::ItemArray::merge_front | ( | const ItemArray & | other | ) |
virtual bool Falcon::ItemArray::next | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::ItemArray::onCriterion | ( | Iterator * | elem | ) | const [protected, virtual] |
Criterion called back by disposeIteratorOnCriterion().
Return true to remove this iterator, false to let it alive. Disposed iterators are removed from the iterator list of this sequence and invalidated.
Reimplemented from Falcon::Sequence.
virtual void Falcon::ItemArray::prepend | ( | const Item & | data | ) | [virtual] |
virtual bool Falcon::ItemArray::prev | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
bool Falcon::ItemArray::remove | ( | int32 | pos | ) |
void Falcon::ItemArray::reserve | ( | uint32 | size | ) |
void Falcon::ItemArray::resize | ( | uint32 | size | ) |
friend class CoreArray [friend] |
friend class CoreTable [friend] |