#include <coretable.h>
Public Types | |
enum | { noitem = 0xFFFFFFFF } |
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. | |
numeric * | biddings () const |
Returns bidding results. | |
uint32 | biddingsSize () const |
Returns max size of the biddings array. | |
virtual void | clear () |
Removes all the raws in the current page. | |
virtual FalconData * | clone () const |
Deletes the list. | |
void | columnData (uint32 pos, const Item &data) |
Sets nth column-wide data in the table. | |
Item & | columnData (uint32 pos) |
Returns nth column-wide data in the table. | |
const Item & | columnData (uint32 pos) const |
Returns nth column-wide data in the table (const). | |
CoreTable (const CoreTable &other) | |
CoreTable () | |
CoreArray * | currentPage () const |
uint32 | currentPageId () const |
virtual bool | empty () const |
Tells if the list is empty. | |
virtual const Item & | front () const |
Returns the first element of the sequence. | |
virtual void | gcMark (uint32 mark) |
Perform marking of items stored in the table. | |
Item * | getHeaderData (const String &name) const |
Item * | getHeaderData (uint32 pos) const |
uint32 | getHeaderPos (const String &name) const |
const String & | heading (uint32 pos) const |
Returns the nth heading (column title). | |
void | insertColumn (uint32 pos, const String &name, const Item &data, const Item &dflt) |
Inserts a colum in the table. | |
bool | insertPage (CoreObject *self, CoreArray *data, uint32 pos=noitem) |
Inserts a page. | |
bool | insertRow (CoreArray *ca, uint32 pos=noitem, uint32 page=noitem) |
Inserts a new row in a page. | |
uint32 | order () const |
Returns the order (number of colums) in the table. | |
CoreArray * | page (uint32 num) const |
uint32 | pageCount () const |
virtual void | prepend (const Item &data) |
Prepend an item at the beginning of the sequence. | |
bool | removeColumn (uint32 pos) |
Removes a colum from the table. | |
bool | removePage (uint32 pos) |
Removes a page. | |
bool | removeRow (uint32 pos, uint32 page=noitem) |
Removes a row. | |
void | renameColumn (uint32 pos, const String &name) |
Rename a colunm. | |
void | reserveBiddings (uint32 size) |
bool | setCurrentPage (uint32 num) |
bool | setHeader (CoreArray *header) |
virtual | ~CoreTable () |
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::CoreTable::CoreTable | ( | ) |
Falcon::CoreTable::CoreTable | ( | const CoreTable & | other | ) |
virtual Falcon::CoreTable::~CoreTable | ( | ) | [virtual] |
virtual void Falcon::CoreTable::append | ( | const Item & | data | ) | [virtual] |
virtual const Item& Falcon::CoreTable::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.
numeric* Falcon::CoreTable::biddings | ( | ) | const [inline] |
Returns bidding results.
Must be initialized with makebiddings().
uint32 Falcon::CoreTable::biddingsSize | ( | ) | const [inline] |
Returns max size of the biddings array.
virtual void Falcon::CoreTable::clear | ( | ) | [virtual] |
virtual FalconData* Falcon::CoreTable::clone | ( | ) | const [virtual] |
Sets nth column-wide data in the table.
Using an incorrect (greater than order) position parameter will crash.
References fassert, order(), and Falcon::GenericVector::set().
Returns nth column-wide data in the table.
Using an incorrect (greater than order) position parameter will crash.
References Falcon::GenericVector::at(), fassert, and order().
Returns nth column-wide data in the table (const).
Using an incorrect (greater than order) position parameter will crash.
References Falcon::GenericVector::at(), fassert, and order().
virtual void Falcon::CoreTable::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.
CoreArray* Falcon::CoreTable::currentPage | ( | ) | const [inline] |
uint32 Falcon::CoreTable::currentPageId | ( | ) | const [inline] |
virtual bool Falcon::CoreTable::empty | ( | ) | const [inline, virtual] |
Tells if the list is empty.
Implements Falcon::Sequence.
References Falcon::CoreArray::length().
virtual bool Falcon::CoreTable::equalIterator | ( | const Iterator & | first, | |
const Iterator & | second | |||
) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual void Falcon::CoreTable::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::CoreTable::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::CoreTable::gcMark | ( | uint32 | mark | ) | [virtual] |
Implements Falcon::Sequence.
Implements Falcon::Sequence.
References getHeaderData(), getHeaderPos(), and noitem.
Referenced by getHeaderData().
Referenced by getHeaderData().
virtual void Falcon::CoreTable::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::CoreTable::hasCurrent | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::CoreTable::hasNext | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
virtual bool Falcon::CoreTable::hasPrev | ( | const Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
Returns the nth heading (column title).
Using an incorrect (greater than order) position parameter will crash.
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::CoreTable::insertColumn | ( | uint32 | pos, | |
const String & | name, | |||
const Item & | data, | |||
const Item & | dflt | |||
) |
Inserts a colum in the table.
This alters the heading and all the pages, inserting a row of default items (can be nil) as the new column.
If pos >= order, the column will be appended at end.
pos | The position where to add the column. | |
name | The name of the column to be inserted. | |
data | The column data, can be nil. | |
dflt | The default value for inserted items; can be nil. |
bool Falcon::CoreTable::insertPage | ( | CoreObject * | self, | |
CoreArray * | data, | |||
uint32 | pos = noitem | |||
) |
Inserts a page.
The function checks if the array is actually a matrix with an order compatible with the table.
self | The core object representing this table in the VM. | |
pos | Where to insert the page. If greater than the number of pages, or set to noitem, will append the page at the end. | |
array | An array to fill the page. Can be empty; otherwise, every element must be an array of the same order of this table. |
Inserts a new row in a page.
If the core array has not the same length of the order of this table, the function will fail.
pos | The position at which to insert the row; will add it if position >= length. | |
ca | The array to be added. | |
page | The page into which the row must be added, set |
virtual bool Falcon::CoreTable::next | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
uint32 Falcon::CoreTable::order | ( | ) | const [inline] |
References Falcon::GenericVector::at(), and Falcon::GenericVector::size().
uint32 Falcon::CoreTable::pageCount | ( | ) | const [inline] |
References Falcon::GenericVector::size().
virtual void Falcon::CoreTable::prepend | ( | const Item & | data | ) | [virtual] |
virtual bool Falcon::CoreTable::prev | ( | Iterator & | iter | ) | const [protected, virtual] |
Implements Falcon::Sequence.
bool Falcon::CoreTable::removeColumn | ( | uint32 | pos | ) |
Removes a colum from the table.
This alters the heading and all the pages, removing the item at given position in all the arrays in every page.
pos | The index of the column to be removed. |
bool Falcon::CoreTable::removePage | ( | uint32 | pos | ) |
Removes a page.
pos | Which page to remove. |
Removes a row.
pos | The position at which to remove the row. | |
page | The page into which the row must be remove, set |
Rename a colunm.
pos | Column to be renamed. | |
name | The new name for the given column. |
void Falcon::CoreTable::reserveBiddings | ( | uint32 | size | ) |
bool Falcon::CoreTable::setCurrentPage | ( | uint32 | num | ) | [inline] |
References Falcon::GenericVector::at(), and Falcon::GenericVector::size().
bool Falcon::CoreTable::setHeader | ( | CoreArray * | header | ) |