|
file | guid.h |
| globally unique ID User API
|
|
|
#define | GUID_DATA_SIZE 16 |
|
#define | GNC_TYPE_GUID (gnc_guid_get_type()) |
|
#define | GNC_VALUE_HOLDS_GUID(value) G_VALUE_HOLDS(value, GNC_TYPE_GUID) |
|
#define | GUID_ENCODING_LENGTH 32 |
|
Globally Unique IDs provide a way to uniquely identify something. A GncGUID is a unique, cryptographically random 128-bit value. The identifier is so random that it is safe to assume that there is no other such item on the planet Earth, and indeed, not even in the Galaxy or beyond.
QOF GncGUIDs can be used independently of any other subsystem in QOF. In particular, they do not require the use of other parts of the object subsystem. New GncGUIDs are usually created by initializing a new entity using qof_instance_init, rather than calling GncGUID functions directly.
#define GUID_ENCODING_LENGTH 32 |
Number of characters needed to encode a guid as a string not including the null terminator.
Definition at line 74 of file guid.h.
The type used to store guids
Returns a newly allocated GncGUID that matches the passed-in GUID. The returned pointer must be freed using guid_free.
gboolean guid_equal |
( |
const GncGUID * |
guid_1, |
|
|
const GncGUID * |
guid_2 |
|
) |
| |
Given two GUIDs, return TRUE if they are non-NULL and equal. Return FALSE, otherwise.
gint guid_g_hash_table_equal |
( |
gconstpointer |
guid_a, |
|
|
gconstpointer |
guid_b |
|
) |
| |
Equality function for two GUIDs in a GHashTable.
GHashTable* guid_hash_table_new |
( |
void |
| ) |
|
Returns a GHashTable with <GUID*> as key and a <gpointer> as value and no destructor functions for key or value set.
guint guid_hash_to_guint |
( |
gconstpointer |
ptr | ) |
|
Hash function for a GUID. Given a GncGUID *, hash it to a guint
Allocate memory for a GUID. This does not construct a GUID. In other words, the returned pointer has not necessarily been initialized. The returned pointer must be freed with * guid_free.
Allocate and construct a new GUID. The returned pointer must be released with guid_free.
Generate a new id.
- Returns
- guid A data structure containing a copy of a newly constructed GncGUID.
Returns a GncGUID which is guaranteed to never reference any entity.
Do not free this value! The same pointer is returned on each call.
void guid_replace |
( |
GncGUID * |
guid | ) |
|
Generate a new guid.
- Parameters
-
guid | A pointer to an allocated guid data structure. The existing value will be replaced with a new value. |
gchar* guid_to_string |
( |
const GncGUID * |
guid | ) |
|
The guid_to_string() routine returns a null-terminated string encoding of the id. String encodings of identifiers are hex numbers printed only with the characters '0' through '9' and 'a' through 'f'. The encoding will always be GUID_ENCODING_LENGTH characters long (not including the null terminator).
- Parameters
-
- Returns
- A pointer to the starting character of the string. The returned memory is owned by the calling routine and must be freed using g_free.
gchar* guid_to_string_buff |
( |
const GncGUID * |
guid, |
|
|
gchar * |
buff |
|
) |
| |
The guid_to_string_buff() routine puts a null-terminated string encoding of the id into the memory pointed at by buff. The buffer must be at least GUID_ENCODING_LENGTH+1 characters long. This routine is handy for avoiding a malloc/free cycle. It returns a pointer to the >>end<< of what was written. (i.e. it can be used like 'stpcpy' during string concatenation)
- Parameters
-
guid | The guid to print. |
buff | The buffer to print it into. |
- Returns
- A pointer to the terminating null character of the string, or, if no copy took place, NULL.
gboolean string_to_guid |
( |
const gchar * |
string, |
|
|
GncGUID * |
guid |
|
) |
| |
Given a string, replace the given guid with the parsed one unless the given value is null. If null is passed as guid or string, false is returned and nothing is done, otherwise, the function returns true. This function accepts both uppor and lower case hex digits. If letters outside the range of [a-fA-F] are passed, they are silently replaced. If non-alphanumeric digits are given, this function will either return false or replace those values with others.