summaryrefslogtreecommitdiff
path: root/libpurple/protocols/facebook/id.h
blob: c88128c86a074a382727972bfe3a0ddeb98c500a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* purple
 *
 * Purple is the legal property of its developers, whose names are too numerous
 * to list here.  Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 */

#ifndef PURPLE_FACEBOOK_ID_H
#define PURPLE_FACEBOOK_ID_H

#include <glib.h>
#include <glib/gprintf.h>

#include "util.h"

/**
 * FB_ID_FORMAT:
 *
 * The format specifier for printing and scanning an #FbId.
 */
#define FB_ID_FORMAT  G_GINT64_FORMAT

/**
 * FB_ID_MODIFIER:
 *
 * The length modifier for printing an #FbId.
 */
#define FB_ID_MODIFIER  G_GINT64_MODIFIER

/**
 * FB_ID_STRMAX:
 *
 * The maximum length, including a null-terminating character, of the
 * string representation of an #FbId.
 */
#define FB_ID_STRMAX  21

/**
 * FB_TYPE_ID:
 *
 * The #GType of an #FbId.
 */
#define FB_TYPE_ID  G_TYPE_INT64

/**
 * FB_ID_CONSTANT:
 * @v: The value.
 *
 * Inserts a literal #FbId into source code.
 *
 * Return: The literal #FbId value.
 */
#define FB_ID_CONSTANT(v)  G_GINT64_CONSTANT(v)

/**
 * FB_ID_FROM_STR:
 * @s: The string value.
 *
 * Converts a string to an #FbId.
 *
 * Return: The converted #FbId value.
 */
#define FB_ID_FROM_STR(s)  g_ascii_strtoll(s, NULL, 10)

/**
 * FB_ID_IS_STR:
 * @s: The string value.
 *
 * Determines if a string is an #FbId.
 *
 * Return: #TRUE if the string is an #FbId, otherwise #FALSE.
 */
#define FB_ID_IS_STR(s)  fb_util_strtest(s, G_ASCII_DIGIT)

/**
 * FB_ID_TO_STR:
 * @i: The #FbId.
 * @s: The string buffer.
 *
 * Converts an #FbId to a string. The buffer should be at least the
 * size of #FB_ID_STRMAX.
 *
 * Return: The converted string value.
 */
#define FB_ID_TO_STR(i, s)  g_sprintf(s, "%" FB_ID_FORMAT, (FbId) i)

/**
 * fb_id_equal:
 *
 * Compares the values of two #FbId's for equality. See #g_int64_equal.
 */
#define fb_id_equal  g_int64_equal

/**
 * fb_id_hash:
 *
 * Converts a pointer to a #FbId hash value. See #g_int64_hash.
 */
#define fb_id_hash  g_int64_hash

/**
 * FbId:
 *
 * Represents a numeric Facebook identifier.
 */
typedef gint64 FbId;

#endif /* PURPLE_FACEBOOK_ID_H */