libpurple/protocols/facebook/id.h

branch
facebook
changeset 37347
34d43f8c10d1
parent 37258
291b6e1acc24
child 37416
77536a48b4be
equal deleted inserted replaced
37346:ce9c78335820 37347:34d43f8c10d1
20 */ 20 */
21 21
22 #ifndef _FACEBOOK_ID_H_ 22 #ifndef _FACEBOOK_ID_H_
23 #define _FACEBOOK_ID_H_ 23 #define _FACEBOOK_ID_H_
24 24
25 /**
26 * SECTION:id
27 * @section_id: facebook-id
28 * @short_description: <filename>id.h</filename>
29 * @title: Facebook Identifier
30 *
31 * The Facebook identifier utilities.
32 */
33
25 #include <glib.h> 34 #include <glib.h>
26 #include <glib/gprintf.h> 35 #include <glib/gprintf.h>
27 36
28 #include "util.h" 37 #include "util.h"
29 38
39 /**
40 * FB_ID_FORMAT:
41 *
42 * The format specifier for printing and scanning an #FbId.
43 */
44 #define FB_ID_FORMAT G_GINT64_FORMAT
45
46 /**
47 * FB_ID_MODIFIER:
48 *
49 * The length modifier for printing an #FbId.
50 */
51 #define FB_ID_MODIFIER G_GINT64_MODIFIER
52
53 /**
54 * FB_ID_STRMAX:
55 *
56 * The maximum length, including a null-terminating character, of the
57 * string representation of an #FbId.
58 */
59 #define FB_ID_STRMAX 21
60
61 /**
62 * FB_TYPE_ID:
63 *
64 * The #GType of an #FbId.
65 */
66 #define FB_TYPE_ID G_TYPE_INT64
67
68 /**
69 * FB_ID_CONSTANT:
70 * @v: The value.
71 *
72 * Inserts a literal #FbId into source code.
73 *
74 * Return: The literal #FbId value.
75 */
30 #define FB_ID_CONSTANT(v) G_GINT64_CONSTANT(v) 76 #define FB_ID_CONSTANT(v) G_GINT64_CONSTANT(v)
31 #define FB_ID_FORMAT G_GINT64_FORMAT
32 #define FB_ID_MODIFIER G_GINT64_MODIFIER
33 #define FB_ID_STRMAX 21
34 #define FB_TYPE_ID G_TYPE_INT64
35 #define fb_id_hash g_int64_hash
36 #define fb_id_equal g_int64_equal
37 77
38 #define FB_ID_FROM_STR(s) \ 78 /**
39 g_ascii_strtoll(s, NULL, 10) 79 * FB_ID_FROM_STR:
80 * @s: The string value.
81 *
82 * Converts a string to an #FbId.
83 *
84 * Return: The converted #FbId value.
85 */
86 #define FB_ID_FROM_STR(s) g_ascii_strtoll(s, NULL, 10)
40 87
41 #define FB_ID_IS_STR(s) \ 88 /**
42 fb_util_str_is(s, G_ASCII_DIGIT) 89 * FB_ID_IS_STR:
90 * @s: The string value.
91 *
92 * Determines if a string is an #FbId.
93 *
94 * Return: #TRUE if the string is an #FbId, otherwise #FALSE.
95 */
96 #define FB_ID_IS_STR(s) fb_util_str_is(s, G_ASCII_DIGIT)
43 97
44 #define FB_ID_TO_STR(i, s) \ 98 /**
45 g_sprintf(s, "%" FB_ID_FORMAT, (FbId) i) 99 * FB_ID_TO_STR:
100 * @i: The #FbId.
101 * @s: The string buffer.
102 *
103 * Converts an #FbId to a string. The buffer should be at least the
104 * size of #FB_ID_STRMAX.
105 *
106 * Return: The converted string value.
107 */
108 #define FB_ID_TO_STR(i, s) g_sprintf(s, "%" FB_ID_FORMAT, (FbId) i)
46 109
110 /**
111 * fb_id_equal:
112 *
113 * Compares the values of two #FbId's for equality. See #g_int64_equal.
114 */
115 #define fb_id_equal g_int64_equal
116
117 /**
118 * fb_id_hash:
119 *
120 * Converts a pointer to a #FbId hash value. See #g_int64_hash.
121 */
122 #define fb_id_hash g_int64_hash
123
124 /**
125 * FbId:
126 *
127 * Represents a numeric Facebook identifier.
128 */
47 typedef gint64 FbId; 129 typedef gint64 FbId;
48 130
49 #endif /* _FACEBOOK_ID_H_ */ 131 #endif /* _FACEBOOK_ID_H_ */

mercurial