Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Friends | List of all members
OfAttrTable Class Reference

Public Member Functions

 ~OfAttrTable (void)
 
 OfAttrTable (OfAttrTable &&other) noexcept
 
OfAttrTableoperator= (OfAttrTable &&other) noexcept
 
 OfAttrTable (void) noexcept
 
 OfAttrTable (const OfAttrTable &other)
 
OfAttrTableoperator= (const OfAttrTable &other)
 
bool operator== (const OfAttrTable &other) const
 
bool operator!= (const OfAttrTable &other) const
 
bool is_valid (bool check_rows=true) const
 
const OfObjectget_parent_object (void) const
 
const CoreStringget_name (void) const
 
CoreString get_full_name (void) const
 
const CoreVector< CoreVariant > & get_default_values (unsigned int column_index) const
 
unsigned int get_row_count (void) const
 
const CoreVariantget_metadata (CoreStringView data_name, unsigned int column_index=CORE_INVALID_INDEX) const
 
unsigned int get_column_count (void) const
 
const OfAttrget_column_attr (unsigned int column_index) const
 
CoreString get_column_title (unsigned int column_index) const
 
OfAttr::Type get_column_type (unsigned int column_index) const
 
unsigned int get_column_stride (unsigned int column_index) const
 
unsigned int get_column_index (const CoreBasicString &column_name) const
 
OfAttrTableState save_state (void)
 
void restore_state (const OfAttrTableState &state)
 
void asleep (void)
 
void awake (bool silent=false)
 
void clear (void)
 
bool can_revert (void) const
 
void revert (void)
 
void reset (void)
 
void set_localized (bool localized)
 
bool is_localized (void) const
 
bool is_overridden (void) const
 
void set_locked (bool locked)
 
bool is_locked (void) const
 
void set_hidden (bool hidden)
 
bool is_hidden (void) const
 
void add_row (unsigned int row_index=CORE_INVALID_INDEX)
 
void remove_row (unsigned int row_index=CORE_INVALID_INDEX)
 
void swap_rows (unsigned int first_index, unsigned int second_index)
 
void move_row (unsigned int from_index, unsigned int to_index)
 
void set_row_enabled (unsigned int row_index, bool enabled)
 
bool is_row_enabled (unsigned int row_index) const
 
CoreVector< CoreVariantget_row_values (unsigned int row_index) const
 
void set_row_values (unsigned int row_index, const CoreBasicArray< CoreVariant > &values)
 
CoreVector< CoreVariantget_cell_values (unsigned int row_index, unsigned int column_index) const
 
void set_cell_values (unsigned int row_index, unsigned int column_index, const CoreBasicArray< CoreVariant > &values)
 
CoreVariant get_cell_value (unsigned int row_index, unsigned int column_index, unsigned int value_index=0) const
 
void set_cell_value (unsigned int row_index, unsigned int column_index, const CoreVariant &value, unsigned int value_index=0)
 
bool get_bool (unsigned int row_index, unsigned int column_index, unsigned int value_index=0) const
 
double get_double (unsigned int row_index, unsigned int column_index, unsigned int value_index=0) const
 
long get_long (unsigned int row_index, unsigned int column_index, unsigned int value_index=0) const
 
CoreString get_string (unsigned int row_index, unsigned int column_index, unsigned int value_index=0) const
 
OfItemget_item (unsigned int row_index, unsigned int column_index, unsigned int value_index=0) const
 
GMathVec2d get_vec2d (unsigned int row_index, unsigned int column_index) const
 
GMathVec3d get_vec3d (unsigned int row_index, unsigned int column_index) const
 
GMathVec4d get_vec4d (unsigned int row_index, unsigned int column_index) const
 
GMathVec2f get_vec2f (unsigned int row_index, unsigned int column_index) const
 
GMathVec3f get_vec3f (unsigned int row_index, unsigned int column_index) const
 
