Attributes Table Class. More...
Public Member Functions | |
| imAttribTable (int hash_size) | |
| ~imAttribTable () | |
| int | Count () const |
| void | RemoveAll () |
| void | CopyFrom (const imAttribTable &table) |
| void | MergeFrom (const imAttribTable &table) |
| void | Set (const char *name, int data_type, int count, const void *data) |
| void | SetInteger (const char *name, int data_type, int value) |
| void | SetReal (const char *name, int data_type, double value) |
| void | SetString (const char *name, const char *value) |
| void | UnSet (const char *name) |
| const void * | Get (const char *name, int *data_type=0, int *count=0) const |
| int | GetInteger (const char *name, int index=0) const |
| double | GetReal (const char *name, int index=0) const |
| const char * | GetString (const char *name) const |
| void | ForEach (void *user_data, imAttribTableCallback attrib_func) const |
| imAttribTable::imAttribTable | ( | int | hash_size | ) | [inline] |
Creates an empty table. If size is zero the default size of 101 is used. Size must be a prime number. Other common values are 67, 599 and 1499.
| imAttribTable::~imAttribTable | ( | ) | [inline] |
Destroys the table and all the attributes.
| int imAttribTable::Count | ( | ) | const [inline] |
Returns the number of elements in the table.
| void imAttribTable::RemoveAll | ( | ) | [inline] |
Removes all the attributes in the table
| void imAttribTable::CopyFrom | ( | const imAttribTable & | table | ) | [inline] |
Copies the contents of the given table into this table.
| void imAttribTable::MergeFrom | ( | const imAttribTable & | table | ) | [inline] |
Merges the contents of the given table into this table.
| void imAttribTable::Set | ( | const char * | name, | |
| int | data_type, | |||
| int | count, | |||
| const void * | data | |||
| ) | [inline] |
Inserts an attribute into the table.
If data_type is BYTE then count can be -1 to indicate a NULL terminated string. Data is duplicated if not NULL, else data is initialized with zeros. See also imDataType.
| void imAttribTable::SetInteger | ( | const char * | name, | |
| int | data_type, | |||
| int | value | |||
| ) | [inline] |
Inserts a single integer attribute into the table.
| void imAttribTable::SetReal | ( | const char * | name, | |
| int | data_type, | |||
| double | value | |||
| ) | [inline] |
Inserts a single real attribute into the table.
| void imAttribTable::SetString | ( | const char * | name, | |
| const char * | value | |||
| ) | [inline] |
Inserts a string attribute into the table. data_type=IM_BYTE and is zero terminated.
| void imAttribTable::UnSet | ( | const char * | name | ) | [inline] |
Removes an attribute from the table given its name.
| const void* imAttribTable::Get | ( | const char * | name, | |
| int * | data_type = 0, |
|||
| int * | count = 0 | |||
| ) | const [inline] |
Returns an attribute from the table. Returns the attribute if found, NULL otherwise. See also imDataType.
| int imAttribTable::GetInteger | ( | const char * | name, | |
| int | index = 0 | |||
| ) | const [inline] |
Returns the attribute value at given index as an integer. If not found or complex returns 0.
| double imAttribTable::GetReal | ( | const char * | name, | |
| int | index = 0 | |||
| ) | const [inline] |
Returns the attribute value at given index as a real. If not found or complex returns 0.
| const char* imAttribTable::GetString | ( | const char * | name | ) | const [inline] |
Returns the attribute value as a string. If not found or not a zero terminated string returns 0.
| void imAttribTable::ForEach | ( | void * | user_data, | |
| imAttribTableCallback | attrib_func | |||
| ) | const [inline] |
For each attribute calls the user callback. If the callback returns 0 the function returns.
1.7.1