Debian Codegraph @

geanygendoc/src/ggd-utils.h

raw
1 /*
2 *
3 * GeanyGenDoc, a Geany plugin to ease generation of source code documentation
4 * Copyright (C) 2010-2011 Colomban Wendling <[email protected]>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef H_GGD_UTILS
22 #define H_GGD_UTILS
23
24 #include <glib.h>
25 #include <geanyplugin.h> /* Geany's utils for some wrappers */
26
27 #include "ggd-macros.h"
28
29 G_BEGIN_DECLS
30 GGD_BEGIN_PLUGIN_API
31
32
33 /**
34 * GgdPerms:
35 * @GGD_PERM_R: Read permission
36 * @GGD_PERM_W: Write permission
37 * @GGD_PERM_RW: Both read and write permissions
38 * @GGD_PERM_NOCREAT: Don't create new files
39 *
40 * Flags representing permissions.
41 */
42 enum _GgdPerms {
43 GGD_PERM_R = 1 << 0,
44 GGD_PERM_W = 1 << 1,
45 GGD_PERM_RW = GGD_PERM_R | GGD_PERM_W,
46 /* a bit ugly, it isn't a permission */
47 GGD_PERM_NOCREAT = 1 << 2
48 };
49
50 typedef enum _GgdPerms GgdPerms;
51
52 gchar *ggd_get_config_file (const gchar *name,
53 const gchar *section,
54 GgdPerms perms_req,
55 GError **error);
56
57 /**
58 * GGD_PTR_ARRAY_FOR:
59 * @ptr_array: A #GPtrArray
60 * @idx: A guint variable to use as the index of the current element in the
61 * array
62 * @item: A pointer to set to the array's current element
63 *
64 * <code>for</code> header to iterate over a #GPtrArray.
65 */
66 #define GGD_PTR_ARRAY_FOR(ptr_array, idx, item) \
67 foreach_ptr_array ((item), (idx), (ptr_array))
68
69
70 GGD_END_PLUGIN_API
71 G_END_DECLS
72
73 #endif /* guard */