#include <generatorseq.h>
Public Member Functions | |
virtual void | append (const Item &data) |
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 |
virtual bool | empty () const |
Tells if the series is empty. | |
virtual const Item & | front () const |
Returns the first element of the sequence. | |
virtual void | gcMark (uint32 gen) |
GeneratorSeq (const GeneratorSeq &other) | |
GeneratorSeq (VMachine *runEvn, const Item &callable) | |
virtual void | prepend (const Item &data) |
Prepend an item at the beginning of the sequence. | |
virtual | ~GeneratorSeq () |
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 | prev (Iterator &iter) const |
Falcon::GeneratorSeq::GeneratorSeq | ( | const GeneratorSeq & | other | ) |
virtual Falcon::GeneratorSeq::~GeneratorSeq | ( | ) | [virtual] |
virtual void Falcon::GeneratorSeq::append | ( | const Item & | data | ) | [virtual] |
virtual const Item& Falcon::GeneratorSeq::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::GeneratorSeq::clear | ( | ) | [virtual] |
virtual FalconData* Falcon::GeneratorSeq::clone | ( | ) | const [virtual] |
Implements Falcon::FalconData.
virtual void Falcon::GeneratorSeq::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.
virtual bool Falcon::GeneratorSeq::empty | ( | ) | const [virtual] |
Tells if the series is empty.
Implements Falcon::Sequence.
virtual bool Falcon::GeneratorSeq::equalIterator | ( | const Iterator & | first, | |
const Iterator & | second | |||
) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual void Falcon::GeneratorSeq::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.
virtual const Item& Falcon::GeneratorSeq::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::GeneratorSeq::gcMark | ( | uint32 | gen | ) | [virtual] |
Reimplemented from Falcon::Sequence.
Implements Falcon::Sequence.
Implements Falcon::Sequence.
virtual void Falcon::GeneratorSeq::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::GeneratorSeq::hasCurrent | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::GeneratorSeq::hasNext | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::GeneratorSeq::hasPrev | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual void Falcon::GeneratorSeq::insert | ( | Iterator & | iter, | |
const Item & | data | |||
) | [protected, virtual] |
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.
virtual bool Falcon::GeneratorSeq::next | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual void Falcon::GeneratorSeq::prepend | ( | const Item & | data | ) | [virtual] |
virtual bool Falcon::GeneratorSeq::prev | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.