GMathVec4f get_vec4f (unsigned int row_index, unsigned int column_index) const
 
GMathVec2i get_vec2i (unsigned int row_index, unsigned int column_index) const
 
GMathVec3i get_vec3i (unsigned int row_index, unsigned int column_index) const
 
GMathVec4i get_vec4i (unsigned int row_index, unsigned int column_index) const
 
void set_bool (unsigned int row_index, unsigned int column_index, bool value, unsigned int value_index=0)
 
void set_double (unsigned int row_index, unsigned int column_index, double value, unsigned int value_index=0)
 
void set_long (unsigned int row_index, unsigned int column_index, long value, unsigned int value_index=0)
 
void set_string (unsigned int row_index, unsigned int column_index, CoreString value, unsigned int value_index=0)
 
void set_vec2d (unsigned int row_index, unsigned int column_index, GMathVec2d value)
 
void set_vec3d (unsigned int row_index, unsigned int column_index, GMathVec3d value)
 
void set_vec4d (unsigned int row_index, unsigned int column_index, GMathVec4d value)
 
void set_vec2f (unsigned int row_index, unsigned int column_index, GMathVec2f value)
 
void set_vec3f (unsigned int row_index, unsigned int column_index, GMathVec3f value)
 
void set_vec4f (unsigned int row_index, unsigned int column_index, GMathVec4f value)
 
void set_vec2i (unsigned int row_index, unsigned int column_index, GMathVec2i value)
 
void set_vec3i (unsigned int row_index, unsigned int column_index, GMathVec3i value)
 
void set_vec4i (unsigned int row_index, unsigned int column_index, GMathVec4i value)
 

Friends

class OfCid
 
class OfObject
 
template<CommandType T>
class CmdEditTable
 

Detailed Description

This class is a interface to manipulate an attribute table. It operates on an active row and allow adding rows, removing them, swapping them, changing columns' content, etc.

Tables are defined a bit like groups in a cid file, and are accessible through OfObject instances.

Note
Instances of this class should never be stored, since they won't be notified if the column attributes they are using are deleted.
See Also
OfObject::get_table_count, OfObject::get_table

Constructor & Destructor Documentation

OfAttrTable::~OfAttrTable ( void  )

Destructor

OfAttrTable::OfAttrTable ( OfAttrTable &&  other)
inlinenoexcept

Move constructor

OfAttrTable::OfAttrTable ( void  )
inlinenoexcept

Default constructor. Construct an invalid attr table.

OfAttrTable::OfAttrTable ( const OfAttrTable other)

Copy constructor. Needed for Python bindings

Member Function Documentation

void OfAttrTable::add_row ( unsigned int  row_index = CORE_INVALID_INDEX)

Add a new row to the table.

Parameters
row_indexOptional index where to add (well, insert) the row. If no index is used (or the index is CORE_INVALID_INDEX) the row is appended to the end of the table.
void OfAttrTable::asleep ( void  )

Make all columns sleep

void OfAttrTable::awake ( bool  silent = false)

Awake all columns. If silent is true, all events that have been generated since the previous call to asleep will be discarded.

bool OfAttrTable::can_revert ( void  ) const

Returns whether the table can be reverted or not. Basically returns true if at least 1 of the columns can be reverted.

void OfAttrTable::clear ( void  )

Remove all rows and invalidate the current row index.

CoreVariant OfAttrTable::get_cell_value ( unsigned int  row_index,
unsigned int  column_index,
unsigned int  value_index = 0 
) const

Get a single value of a cell.

Parameters
row_indexIndex of the row
column_indexIndex of the column
value_indexIndex of the value in the cell, 0 by default.
Returns
The value of the cell as a variant
Note
If the column attribute is of type reference, it will return the raw reference. It means that if a traversal item (like a dot) is plugged in the cell, get_cell_value() will return this dot, and not the final item connected to this dot.
CoreVector< CoreVariant > OfAttrTable::get_cell_values ( unsigned int  row_index,
unsigned int  column_index 
) const

