Debian Codegraph @

src/polkit/polkitidentity.h

raw
1 /*
2 * Copyright (C) 2008 Red Hat, Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
18 *
19 * Author: David Zeuthen <[email protected]>
20 */
21
22 #if !defined (_POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
23 #error "Only <polkit/polkit.h> can be included directly, this file may disappear or change contents."
24 #endif
25
26 #ifndef __POLKIT_IDENTITY_H
27 #define __POLKIT_IDENTITY_H
28
29 #include <glib-object.h>
30 #include <gio/gio.h>
31 #include <polkit/polkittypes.h>
32
33 G_BEGIN_DECLS
34
35 #define POLKIT_TYPE_IDENTITY (polkit_identity_get_type())
36 #define POLKIT_IDENTITY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_IDENTITY, PolkitIdentity))
37 #define POLKIT_IS_IDENTITY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_IDENTITY))
38 #define POLKIT_IDENTITY_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), POLKIT_TYPE_IDENTITY, PolkitIdentityIface))
39
40 #if 0
41 /**
42 * PolkitIdentity:
43 *
44 * Generic type for all objects that can be used as identities.
45 */
46 typedef struct _PolkitIdentity PolkitIdentity; /* Dummy typedef */
47 #endif
48 typedef struct _PolkitIdentityIface PolkitIdentityIface;
49
50 /**
51 * PolkitIdentityIface:
52 * @parent_iface: The parent interface.
53 * @hash: Gets a hash value for a #PolkitIdentity.
54 * @equal: Checks if two #PolkitIdentity<!-- -->s are equal.
55 * @to_string: Serializes a #PolkitIdentity to a string that can be
56 * used in polkit_identity_from_string().
57 *
58 * An interface for identities.
59 */
60 struct _PolkitIdentityIface
61 {
62 GTypeInterface parent_iface;
63
64 guint (*hash) (PolkitIdentity *identity);
65
66 gboolean (*equal) (PolkitIdentity *a,
67 PolkitIdentity *b);
68
69 gchar * (*to_string) (PolkitIdentity *identity);
70 };
71
72 GType polkit_identity_get_type (void) G_GNUC_CONST;
73 guint polkit_identity_hash (PolkitIdentity *identity);
74 gboolean polkit_identity_equal (PolkitIdentity *a,
75 PolkitIdentity *b);
76 gchar *polkit_identity_to_string (PolkitIdentity *identity);
77 PolkitIdentity *polkit_identity_from_string (const gchar *str,
78 GError **error);
79
80 G_END_DECLS
81
82 #endif /* __POLKIT_IDENTITY_H */