Go to the source code of this file.
Classes | |
struct | _MapeGroupPrivate |
Macros | |
#define | MAPE_GROUP_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), MAPE_TYPE_GROUP, MapeGroupPrivate)) |
Typedefs | |
typedef struct _MapeGroupPrivate | MapeGroupPrivate |
Enumerations | |
enum | { PROP_0 , PROP_NAME , PROP_FULL_NAME } |
Functions | |
C4GroupHandle * | _mape_group_get_handle (MapeGroup *group) |
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_drive_container (MapeGroup *group) |
gboolean | mape_group_is_child_folder (MapeGroup *group, const gchar *child) |
struct _MapeGroupPrivate |
Class Members | ||
---|---|---|
C4GroupHandle * | handle |
#define MAPE_GROUP_PRIVATE | ( | obj | ) | (G_TYPE_INSTANCE_GET_PRIVATE((obj), MAPE_TYPE_GROUP, MapeGroupPrivate)) |
typedef struct _MapeGroupPrivate MapeGroupPrivate |
C4GroupHandle * _mape_group_get_handle | ( | MapeGroup * | group | ) |
SECTION:mape-group @title: MapeGroup @short_description: C4Group interface mape/group.h @stability: Unstable
MapeGroup is a simple GObject-based interface to C4Group. It currntly only supports a subset of the C4Group operations, it does not support writing groups for example. It is just enough for what Mape requires.
Definition at line 682 of file group.c.
References MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
Referenced by mape_mapgen_set_root_group(), mape_material_map_load(), and mape_texture_map_load_map().
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().
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_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().