libamxc
1.10.3
C Generic Data Containers
|
A variant type structure. More...
#include <amxc_variant_type.h>
A variant type structure.
New or application specific variants can be defined and registered. All function pointers are optional.
The member type_id and hit will be filled during registration and must never be changed.
A unique name must be provided.
The init function is called when the type of the variant is set see amxc_var_set_type. When the initialization is ok, return 0, otherwise return an error code.
The del function is called when the content of the variant must be cleared.
The copy function is called when a copy needs to be made.
The convert functions convert_from, convert_to are called when conversion from one type to another type is needed. These functions take two arguments, the destination variant and the source variant. These functions are used by amxc_var_convert. If the source variant type has a convert_to function, it will be called. If that conversion fails or the source variant type does not have a convert_to function, the convert_from function of the destination variant type is called. When conversion was successful, these functions must return 0, if conversion was impossible (not supported) or fails for any other reason an error code must be returned.
The compare function is called to compare two variants. Before calling the compare function, one of the variants will be converted to the same type as the other one. If none of the variants can be converted to the type of the other variant, the compare fails. The compare functions must set the result to a number < 0 if the left variant is smaller then the right variant, to a number > 0 if the left variant is bigger then the right variant, or to 0 if they are the same.
Definition at line 211 of file amxc_variant_type.h.
amxc_var_compare_fn_t _amxc_var_type::compare |
Compare function
Definition at line 218 of file amxc_variant_type.h.
amxc_var_convert_fn_t _amxc_var_type::convert_from |
Convert from function
Definition at line 216 of file amxc_variant_type.h.
amxc_var_convert_fn_t _amxc_var_type::convert_to |
Convert to function
Definition at line 217 of file amxc_variant_type.h.
amxc_var_copy_fn_t _amxc_var_type::copy |
Copy function
Definition at line 214 of file amxc_variant_type.h.
amxc_var_free_fn_t _amxc_var_type::del |
free (delete) function
Definition at line 213 of file amxc_variant_type.h.
amxc_var_get_index_fn_t _amxc_var_type::get_index |
Fetch part of the variant by index
Definition at line 221 of file amxc_variant_type.h.
amxc_var_get_key_fn_t _amxc_var_type::get_key |
Fetch part of the variant by key
Definition at line 219 of file amxc_variant_type.h.
amxc_htable_it_t _amxc_var_type::hit |
Hash table iterator, used to store the type
Definition at line 224 of file amxc_variant_type.h.
amxc_var_new_fn_t _amxc_var_type::init |
Initialize function
Definition at line 212 of file amxc_variant_type.h.
amxc_var_move_fn_t _amxc_var_type::move |
Move function
Definition at line 215 of file amxc_variant_type.h.
const char* _amxc_var_type::name |
Unique name of the type
Definition at line 225 of file amxc_variant_type.h.
amxc_var_set_index_fn_t _amxc_var_type::set_index |
Set part of the variant by index
Definition at line 222 of file amxc_variant_type.h.
amxc_var_set_key_fn_t _amxc_var_type::set_key |
Set part of the variant by key
Definition at line 220 of file amxc_variant_type.h.
uint32_t _amxc_var_type::type_id |
Type id - assigned when registered
Definition at line 223 of file amxc_variant_type.h.