~ubuntu-branches/ubuntu/precise/rhythmbox/precise-201203091205

« back to all changes in this revision

Viewing changes to rhythmdb/rb-refstring.h

Tags: upstream-0.9.5
ImportĀ upstreamĀ versionĀ 0.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *
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.
19
19
 *
20
20
 */
21
21
 
24
24
#ifndef __RB_REFSTRING_H
25
25
#define __RB_REFSTRING_H
26
26
 
27
 
typedef struct
28
 
{
29
 
        gint refcount;
30
 
        char *folded;
31
 
        char *sortkey;
32
 
        char value[1];
33
 
} RBRefString;
34
 
 
35
 
 
36
 
void                            rb_refstring_system_init (void);
37
 
void                            rb_refstring_system_shutdown (void);
38
 
 
39
 
G_INLINE_FUNC RBRefString *     rb_refstring_new (const char *init);
40
 
RBRefString *                   rb_refstring_new_full (const char *init, gboolean compute_sortdata);
41
 
 
42
 
G_INLINE_FUNC RBRefString *     rb_refstring_ref (RBRefString *val);
43
 
G_INLINE_FUNC void              rb_refstring_unref (RBRefString *val);
44
 
 
45
 
 
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);
49
 
 
50
 
G_INLINE_FUNC guint             rb_refstring_hash (gconstpointer a);
51
 
G_INLINE_FUNC gboolean          rb_refstring_equal (gconstpointer a, gconstpointer b);
52
 
 
53
 
 
54
 
#if defined (G_CAN_INLINE) || defined (G_HAVE_INLINE ) || defined (__RB_REFSTRING_C__)
55
 
 
56
 
G_INLINE_FUNC RBRefString *
57
 
rb_refstring_new (const char *init)
58
 
{
59
 
        return rb_refstring_new_full (init, TRUE);
60
 
}
61
 
 
62
 
G_INLINE_FUNC RBRefString *
63
 
rb_refstring_ref (RBRefString *val)
64
 
{
65
 
        g_atomic_int_inc (&val->refcount);
66
 
        return val;
67
 
}
68
 
 
69
 
G_INLINE_FUNC const char *
70
 
rb_refstring_get (const RBRefString *val)
71
 
{
72
 
        return val ? val->value : NULL;
73
 
}
74
 
 
75
 
G_INLINE_FUNC const char *
76
 
rb_refstring_get_folded (const RBRefString *val)
77
 
{
78
 
        return val ? val->folded : NULL;
79
 
}
80
 
 
81
 
G_INLINE_FUNC const char *
82
 
rb_refstring_get_sort_key (const RBRefString *val)
83
 
{
84
 
        return val ? val->sortkey : NULL;
85
 
}
86
 
 
87
 
G_INLINE_FUNC guint
88
 
rb_refstring_hash (gconstpointer p)
89
 
{
90
 
        const RBRefString *ref = p;
91
 
        return g_str_hash (rb_refstring_get (ref));
92
 
}
93
 
 
94
 
G_INLINE_FUNC gboolean
95
 
rb_refstring_equal (gconstpointer ap, gconstpointer bp)
96
 
{
97
 
        const RBRefString *a = ap;
98
 
        const RBRefString *b = bp;
99
 
        return g_str_equal (rb_refstring_get (a),
100
 
                            rb_refstring_get (b));
101
 
}
102
 
 
103
 
#endif
 
27
typedef struct RBRefString RBRefString;
 
28
 
 
29
 
 
30
void            rb_refstring_system_init (void);
 
31
void            rb_refstring_system_shutdown (void);
 
32
 
 
33
RBRefString *   rb_refstring_new (const char *init);
 
34
 
 
35
RBRefString *   rb_refstring_ref (RBRefString *val);
 
36
void            rb_refstring_unref (RBRefString *val);
 
37
 
 
38
 
 
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);
 
42
 
 
43
guint rb_refstring_hash (gconstpointer p);
 
44
gboolean rb_refstring_equal (gconstpointer ap, gconstpointer bp);
104
45
 
105
46
#endif