imAttribTable

\brief Attributes Table Class * * \par * All the attributes have a name, a type, a count and the data.\n * Names are usually strings with less that 30 chars. * \par * Attributes are stored in a hash table for fast access. \n * We use the hash function described in "The Practice of Programming" of Kernighan & Pike. * \ingroup util

Constructors

this
this(int hash_size)

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.

Destructor

~this
~this()

Destroys the table and all the attributes.

Members

Functions

CopyFrom
void CopyFrom(imAttribTable table)

Copies the contents of the given table into this table.

Count
int Count()

Returns the number of elements in the table.

ForEach
void ForEach(void* user_data, imAttribTableCallback attrib_func)

For each attribute calls the user callback. If the callback returns 0 the function returns.

Get
const(void)* Get(const(char)* name, int* data_type, int* count)

Returns an attribute from the table. * Returns the attribute if found, NULL otherwise. * See also \ref imDataType.

GetInteger
int GetInteger(const(char)* name, int index)

Returns the attribute value at given index as an integer. * If not found or complex returns 0.

GetReal
double GetReal(const(char)* name, int index)

Returns the attribute value at given index as a real. * If not found or complex returns 0.

GetString
const(char)* GetString(const(char)* name)

Returns the attribute value as a string. * If not found or not a zero terminated string returns 0.

MergeFrom
void MergeFrom(imAttribTable table)

Merges the contents of the given table into this table.

RemoveAll
void RemoveAll()

Removes all the attributes in the table

Set
void Set(const(char)* name, int data_type, int count, const(void)* data)

Inserts an attribute into the table. \n * 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 \ref imDataType.

SetInteger
void SetInteger(const(char)* name, int data_type, int value)

Inserts a single integer attribute into the table.

SetReal
void SetReal(const(char)* name, int data_type, double value)

Inserts a single real attribute into the table.

SetString
void SetString(const(char)* name, const(char)* value)

Inserts a string attribute into the table. * data_type=IM_BYTE and is zero terminated.

UnSet
void UnSet(const(char)* name)

Removes an attribute from the table given its name.

Meta