16
16
* You should have received a copy of the GNU General Public License
17
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24
24
#ifndef __RB_REFSTRING_H
25
25
#define __RB_REFSTRING_H
36
void rb_refstring_system_init (void);
37
void rb_refstring_system_shutdown (void);
39
G_INLINE_FUNC RBRefString * rb_refstring_new (const char *init);
40
RBRefString * rb_refstring_new_full (const char *init, gboolean compute_sortdata);
42
G_INLINE_FUNC RBRefString * rb_refstring_ref (RBRefString *val);
43
G_INLINE_FUNC void rb_refstring_unref (RBRefString *val);
46
G_INLINE_FUNC const char * rb_refstring_get (const RBRefString *val);
47
G_INLINE_FUNC const char * rb_refstring_get_folded (const RBRefString *val);
48
G_INLINE_FUNC const char * rb_refstring_get_sort_key (const RBRefString *val);
50
G_INLINE_FUNC guint rb_refstring_hash (gconstpointer a);
51
G_INLINE_FUNC gboolean rb_refstring_equal (gconstpointer a, gconstpointer b);
54
#if defined (G_CAN_INLINE) || defined (G_HAVE_INLINE ) || defined (__RB_REFSTRING_C__)
56
G_INLINE_FUNC RBRefString *
57
rb_refstring_new (const char *init)
59
return rb_refstring_new_full (init, TRUE);
62
G_INLINE_FUNC RBRefString *
63
rb_refstring_ref (RBRefString *val)
65
g_atomic_int_inc (&val->refcount);
69
G_INLINE_FUNC const char *
70
rb_refstring_get (const RBRefString *val)
72
return val ? val->value : NULL;
75
G_INLINE_FUNC const char *
76
rb_refstring_get_folded (const RBRefString *val)
78
return val ? val->folded : NULL;
81
G_INLINE_FUNC const char *
82
rb_refstring_get_sort_key (const RBRefString *val)
84
return val ? val->sortkey : NULL;
88
rb_refstring_hash (gconstpointer p)
90
const RBRefString *ref = p;
91
return g_str_hash (rb_refstring_get (ref));
94
G_INLINE_FUNC gboolean
95
rb_refstring_equal (gconstpointer ap, gconstpointer bp)
97
const RBRefString *a = ap;
98
const RBRefString *b = bp;
99
return g_str_equal (rb_refstring_get (a),
100
rb_refstring_get (b));
27
typedef struct RBRefString RBRefString;
30
void rb_refstring_system_init (void);
31
void rb_refstring_system_shutdown (void);
33
RBRefString * rb_refstring_new (const char *init);
35
RBRefString * rb_refstring_ref (RBRefString *val);
36
void rb_refstring_unref (RBRefString *val);
39
const char * rb_refstring_get (const RBRefString *val);
40
const char * rb_refstring_get_folded (RBRefString *val);
41
const char * rb_refstring_get_sort_key (RBRefString *val);
43
guint rb_refstring_hash (gconstpointer p);
44
gboolean rb_refstring_equal (gconstpointer ap, gconstpointer bp);