1 /*
2  * mape - C4 Landscape.txt editor
3  *
4  * Copyright (c) 2005-2009, Armin Burgmeier
5  *
6  * Distributed under the terms of the ISC license; see accompanying file
7  * "COPYING" for details.
8  *
9  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
10  * See accompanying file "TRADEMARK" for details.
11  *
12  * To redistribute this file separately, substitute the full license texts
13  * for the above references.
14  */
15 
16 #ifndef INC_MAPE_GROUP_H
17 #define INC_MAPE_GROUP_H
18 
19 #include <glib-object.h>
20 
21 G_BEGIN_DECLS
22 
23 #define MAPE_TYPE_GROUP                 (mape_group_get_type())
24 #define MAPE_GROUP(obj)                 (G_TYPE_CHECK_INSTANCE_CAST((obj), MAPE_TYPE_GROUP, MapeGroup))
25 #define MAPE_GROUP_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST((klass), MAPE_TYPE_GROUP, MapeGroupClass))
26 #define MAPE_IS_GROUP(obj)              (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAPE_TYPE_GROUP))
27 #define MAPE_IS_GROUP_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE((klass), MAPE_TYPE_GROUP))
28 #define MAPE_GROUP_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS((obj), MAPE_TYPE_GROUP, MapeGroupClass))
29 
30 typedef struct _MapeGroup MapeGroup;
31 typedef struct _MapeGroupClass MapeGroupClass;
32 
33 /**
34  * MapeGroupError:
35  * @MAPE_GROUP_ERROR_OPEN: An error occured when attempting to open the group.
36  * @MAPE_GROUP_ERROR_ACCESS: An error occurred when accessing a group element.
37  * @MAPE_GROUP_ERROR_READ: An error occured when reading from the group.
38  *
39  * These errors are from the MAPE_GROUP_ERROR error domain. They can occur
40  * when opening, seeking or reading from a group, respectively.
41  */
42 typedef enum _MapeGroupError {
43   MAPE_GROUP_ERROR_OPEN,
44   MAPE_GROUP_ERROR_ACCESS,
45   MAPE_GROUP_ERROR_READ
46 } MapeGroupError;
47 
48 /**
49  * MapeGroupClass:
50  *
51  * This structure does not contain any public fields.
52  */
53 struct _MapeGroupClass {
54   /*< private >*/
55   GObjectClass parent_class;
56 };
57 
58 /**
59  * MapeGroup:
60  *
61  * #MapeGroup is an opaque data type. You should only access it via the
62  * public API functions.
63  */
64 struct _MapeGroup {
65   /*< private >*/
66   GObject parent;
67 };
68 
69 GType
70 mape_group_get_type(void) G_GNUC_CONST;
71 
72 MapeGroup*
73 mape_group_new(void);
74 
75 gboolean
76 mape_group_is_open(MapeGroup* group);
77 
78 gboolean
79 mape_group_open(MapeGroup* group,
80                 const gchar* path,
81                 GError** error);
82 
83 MapeGroup*
84 mape_group_open_child(MapeGroup* group,
85                       const gchar* entry,
86                       GError** error);
87 
88 void
89 mape_group_close(MapeGroup* group);
90 
91 const gchar*
92 mape_group_get_name(MapeGroup* group);
93 
94 gchar*
95 mape_group_get_full_name(MapeGroup* group);
96 
97 gboolean
98 mape_group_has_entry(MapeGroup* group,
99                      const gchar* entry);
100 
101 void
102 mape_group_rewind(MapeGroup* group);
103 
104 gchar*
105 mape_group_get_next_entry(MapeGroup* group);
106 
107 guchar*
108 mape_group_load_entry(MapeGroup* group,
109                       const gchar* entry,
110                       gsize* size,
111                       GError** error);
112 
113 gboolean
114 mape_group_is_folder(MapeGroup* group);
115 
116 gboolean
117 mape_group_is_drive_container(MapeGroup* group);
118 
119 gboolean
120 mape_group_is_child_folder(MapeGroup* group,
121                            const gchar* child);
122 
123 G_END_DECLS
124 
125 #endif /* INC_MAPE_GROUP_H */
126 
127 /* vim:set et sw=2 ts=2: */
128