Top | ![]() |
![]() |
![]() |
![]() |
AscUnitAscUnit — A data source unit (package, bundle, database, ...) for AscCompose to process |
AscUnit * | asc_unit_new () |
AsBundleKind | asc_unit_get_bundle_kind () |
void | asc_unit_set_bundle_kind () |
const gchar * | asc_unit_get_bundle_id () |
const gchar * | asc_unit_get_bundle_id_safe () |
void | asc_unit_set_bundle_id () |
GPtrArray * | asc_unit_get_contents () |
void | asc_unit_set_contents () |
GPtrArray * | asc_unit_get_relevant_paths () |
void | asc_unit_add_relevant_path () |
gboolean | asc_unit_open () |
void | asc_unit_close () |
gboolean | asc_unit_file_exists () |
gboolean | asc_unit_dir_exists () |
GBytes * | asc_unit_read_data () |
gpointer | asc_unit_get_user_data () |
void | asc_unit_set_user_data () |
AsBundleKind
asc_unit_get_bundle_kind (AscUnit *unit
);
Gets the bundle kind of this unit.
void asc_unit_set_bundle_kind (AscUnit *unit
,AsBundleKind kind
);
Sets the kind of the bundle this unit represents.
const gchar *
asc_unit_get_bundle_id (AscUnit *unit
);
Gets the ID name of the bundle (a package / Flatpak / any entity containing metadata) that this unit represents.
const gchar *
asc_unit_get_bundle_id_safe (AscUnit *unit
);
Gets the ID name of the bundle, normalized to be safe to use
in filenames. This may *not* be the same name as set via asc_unit_get_bundle_id()
void asc_unit_set_bundle_id (AscUnit *unit
,const gchar *id
);
Sets the ID of the bundle represented by this unit.
GPtrArray *
asc_unit_get_contents (AscUnit *unit
);
Get a list of all files contained by this unit.
void asc_unit_set_contents (AscUnit *unit
,GPtrArray *contents
);
Set list of files this unit contains.
unit |
an AscUnit instance. |
|
contents |
A list of files contained by this unit. |
[element-type utf8] |
GPtrArray *
asc_unit_get_relevant_paths (AscUnit *unit
);
Get a list of paths that are relevant for data processing.
void asc_unit_add_relevant_path (AscUnit *unit
,const gchar *path
);
Add a path to the list of relevant directories. A unit may only read data in paths that were previously registered as relevant.
gboolean asc_unit_open (AscUnit *unit
,GError **error
);
Open this unit, populating its content listing.
void
asc_unit_close (AscUnit *unit
);
Close this unit, possibly freeing its resources. Calls to read_data()
or
get_contents()
may not produce results until open()
is called again.
gboolean asc_unit_file_exists (AscUnit *unit
,const gchar *filename
);
Returns TRUE
if the filename exists and is readable using asc_unit_read_data
.
gboolean asc_unit_dir_exists (AscUnit *unit
,const gchar *dirname
);
Returns TRUE
if the directory exists and files in it are readable.
GBytes * asc_unit_read_data (AscUnit *unit
,const gchar *filename
,GError **error
);
Read the contents of the selected file into memory and return them.
gpointer
asc_unit_get_user_data (AscUnit *unit
);
Get user-defined data. This is a helper function for bindings.
struct AscUnitClass { GObjectClass parent_class; gboolean (*open) (AscUnit *unit, GError **error); void (*close) (AscUnit *unit); gboolean (*file_exists) (AscUnit *unit, const gchar *filename); gboolean (*dir_exists) (AscUnit *unit, const gchar *dirname); GBytes *(*read_data) (AscUnit *unit, const gchar *filename, GError **error); };