#include <lineardict.h>
Public Member Functions | |
void | allocated (uint32 size) |
uint32 | allocated () const |
virtual void | append (const Item &item) |
Append an item at the end of the sequence. | |
virtual const Item & | back () const |
Returns the first element of the sequence. | |
virtual void | clear () |
Removes all the items in the sequence. | |
virtual FalconData * | clone () const |
LinearDictEntry * | elementAt (uint32 pos) const |
virtual bool | empty () const |
Tells if the series is empty. | |
void | entries (LinearDictEntry *d) |
LinearDictEntry * | entries () const |
uint32 | esize (uint32 num) const |
bool | find (const Item &key, uint32 &ret_pos) const |
virtual Item * | find (const Item &key) const |
virtual bool | findIterator (const Item &key, Iterator &iter) |
virtual const Item & | front () const |
Returns the first element of the sequence. | |
virtual void | gcMark (uint32 gen) |
void | length (uint32 size) |
virtual uint32 | length () const |
LinearDict (uint32 prealloc) | |
LinearDict () | |
virtual void | merge (const ItemDict &dict) |
virtual void | prepend (const Item &item) |
Prepend an item at the beginning of the sequence. | |
virtual void | put (const Item &key, const Item &value) |
virtual bool | remove (const Item &key) |
virtual void | smartInsert (const Iterator &iter, const Item &key, const Item &value) |
~LinearDict () | |
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 |
Falcon::LinearDict::LinearDict | ( | ) |
Falcon::LinearDict::LinearDict | ( | uint32 | prealloc | ) |
Falcon::LinearDict::~LinearDict | ( | ) |
void Falcon::LinearDict::allocated | ( | uint32 | size | ) | [inline] |
uint32 Falcon::LinearDict::allocated | ( | ) | const [inline] |
virtual void Falcon::LinearDict::append | ( | const Item & | data | ) | [virtual] |
virtual const Item& Falcon::LinearDict::back | ( | ) | const [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::LinearDict::clear | ( | ) | [virtual] |
virtual FalconData* Falcon::LinearDict::clone | ( | ) | const [virtual] |
Implements Falcon::FalconData.
virtual void Falcon::LinearDict::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.
LinearDictEntry* Falcon::LinearDict::elementAt | ( | uint32 | pos | ) | const [inline] |
virtual bool Falcon::LinearDict::empty | ( | ) | const [virtual] |
Tells if the series is empty.
Implements Falcon::Sequence.
void Falcon::LinearDict::entries | ( | LinearDictEntry * | d | ) | [inline] |
LinearDictEntry* Falcon::LinearDict::entries | ( | ) | const [inline] |
virtual bool Falcon::LinearDict::equalIterator | ( | const Iterator & | first, | |
const Iterator & | second | |||
) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual void Falcon::LinearDict::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.
Implements Falcon::ItemDict.
Implements Falcon::ItemDict.
virtual const Item& Falcon::LinearDict::front | ( | ) | const [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::LinearDict::gcMark | ( | uint32 | gen | ) | [virtual] |
Reimplemented from Falcon::Sequence.
Implements Falcon::Sequence.
Implements Falcon::Sequence.
virtual void Falcon::LinearDict::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::LinearDict::hasCurrent | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::LinearDict::hasNext | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::LinearDict::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::LinearDict::length | ( | uint32 | size | ) | [inline] |
virtual uint32 Falcon::LinearDict::length | ( | ) | const [virtual] |
Implements Falcon::ItemDict.
virtual void Falcon::LinearDict::merge | ( | const ItemDict & | dict | ) | [virtual] |
Implements Falcon::ItemDict.
virtual bool Falcon::LinearDict::next | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::LinearDict::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::LinearDict::prepend | ( | const Item & | data | ) | [virtual] |
virtual bool Falcon::LinearDict::prev | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
Implements Falcon::ItemDict.
virtual bool Falcon::LinearDict::remove | ( | const Item & | key | ) | [virtual] |
Implements Falcon::ItemDict.
virtual void Falcon::LinearDict::smartInsert | ( | const Iterator & | iter, | |
const Item & | key, | |||
const Item & | value | |||
) | [virtual] |
Implements Falcon::ItemDict.