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

Public Member Functions

 OfEnum (OfObjectFactory &factory, const CoreString &name, const int &invalid_value=0)
 
const CoreStringget_name () const
 
void add_values (const CoreVector< CoreString > &labels, const CoreVector< int > &values)
 This methods provide a way to add/update several values in the enumeration and notify linked attributes only once.
 
void add_value (const CoreString &label, const int &value)
 
void set_value (const CoreString &label, const int &value)
 
const unsigned int & get_value_count () const
 
const CoreStringget_label (const unsigned int &index) const
 
const int & get_value (const unsigned int &index) const
 
int get_value (const CoreString &label) const
 
void remove_value (const unsigned int &index)
 
void remove_value (const CoreString &label)
 
void remove_all_values ()
 
bool add_alias (const unsigned int &value, const CoreString &alias)
 Adds a alias to the specified value.
 
bool add_alias (const CoreString &label, const CoreString &alias)
 Adds a alias to the specified value.
 
unsigned int find_value_index (const int &value) const
 Try to find the specified value in the enumeration value list.
 
unsigned int find_label_index (const CoreString &label) const
 Try to find the specified label in the enumeration label list.
 
const int & get_invalid_value () const
 enumeration invalid value get accessor
 
const char & get_separator () const
 method to get the separator character
 
void set_separator (const char &separator)
 method to set the separator character (this is used to have sub-menus in drop-down lists)
 
void asleep ()
 
void awake (const bool &send_event=true)
 

Static Public Member Functions

static int get_value_from_label (const CoreString &label, const OfEnum *enum_ptr)
 static method for convenience to get a value from a label if the label exists or not and if the enum exists or not
 
static bool get_label_from_value (CoreString &label, const int &value, const OfEnum *enum_ptr)
 static method for convenience to get a value from a label if the label exists or not and if the enum exists or not
 
static bool validate_label (CoreString &label, const OfEnum *enum_ptr)
 static method for convenience, provides an existing label from a specified label
 
static int get_invalid_value_enum_not_exists ()
 static method for convenience to get specific value when enumeration does not exist
 
static CoreString get_invalid_label ()
 static method to provide an invalid label
 

Friends

class OfAttr
 
class OfObjectFactory
 

Member Function Documentation

bool OfEnum::add_alias ( const unsigned int &  value,
const CoreString alias 
)

Adds a alias to the specified value.

Parameters
[in]thevalue to look for
[in]thealias to add
Returns
returns true if the index exists, false otherwise
bool OfEnum::add_alias ( const CoreString label,
const CoreString alias 
)

Adds a alias to the specified value.

Parameters
[in]thelabel to look for
[in]thealias to add
Returns
returns true if the index exists, false otherwise
void OfEnum::add_values ( const CoreVector< CoreString > &  labels,
const CoreVector< int > &  values 
)

This methods provide a way to add/update several values in the enumeration and notify linked attributes only once.

Note
the two provided vectors must be exact same sized
Parameters
[in]thevector of labels to add/update
[in]thevector of values, one value per label
unsigned int OfEnum::find_label_index ( const CoreString label) const

Try to find the specified label in the enumeration label list.

Parameters
[in]thelabel to look for
Returns
the retrieved index of the label if exists, the value count otherwise
Note
This function does NOT check for aliases.
unsigned int OfEnum::find_value_index ( const int &  value) const

Try to find the specified value in the enumeration value list.

Parameters
[in]thevalue to look for
Returns
the retrieved index of the value if exists, the value count otherwise
CoreString OfEnum::get_invalid_label ( )
static

static method to provide an invalid label

Returns
returns -1
const int & OfEnum::get_invalid_value ( ) const

enumeration invalid value get accessor

Returns
the invalid value specified at construction
int OfEnum::get_invalid_value_enum_not_exists ( )
static

static method for convenience to get specific value when enumeration does not exist

Returns
returns -1
bool OfEnum::get_label_from_value ( CoreString label,
const int &  value,
const OfEnum enum_ptr 
)
static

static method for convenience to get a value from a label if the label exists or not and if the enum exists or not

Parameters
[out]theresult label
[in]thevalue to search for
[in]theconcerned enumeration
Returns
returns true if the value has been retrieved, false otherwise
const char & OfEnum::get_separator ( ) const

method to get the separator character

Returns
returns a char or 0 if no separator was set
int OfEnum::get_value_from_label ( const CoreString label,
const OfEnum enum_ptr 
)
static

static method for convenience to get a value from a label if the label exists or not and if the enum exists or not

Parameters
[in]thelabel to look for
[in]theconcerned enumeration
Returns
returns the value related to the label if label exists, returns get_invalid_value if label does not exist, and returns get_invalid_value_enum_not_exists if enum does not exist
Note
This function will check aliases.
bool OfEnum::validate_label ( CoreString label,
const OfEnum enum_ptr 
)
static

static method for convenience, provides an existing label from a specified label

Parameters
[out]thelabel or value (as a string) to search for that will be also the result label
[in]theconcerned enumeration
Returns
returns true if the enum can have validate the label existency, false otherwise