Get the values of a cell.

Parameters
row_indexIndex of the row
column_indexIndex of the column
Returns
The values of the cell as a vector of variants
Note
If the column attribute is of type reference, it will return the raw reference. It means that if a traversal item (like a dot) is plugged in a cell, get_cell_values will return this dot, and not the final item connected to this dot.
const OfAttr * OfAttrTable::get_column_attr ( unsigned int  column_index) const

Get a column attribute. Returns nullptr if the table is invalid or the column index out of bound.

unsigned int OfAttrTable::get_column_count ( void  ) const

Get the number of columns

unsigned int OfAttrTable::get_column_index ( const CoreBasicString column_name) const

Get the index of a column.

Parameters
column_nameName of the column
Returns
The index of the column if found, CORE_INVALID_INDEX otherwise
unsigned int OfAttrTable::get_column_stride ( unsigned int  column_index) const

Get the stride of a column. This is used when dealing with columns that have multiple values, such as colors, etc.

Parameters
column_indexIndex of the column to consider
Returns
The number of elements in the column (usually 1) and 0 if there was an error (out of bound column index, etc.)
CoreString OfAttrTable::get_column_title ( unsigned int  column_index) const

Get the name of a column in UI title style (using CoreString::make_title).

Parameters
column_indexIndex of the column to consider
Returns
The name of the column or an empty string if there was an error (out of bound column index, etc.).
OfAttr::Type OfAttrTable::get_column_type ( unsigned int  column_index) const

Get the type of a column. In case of an invalid OfAttrTable or out of bound column_index, the returned type if OfAttr::TYPE_COUNT

Parameters
column_indexIndex of the column to consider
Returns
The type of the elements in the column and OfAttr::TYPE_COUNT if there was an error (out of bound column index, etc.)
const CoreVector< CoreVariant > & OfAttrTable::get_default_values ( unsigned int  column_index) const

Get the default values for a column

CoreString OfAttrTable::get_full_name ( void  ) const

Get the full name of this table. This is the full path of the object owning this table followed by the table name, both being separated by a dot. For instance project://some_context/some_object.table_name

const CoreVariant & OfAttrTable::get_metadata ( CoreStringView  data_name,
unsigned int  column_index = CORE_INVALID_INDEX 
) const

Get optional metadata attached to the table of columns.

Parameters
data_nameName of the metadata. This is one of the keywords in OfCids (OfCids::KEYWORD_*)
column_indexOptional index of the column. Do not specify or use CORE_INVALID_INDEX to get metadata from the table.
Returns
The value associated to data_name or CoreVariant::null_value if there was none.
const CoreString & OfAttrTable::get_name ( void  ) const

Get the name of this table

const OfObject * OfAttrTable::get_parent_object ( void  ) const

Get the parent owning this table. Can return nullptr if the table is not valid.

unsigned int OfAttrTable::get_row_count ( void  ) const

Get the number of rows.

CoreVector< CoreVariant > OfAttrTable::get_row_values ( unsigned int  row_index) const

Get the values of a full row.

Parameters
row_indexThe index of the row to get the values of.
Note
If the column attribute is of type reference, it will return the raw reference. It means that if a traversal item (like a dot) is plugged in a cell, it will return this dot, and not the final item connected to this dot.
bool OfAttrTable::is_hidden ( void  ) const

Get the hidden state of the table.

bool OfAttrTable::is_localized ( void  ) const

Get the localized state of the table.

bool OfAttrTable::is_locked ( void  ) const

Get the locked state of the table.

bool OfAttrTable::is_overridden ( void  ) const

Get the overridden state of the table. Note that only a column can be overridden, in which case the whole table is considered overridden.

bool OfAttrTable::is_row_enabled ( unsigned int  row_index) const

Get the enabled state of a row.

