GnuCash c935c2f+
Loading...
Searching...
No Matches
guid.h
Go to the documentation of this file.
1/********************************************************************\
2 * guid.h -- globally unique ID User API *
3 * Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu> *
4 * 2014 Aaron Laws <dartmetrash@gmail.com> *
5 * *
6 * This program is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU General Public License as *
8 * published by the Free Software Foundation; either version 2 of *
9 * the License, or (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License*
17 * along with this program; if not, contact: *
18 * *
19 * Free Software Foundation Voice: +1-617-542-5942 *
20 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21 * Boston, MA 02110-1301, USA gnu@gnu.org *
22 * *
23\********************************************************************/
24
25#ifndef GUID_H
26#define GUID_H
27
28#include <glib-object.h>
29#include <stddef.h>
30
31#ifdef __cplusplus
32extern "C"
33{
34#endif
35
59#define GUID_DATA_SIZE 16
60
61#define GNC_TYPE_GUID (gnc_guid_get_type())
62#define GNC_VALUE_HOLDS_GUID(value) G_VALUE_HOLDS(value, GNC_TYPE_GUID)
63
64/* We use two definitions for gncguid: one when compiling for C (so that
65 * the object can be persisted), and a different one when compiling for C++
66 * found in guid.hpp
67 */
68#ifdef __cplusplus
69namespace gnc {
70struct GUID;
71}
72#endif
73
75typedef struct _gncGuid {
76 unsigned char reserved[GUID_DATA_SIZE];
77} GncGUID;
78
79GType gnc_guid_get_type (void);
80const GncGUID* gnc_value_get_guid (const GValue *value);
81
84#define GUID_ENCODING_LENGTH 32
85
91void guid_replace (GncGUID *guid);
92
98
102const GncGUID * guid_null (void);
103
109GncGUID * guid_malloc (void);
110
115GncGUID * guid_new (void);
116
117/*Free the guid pointed to. Do not use this guid any more.*/
118void guid_free (GncGUID *guid);
119
124GncGUID *guid_copy (const GncGUID *guid);
125
138gchar * guid_to_string (const GncGUID * guid);
139
154gchar * guid_to_string_buff (const GncGUID * guid, /*@ out @*/ gchar *buff);
155
156
166gboolean string_to_guid(const gchar * string, /*@ out @*/ GncGUID * guid);
167
168
171gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2);
172gint guid_compare(const GncGUID *g1, const GncGUID *g2);
173
175guint guid_hash_to_guint(gconstpointer ptr);
176
178gint guid_g_hash_table_equal (gconstpointer guid_a, gconstpointer guid_b);
179
182GHashTable *guid_hash_table_new(void);
183
184/* @} */
185/* @} */
186#ifdef __cplusplus
187}
188#endif
189
190#endif
GHashTable * guid_hash_table_new(void)
Returns a GHashTable with <GUID*> as key and a <gpointer> as value and no destructor functions for ke...
Definition guid.cpp:276
gchar * guid_to_string(const GncGUID *guid)
The guid_to_string() routine returns a null-terminated string encoding of the id.
Definition guid.cpp:199
const GncGUID * guid_null(void)
Returns a GncGUID which is guaranteed to never reference any entity.
Definition guid.cpp:165
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
Given two GUIDs, return TRUE if they are non-NULL and equal.
Definition guid.cpp:237
guint guid_hash_to_guint(gconstpointer ptr)
Hash function for a GUID.
Definition guid.cpp:255
void guid_replace(GncGUID *guid)
Generate a new guid.
Definition guid.cpp:178
GncGUID * guid_copy(const GncGUID *guid)
Returns a newly allocated GncGUID that matches the passed-in GUID.
Definition guid.cpp:155
const GncGUID * gnc_value_get_guid(const GValue *value)
gnc_value_get_guid
Definition guid.cpp:72
gint guid_g_hash_table_equal(gconstpointer guid_a, gconstpointer guid_b)
Equality function for two GUIDs in a GHashTable.
Definition guid.cpp:269
GncGUID guid_new_return(void)
Generate a new id.
Definition guid.cpp:193
GncGUID * guid_malloc(void)
Allocate memory for a GUID.
Definition guid.cpp:139
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 po...
Definition guid.cpp:208
GncGUID * guid_new(void)
Allocate and construct a new GUID.
Definition guid.cpp:186
The type used to store guids in C.
Definition guid.h:75