libpurple/protocols/facebook/id.h

changeset 42187
fc241db9162d
parent 42186
637ba5491231
child 42188
04c0398f1046
equal deleted inserted replaced
42186:637ba5491231 42187:fc241db9162d
1 /* purple
2 *
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
20 */
21
22 #ifndef PURPLE_FACEBOOK_ID_H
23 #define PURPLE_FACEBOOK_ID_H
24
25 #include <glib.h>
26 #include <glib/gprintf.h>
27
28 #include "util.h"
29
30 /**
31 * FB_ID_FORMAT:
32 *
33 * The format specifier for printing and scanning an #FbId.
34 */
35 #define FB_ID_FORMAT G_GINT64_FORMAT
36
37 /**
38 * FB_ID_MODIFIER:
39 *
40 * The length modifier for printing an #FbId.
41 */
42 #define FB_ID_MODIFIER G_GINT64_MODIFIER
43
44 /**
45 * FB_ID_STRMAX:
46 *
47 * The maximum length, including a null-terminating character, of the
48 * string representation of an #FbId.
49 */
50 #define FB_ID_STRMAX 21
51
52 /**
53 * FB_TYPE_ID:
54 *
55 * The #GType of an #FbId.
56 */
57 #define FB_TYPE_ID G_TYPE_INT64
58
59 /**
60 * FB_ID_CONSTANT:
61 * @v: The value.
62 *
63 * Inserts a literal #FbId into source code.
64 *
65 * Return: The literal #FbId value.
66 */
67 #define FB_ID_CONSTANT(v) G_GINT64_CONSTANT(v)
68
69 /**
70 * FB_ID_FROM_STR:
71 * @s: The string value.
72 *
73 * Converts a string to an #FbId.
74 *
75 * Return: The converted #FbId value.
76 */
77 #define FB_ID_FROM_STR(s) g_ascii_strtoll(s, NULL, 10)
78
79 /**
80 * FB_ID_IS_STR:
81 * @s: The string value.
82 *
83 * Determines if a string is an #FbId.
84 *
85 * Return: #TRUE if the string is an #FbId, otherwise #FALSE.
86 */
87 #define FB_ID_IS_STR(s) fb_util_strtest(s, G_ASCII_DIGIT)
88
89 /**
90 * FB_ID_TO_STR:
91 * @i: The #FbId.
92 * @s: The string buffer.
93 *
94 * Converts an #FbId to a string. The buffer should be at least the
95 * size of #FB_ID_STRMAX.
96 *
97 * Return: The converted string value.
98 */
99 #define FB_ID_TO_STR(i, s) g_sprintf(s, "%" FB_ID_FORMAT, (FbId) i)
100
101 /**
102 * fb_id_equal:
103 *
104 * Compares the values of two #FbId's for equality. See #g_int64_equal.
105 */
106 #define fb_id_equal g_int64_equal
107
108 /**
109 * fb_id_hash:
110 *
111 * Converts a pointer to a #FbId hash value. See #g_int64_hash.
112 */
113 #define fb_id_hash g_int64_hash
114
115 /**
116 * FbId:
117 *
118 * Represents a numeric Facebook identifier.
119 */
120 typedef gint64 FbId;
121
122 #endif /* PURPLE_FACEBOOK_ID_H */

mercurial