| Holyrel Library Reference Manual |
|---|
Type systemType system — Type system. |
#include <libhrel/types.h>
HTypeInfo;
gpointer (*HCloneFunc) (gconstpointer value);
gchar* (*HStrFunc) (gconstpointer value);
void h_type_init (void);
gboolean h_type_known (GType type);
HTypeInfo* h_type_get_info (GType type);
gboolean h_type_add (GType type,
const HTypeInfo *info);
gboolean h_type_remove (GType type);
GCompareFunc h_type_compare_func (GType type);
GHashFunc h_type_hash_func (GType type);
GEqualFunc h_type_equal_func (GType type);
GDestroyNotify h_type_free_func (GType type);
gpointer h_value_clone (GType type,
gconstpointer value);
gchar* h_value_str (GType type,
gconstpointer value);
void h_value_free (GType type,
gpointer value);
gint h_value_compare (GType type,
gconstpointer value1,
gconstpointer value2);
GValue* h_value_set_gvalue (GType type,
gconstpointer value,
GValue *gvalue);
void h_dummy (gconstpointer value);
gpointer h_identity (gconstpointer value);
gint h_direct_compare (gconstpointer value1,
gconstpointer value2);
typedef struct {
gsize size;
HCloneFunc clone;
GCompareFunc compare;
GEqualFunc equal;
GHashFunc hash;
GDestroyNotify free;
HStrFunc str;
} HTypeInfo;
gsize size; |
size in bytes |
HCloneFunc clone; |
clone function |
GCompareFunc compare; |
comparator |
GEqualFunc equal; |
equality function |
GHashFunc hash; |
hash function |
GDestroyNotify free; |
destructor |
HStrFunc str; |
string function |
gpointer (*HCloneFunc) (gconstpointer value);
Returns a copy of value
value : |
value |
| Returns : | copy |
gchar* (*HStrFunc) (gconstpointer value);
Returns the pretty string representation of value.
value : |
value |
| Returns : | pretty string |
void h_type_init (void);
Initializes the type system. It is safe to call this multiple times.
gboolean h_type_known (GType type);
Checks whether type is known to the type system.
type : |
type ID |
| Returns : | TRUE if yes, FALSE if no |
HTypeInfo* h_type_get_info (GType type);
Returns information on type.
type : |
type ID |
| Returns : | type information |
gboolean h_type_add (GType type, const HTypeInfo *info);
Adds a new type to the system.
type : |
type ID |
info : |
information for type
|
| Returns : | TRUE if successful, FALSE if type is already known
|
gboolean h_type_remove (GType type);
Removes type from the system.
type : |
type ID |
| Returns : | TRUE if type is known and removed, otherwise FALSE |
GCompareFunc h_type_compare_func (GType type);
Returns the comparator for type.
type : |
type ID |
| Returns : | comparator, or NULL if type is unknown
|
GHashFunc h_type_hash_func (GType type);
Returns the hash function for type.
type : |
type ID |
| Returns : | hash function, or NULL if type is unknown
|
GEqualFunc h_type_equal_func (GType type);
Returns the equality function for type.
type : |
type ID |
| Returns : | equality function, or NULL if type is unknown
|
GDestroyNotify h_type_free_func (GType type);
Returns the destructor for type.
type : |
type ID |
| Returns : | destructor, or NULL if type is unknown
|
gpointer h_value_clone (GType type, gconstpointer value);
Returns a copy of value.
type : |
type of value
|
value : |
a value |
| Returns : | copy |
gchar* h_value_str (GType type, gconstpointer value);
Returns the pretty string representation of value.
type : |
type of value
|
value : |
a value |
| Returns : | pretty string representation |
void h_value_free (GType type, gpointer value);
Frees the memory allocated to value.
type : |
type of value
|
value : |
a value |
gint h_value_compare (GType type, gconstpointer value1, gconstpointer value2);
Compares value1 and value2.
type : |
type of value1 and value2
|
value1 : |
left operand |
value2 : |
right operand |
| Returns : | -1 if value1 is greater, 1 if value2 is greater, 0 if equal
|
GValue* h_value_set_gvalue (GType type, gconstpointer value, GValue *gvalue);
Stores a value of type type into a GValue.
gpointer h_identity (gconstpointer value);
Returns value.
value : |
value |
| Returns : | value
|
gint h_direct_compare (gconstpointer value1, gconstpointer value2);
Compares value1 and value2 using the builtin C operators <, and >.
value1 : |
left operand |
value2 : |
right operand |
| Returns : | negative if value1 is smaller, 0 if equal, positive
if greater
|
| << Type system | Tuples >> |