Parameters
row_indexIndex of the row.
bool OfAttrTable::is_valid ( bool  check_rows = true) const

Returns true if this is a valid OfAttrTable instance. When an instance is not valid, calling any of its public method will have no effect whatsoever, but won't assert or log any error.

Note
All public methods of OfAttrTable that query or mutate its state are internally already checking is_valid() and do nothing if it's not, so users do not need to manually call this before manipulating a table.
Parameters
check_rowsOptional, true by default. When false, it only checks that the table has a valid private implementation (e.g. the column attributes in the cid actually exist on the object that returned this table) When true, it will additionally check that the columns of the table all have the same number of rows.
void OfAttrTable::move_row ( unsigned int  from_index,
unsigned int  to_index 
)

Move a row from an index to another, while preserving the order of the rest of the rows.

Parameters
from_indexThe index of the row to move.
to_indexWhere to move it. The index given will be the one the row has once the operation is done. So to move something at the end, use row_count - 1, or at the beginning, 0
bool OfAttrTable::operator!= ( const OfAttrTable other) const

Inequality operator

OfAttrTable & OfAttrTable::operator= ( OfAttrTable &&  other)
inlinenoexcept

Move assignment

OfAttrTable & OfAttrTable::operator= ( const OfAttrTable other)

Copy assignment. Needed for Python bindings

bool OfAttrTable::operator== ( const OfAttrTable other) const

Equality operator

void OfAttrTable::remove_row ( unsigned int  row_index = CORE_INVALID_INDEX)

Remove a row from the table. If the removed row was the current one, the current row of the table is set to CORE_INVALID_INDEX.

Parameters
row_indexThe optional index of the row to remove. If no index is used (or the index is CORE_INVALID_INDEX) the last row is removed.
void OfAttrTable::reset ( void  )

Reset all columns.

See Also
OfAttr::reset
void OfAttrTable::restore_state ( const OfAttrTableState state)

Restore the table's state.

void OfAttrTable::revert ( void  )

Revert all columns.

See Also
OfAttr::revert
OfAttrTableState OfAttrTable::save_state ( void  )

Save the state of the whole table.

void OfAttrTable::set_cell_value ( unsigned int  row_index,
unsigned int  column_index,
const CoreVariant value,
unsigned int  value_index = 0 
)

Set a value of a cell.

Parameters
row_indexIndex of the row
column_indexIndex of the column
valueThe value
value_indexIndex of the value in the cell, 0 by default.
void OfAttrTable::set_cell_values ( unsigned int  row_index,
unsigned int  column_index,
const CoreBasicArray< CoreVariant > &  values 
)

Set the values of a cell.

Parameters
row_indexIndex of the row
column_indexIndex of the column
valuesThe values
void OfAttrTable::set_hidden ( bool  hidden)

Hide or show the whole table.

Parameters
hiddenIf true, all the columns will be hidden and the table itself too, otherwise they'll be shown.
void OfAttrTable::set_localized ( bool  localized)

(Un)localize the whole table.

Parameters
localizedIf true, all the columns will be localized, otherwise they'll be unlocalized.
void OfAttrTable::set_locked ( bool  locked)

Lock or unlock the whole table.

Parameters
lockedIf true, all the columns will be locked, otherwise they'll be unlocked.
void OfAttrTable::set_row_enabled ( unsigned int  row_index,
bool  enabled 
)

Set the enabled state of a row.

Parameters
row_indexIndex of the row.
enabledEnabled state.
void OfAttrTable::set_row_values ( unsigned int  row_index,
const CoreBasicArray< CoreVariant > &  values 
)

Set the values of a full row.

Parameters
row_indexThe index of the row to set the values of.
void OfAttrTable::swap_rows ( unsigned int  first_index,
unsigned int  second_index 
)

Swap 2 rows.

Parameters
first_indexIndex of the first item.
second_indexIndex of the second item.