AppStreamCompose.Unit
Description: Reference for AppStreamCompose.Unit

### Class

# AppStreamComposeUnit

#### Description

    abstract class AppStreamCompose.Unit : GObject.Object
    {
      /* No available fields */
    }

No description available.

#### Hierarchy

#### Ancestors

- GObject

#### Descendants

- AscDirectoryUnit

#### Instance methods

###### asc_unit_add_relevant_path

Add a path to the list of relevant directories. A unit may only read data in paths that were previously registered as relevant.

since: 0.14.5

###### asc_unit_close

Close this unit, possibly freeing its resources. Calls to `read_data()` or `get_contents()` may not produce results until `open()` is called again.

since: 0.14.5

###### asc_unit_dir_exists

Returns `TRUE` if the directory exists and files in it are readable.

since: 0.14.5

###### asc_unit_file_exists

Returns `TRUE` if the filename exists and is readable using %asc_unit_read_data.

since: 0.14.5

###### asc_unit_get_bundle_id

Gets the ID name of the bundle (a package / Flatpak / any entity containing metadata) that this unit represents.

since: 0.14.5

###### asc_unit_get_bundle_id_fs_safe

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_set_bundle_id().

since: 0.15.1

###### asc_unit_get_bundle_kind

Gets the bundle kind of this unit.

since: 0.14.5

###### asc_unit_get_contents

Get a list of all files contained by this unit.

since: 0.14.5

###### asc_unit_get_relevant_paths

Get a list of paths that are relevant for data processing.

since: 0.14.5

###### asc_unit_open

Open this unit, populating its content listing.

since: 0.14.5

###### asc_unit_read_data

Read the contents of the selected file into memory and return them.

since: 0.14.5

###### asc_unit_set_bundle_id

Sets the ID of the bundle represented by this unit.

since: 0.14.5

###### asc_unit_set_bundle_kind

Sets the kind of the bundle this unit represents.

since: 0.14.5

###### asc_unit_set_contents

Set list of files this unit contains.

since: 0.14.5

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct AppStreamComposeUnitClass {
      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
      );
      void (* _as_reserved1) (
    void
      );
      void (* _as_reserved2) (
    void
      );
      void (* _as_reserved3) (
    void
      );
      void (* _as_reserved4) (
    void
      );

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.

`open: gboolean (* open) ( AscUnit* unit, GError** error )`

  No description available.

`close: void (* close) ( AscUnit* unit )`

  No description available.

`file_exists: gboolean (* file_exists) ( AscUnit* unit, const gchar* filename )`

  No description available.

`dir_exists: gboolean (* dir_exists) ( AscUnit* unit, const gchar* dirname )`

  No description available.

`read_data: GBytes* (* read_data) ( AscUnit* unit, const gchar* filename, GError** error )`

  No description available.

`_as_reserved1: void (* _as_reserved1) ( void )`

  No description available.

`_as_reserved2: void (* _as_reserved2) ( void )`

  No description available.

`_as_reserved3: void (* _as_reserved3) ( void )`

  No description available.

`_as_reserved4: void (* _as_reserved4) ( void )`

  No description available.

#### Virtual methods

###### AppStreamCompose.UnitClass.close

Close this unit, possibly freeing its resources. Calls to `read_data()` or `get_contents()` may not produce results until `open()` is called again.

since: 0.14.5

###### AppStreamCompose.UnitClass.dir_exists

Returns `TRUE` if the directory exists and files in it are readable.

since: 0.14.5

###### AppStreamCompose.UnitClass.file_exists

Returns `TRUE` if the filename exists and is readable using %asc_unit_read_data.

since: 0.14.5

###### AppStreamCompose.UnitClass.open

Open this unit, populating its content listing.

since: 0.14.5

###### AppStreamCompose.UnitClass.read_data

Read the contents of the selected file into memory and return them.

since: 0.14.5