#include <glib-object.h>
Go to the source code of this file.
Classes | |
struct | _MapeGroupClass |
struct | _MapeGroup |
Macros | |
#define | MAPE_TYPE_GROUP (mape_group_get_type()) |
#define | MAPE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), MAPE_TYPE_GROUP, MapeGroup)) |
#define | MAPE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), MAPE_TYPE_GROUP, MapeGroupClass)) |
#define | MAPE_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAPE_TYPE_GROUP)) |
#define | MAPE_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), MAPE_TYPE_GROUP)) |
#define | MAPE_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), MAPE_TYPE_GROUP, MapeGroupClass)) |
Typedefs | |
typedef struct _MapeGroup | MapeGroup |
typedef struct _MapeGroupClass | MapeGroupClass |
typedef enum _MapeGroupError | MapeGroupError |
Enumerations | |
enum | _MapeGroupError { MAPE_GROUP_ERROR_OPEN , MAPE_GROUP_ERROR_ACCESS , MAPE_GROUP_ERROR_READ } |
Functions | |
GType | mape_group_get_type (void) G_GNUC_CONST |
MapeGroup * | mape_group_new (void) |
gboolean | mape_group_is_open (MapeGroup *group) |
gboolean | mape_group_open (MapeGroup *group, const gchar *path, GError **error) |
MapeGroup * | mape_group_open_child (MapeGroup *group, const gchar *entry, GError **error) |
void | mape_group_close (MapeGroup *group) |
const gchar * | mape_group_get_name (MapeGroup *group) |
gchar * | mape_group_get_full_name (MapeGroup *group) |
gboolean | mape_group_has_entry (MapeGroup *group, const gchar *entry) |
void | mape_group_rewind (MapeGroup *group) |
gchar * | mape_group_get_next_entry (MapeGroup *group) |
guchar * | mape_group_load_entry (MapeGroup *group, const gchar *entry, gsize *size, GError **error) |
gboolean | mape_group_is_folder (MapeGroup *group) |
gboolean | mape_group_is_drive_container (MapeGroup *group) |
gboolean | mape_group_is_child_folder (MapeGroup *group, const gchar *child) |
struct _MapeGroupClass |
struct _MapeGroup |
#define MAPE_GROUP | ( | obj | ) | (G_TYPE_CHECK_INSTANCE_CAST((obj), MAPE_TYPE_GROUP, MapeGroup)) |
#define MAPE_GROUP_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_CAST((klass), MAPE_TYPE_GROUP, MapeGroupClass)) |
#define MAPE_GROUP_GET_CLASS | ( | obj | ) | (G_TYPE_INSTANCE_GET_CLASS((obj), MAPE_TYPE_GROUP, MapeGroupClass)) |
#define MAPE_IS_GROUP | ( | obj | ) | (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAPE_TYPE_GROUP)) |
#define MAPE_IS_GROUP_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_TYPE((klass), MAPE_TYPE_GROUP)) |
#define MAPE_TYPE_GROUP (mape_group_get_type()) |
typedef struct _MapeGroup MapeGroup |
typedef struct _MapeGroupClass MapeGroupClass |
typedef enum _MapeGroupError MapeGroupError |
MapeGroupError: @MAPE_GROUP_ERROR_OPEN: An error occured when attempting to open the group. @MAPE_GROUP_ERROR_ACCESS: An error occurred when accessing a group element. @MAPE_GROUP_ERROR_READ: An error occured when reading from the group.
These errors are from the MAPE_GROUP_ERROR error domain. They can occur when opening, seeking or reading from a group, respectively.
enum _MapeGroupError |
MapeGroupError: @MAPE_GROUP_ERROR_OPEN: An error occured when attempting to open the group. @MAPE_GROUP_ERROR_ACCESS: An error occurred when accessing a group element. @MAPE_GROUP_ERROR_READ: An error occured when reading from the group.
These errors are from the MAPE_GROUP_ERROR error domain. They can occur when opening, seeking or reading from a group, respectively.
Enumerator | |
---|---|
MAPE_GROUP_ERROR_OPEN | |
MAPE_GROUP_ERROR_ACCESS | |
MAPE_GROUP_ERROR_READ |
Definition at line 42 of file group.h.
void mape_group_close | ( | MapeGroup * | group | ) |
mape_group_close: @group: A MapeGroup.
Closes an open group. The group can be reopened afterwards.
Definition at line 355 of file group.c.
References c4_group_handle_free(), _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
gchar* mape_group_get_full_name | ( | MapeGroup * | group | ) |
mape_group_get_full_name: @group: An open MapeGroup.
Returns the full path to the group.
Return Value: The group path. Free with g_free() when no longer needed.
Definition at line 407 of file group.c.
References c4_group_handle_get_full_name(), mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
const gchar* mape_group_get_name | ( | MapeGroup * | group | ) |
mape_group_get_name: @group: An open MapeGroup.
Returns the name of the group.
Return Value: The group's name. The name is owned by the group and must not be freed.
Definition at line 390 of file group.c.
References c4_group_handle_get_name(), mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
gchar* mape_group_get_next_entry | ( | MapeGroup * | group | ) |
mape_group_get_next_entry: @group: An open MapeGroup. @error: Location to store error information, if any.
Advances the group's internal iterator by one and returns the name of the entry it now points to. Use mape_group_load_entry() to load its contents into memory, or mape_group_open_child() if you expect the entry to be a subgroup. If there are no more entries in the group, the function returns NULL.
Returns: The name of the next entry, or NULL if there is no next entry.
Definition at line 496 of file group.c.
References c4_group_handle_find_next_entry(), _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
Referenced by mape_texture_map_load_textures().
GType mape_group_get_type | ( | void | ) |
gboolean mape_group_has_entry | ( | MapeGroup * | group, |
const gchar * | entry | ||
) |
mape_group_has_entry: @group: An open MapeGroup. @entry: The entry name to check.
Returns TRUE if @group contains an entry with the given name, and FALSE otherwise.
Definition at line 424 of file group.c.
References c4_group_handle_find_next_entry(), c4_group_handle_reset_search(), _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
gboolean mape_group_is_child_folder | ( | MapeGroup * | group, |
const gchar * | child | ||
) |
Definition at line 631 of file group.c.
References c4_group_handle_get_full_name(), c4_group_handle_is_folder(), _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
gboolean mape_group_is_drive_container | ( | MapeGroup * | group | ) |
Definition at line 603 of file group.c.
References _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
gboolean mape_group_is_folder | ( | MapeGroup * | group | ) |
gboolean mape_group_is_open | ( | MapeGroup * | group | ) |
mape_group_is_open: @group: A MapeGroup.
Returns whether @group is open or not.
Returns: Whether @group is open.
Definition at line 220 of file group.c.
References _MapeGroupPrivate::handle, MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
Referenced by mape_group_close(), mape_group_get_full_name(), mape_group_get_name(), mape_group_get_next_entry(), mape_group_has_entry(), mape_group_is_child_folder(), mape_group_is_drive_container(), mape_group_load_entry(), mape_group_open(), mape_group_open_child(), mape_group_rewind(), and mape_material_map_load().
guchar* mape_group_load_entry | ( | MapeGroup * | group, |
const gchar * | entry, | ||
gsize * | size, | ||
GError ** | error | ||
) |
mape_group_load_entry: @group: An open MapeGroup. @entry: The name of the file to open. @size: Location to store the size of the entry in, or NULL. @error: Location to store error information, if any.
Attempts to load the entry with the given name into memory. If @size is non-NULL, the size of the entry will be stored at the location @size points to. On error, NULL is returned, @error is set and @size is left untouched.
Returns: A pointer pointing to the loaded entry's contents.
Definition at line 557 of file group.c.
References c4_group_handle_access_entry(), _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, MAPE_IS_GROUP, and s.
Referenced by mape_texture_map_load_textures().
MapeGroup* mape_group_new | ( | void | ) |
mape_group_new:
Creates a new group object. The group object is initially closed. Open it with mape_group_open(). To open a child group from an existing group, use mape_group_open_child() instead of this function.
Return Value: A new MapeGroup. Free with g_object_unref().
Definition at line 206 of file group.c.
References MAPE_GROUP, and MAPE_TYPE_GROUP.
Referenced by mape_group_open_child().
gboolean mape_group_open | ( | MapeGroup * | group, |
const gchar * | path, | ||
GError ** | error | ||
) |
mape_group_open: @group: A MapeGroup. @path: A path leading to a non-packed C4Group file or a directory on disk. @error: Location to store error information, if any.
@group must not be open yet. Upon success, @group has been opened and its content can be read via mape_group_get_next_entry() and mape_group_load_entry(). On error, the function returns FALSE and @error will be set.
Return Value: TRUE on success, and FALSE on error.
Definition at line 249 of file group.c.
References c4_group_handle_new(), c4_group_handle_open(), _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
Referenced by mape_group_open_child().
mape_group_open_child: @group: A MapeGroup. @entry: A subgroup entry in @group. @error: Location to store error information, if any.
This function attempts to open a child group which is contained in @group, named @entry. On success the new, opened group is returned. On failure, the function returns NULL and @error is set.
Returns: A new group to be freed with g_object_unref() when no longer needed, or NULL on error.
Definition at line 301 of file group.c.
References c4_group_handle_new(), c4_group_handle_open_as_child(), _MapeGroupPrivate::handle, mape_group_is_open(), mape_group_new(), mape_group_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
Referenced by mape_mapgen_set_root_group().
void mape_group_rewind | ( | MapeGroup * | group | ) |
mape_group_rewind: @group: An open MapeGroup.
Resets the group's internal iterator. The next call to mape_group_get_next_entry() will return the first entry in the group again.
Definition at line 462 of file group.c.
References c4_group_handle_reset_search(), _MapeGroupPrivate::handle, mape_group_is_open(), MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
Referenced by mape_texture_map_load_textures().