AscResult

## AscResult AscResult — A composer result for a single unit. |

## Functions

AscResult * | asc_result_new ()
gboolean | asc_result_unit_ignored ()
guint | asc_result_components_count ()
guint | asc_result_hints_count ()
gboolean | asc_result_is_ignored ()
AsBundleKind | asc_result_get_bundle_kind ()
void | asc_result_set_bundle_kind ()
const gchar * | asc_result_get_bundle_id ()
void | asc_result_set_bundle_id ()
AsComponent * | asc_result_get_component ()
GPtrArray * | asc_result_fetch_components ()
GPtrArray * | asc_result_get_hints ()
GPtrArray * | asc_result_fetch_hints_all ()
const gchar ** | asc_result_get_component_ids_with_hints ()
gboolean | asc_result_update_component_gcid ()
gboolean | asc_result_update_component_gcid_with_string ()
const gchar * | asc_result_gcid_for_cid ()
const gchar * | asc_result_gcid_for_component ()
const gchar ** | asc_result_get_component_gcids ()
gboolean | asc_result_add_component ()
gboolean | asc_result_add_component_with_string ()
gboolean | asc_result_remove_component ()
gboolean | asc_result_remove_component_full ()
gboolean | asc_result_remove_component_by_id ()
void | asc_result_remove_hints_for_cid ()
gboolean | asc_result_has_hint ()
gboolean | asc_result_add_hint_by_cid ()
gboolean | asc_result_add_hint_by_cid_v ()
gboolean | asc_result_add_hint ()
gboolean | asc_result_add_hint_simple ()
gboolean | asc_result_add_hint_v ()

## Types and Values

#define | ASC_TYPE_RESULT
struct | AscResultClass
| AscResult

## Includes

    #include <appstream-compose.h>

## Description

## Functions

### asc_result_new ()

    AscResult *
    asc_result_new (void);

Creates a new AscResult.

### asc_result_unit_ignored ()

    gboolean
    asc_result_unit_ignored (AscResult *result);

#### Parameters

result | an AscResult instance. |

#### Returns

`TRUE` if this result means the analyzed unit was ignored entirely.

### asc_result_components_count ()

    guint
    asc_result_components_count (AscResult *result);

#### Parameters

result | an AscResult instance. |

#### Returns

The amount of components found for this unit.

### asc_result_hints_count ()

    guint
    asc_result_hints_count (AscResult *result);

#### Parameters

result | an AscResult instance. |

#### Returns

The amount of hints emitted for this unit.

### asc_result_is_ignored ()

    gboolean
    asc_result_is_ignored (AscResult *result,
                           AsComponent *cpt);

Check if an AsComponent was set to be ignored in this result (usually due to errors).

#### Parameters

result | an AscResult instance. |
cpt | the component to check for. |

#### Returns

`TRUE` if the component is ignored.

### asc_result_get_bundle_kind ()

    AsBundleKind
    asc_result_get_bundle_kind (AscResult *result);

Gets the bundle kind these results are for.

#### Parameters

result | an AscResult instance. |

### asc_result_set_bundle_kind ()

    void
    asc_result_set_bundle_kind (AscResult *result,
                                AsBundleKind kind);

Sets the kind of the bundle these results are for.

#### Parameters

result | an AscResult instance. |

### asc_result_get_bundle_id ()

    const gchar *
    asc_result_get_bundle_id (AscResult *result);

Gets the ID name of the bundle (a package / Flatpak / any entity containing metadata) that these these results are generated for.

#### Parameters

result | an AscResult instance. |

### asc_result_set_bundle_id ()

    void
    asc_result_set_bundle_id (AscResult *result,
                              const gchar *id);

Sets the name of the bundle these results are for.

#### Parameters

result | an AscResult instance. |
id | The new ID. |

### asc_result_get_component ()

    AsComponent *
    asc_result_get_component (AscResult *result,
                              const gchar *cid);

Gets the component by its component-id-

#### Parameters

result | an AscResult instance. |
cid | Component ID to look for. |

#### Returns

An AsComponent.

[transfer none]

### asc_result_fetch_components ()

    GPtrArray *
    asc_result_fetch_components (AscResult *result);

Gets all components this AsResult instance contains.

#### Parameters

result | an AscResult instance. |

#### Returns

(transfer container) (element-type AsComponent) : An array of AsComponent

### asc_result_get_hints ()

    GPtrArray *
    asc_result_get_hints (AscResult *result,
                          const gchar *cid);

Gets hints for a component with the given component-id.

#### Parameters

result | an AscResult instance. |
cid | Component ID to look for. |

#### Returns

An array of AscHint or `NULL`.

[transfer none][element-type AscHint]

### asc_result_fetch_hints_all ()

    GPtrArray *
    asc_result_fetch_hints_all (AscResult *result);

Get a list of all hints for all components that are registered with this result.

#### Parameters

result | an AscResult instance. |

#### Returns

(transfer container) (element-type AscHint) : An array of AscHint

### asc_result_get_component_ids_with_hints ()

    const gchar **
    asc_result_get_component_ids_with_hints
                                   (AscResult *result);

Gets list of component-IDs which do have issue hints associated with them.

#### Parameters

result | an AscResult instance. |

#### Returns

An array of component-IDs. Free container with `g_free`.

[transfer container]

### asc_result_update_component_gcid ()

    gboolean
    asc_result_update_component_gcid (AscResult *result,
                                      AsComponent *cpt,
                                      GBytes *bytes);

Update the global component ID for the given component.

#### Parameters

result | an AscResult instance. |
cpt | The AsComponent to edit. |
bytes | The data to include in the global component ID, or `NULL`. | [nullable]

#### Returns

`TRUE` if the component existed and was updated.

### asc_result_update_component_gcid_with_string ()

    gboolean
    asc_result_update_component_gcid_with_string
                                   (AscResult *result,
                                    AsComponent *cpt,
                                    const gchar *data);

Update the global component ID for the given component. This is a convenience method for `asc_result_update_component_gcid`

#### Parameters

result | an AscResult instance. |
cpt | The AsComponent to edit. |
data | The data as string to include in the global component ID, or `NULL`. | [nullable]

#### Returns

`TRUE` if the component existed and was updated.

### asc_result_gcid_for_cid ()

    const gchar *
    asc_result_gcid_for_cid (AscResult *result,
                             const gchar *cid);

Retrieve the global component-ID string for the given component-ID, as long as component with the given ID is registered with this AscResult. Otherwise, `NULL` is returned.

#### Parameters

result | an AscResult instance. |
cid | Component ID to look for. |

### asc_result_gcid_for_component ()

    const gchar *
    asc_result_gcid_for_component (AscResult *result,
                                   AsComponent *cpt);

### asc_result_get_component_gcids ()

    const gchar **
    asc_result_get_component_gcids (AscResult *result);

Retrieve a list of all global component-IDs that this result knows of.

#### Parameters

result | an AscResult instance. |

#### Returns

An array of global component IDs. Free with `g_free`.

[transfer container]

### asc_result_add_component ()

    gboolean
    asc_result_add_component (AscResult *result,
                              AsComponent *cpt,
                              GBytes *bytes,
                              GError **error);

Add component to the results set.

#### Parameters

result | an AscResult instance. |
cpt | The AsComponent to add. |
bytes | Source data used to generate the GCID hash, or `NULL` if nonexistent. |
error | A GError or `NULL` |

#### Returns

`TRUE` on success.

### asc_result_add_component_with_string ()

    gboolean
    asc_result_add_component_with_string (AscResult *result,
                                          AsComponent *cpt,
                                          const gchar *data,
                                          GError **error);

Add component to the results set, using string data.

#### Parameters

result | an AscResult instance. |
cpt | The AsComponent to add. |
data | Source data used to generate the GCID hash, or `NULL` if nonexistent. |
error | A GError or `NULL` |

#### Returns

`TRUE` on success.

### asc_result_remove_component ()

    gboolean
    asc_result_remove_component (AscResult *result,
                                 AsComponent *cpt);

Remove a component from the results set.

#### Parameters

result | an AscResult instance. |
cpt | The AsComponent to remove. |

#### Returns

`TRUE` if the component was found and removed.

### asc_result_remove_component_full ()

    gboolean
    asc_result_remove_component_full (AscResult *result,
                                      AsComponent *cpt,
                                      gboolean remove_gcid);

Remove a component from the results set.

#### Parameters

result | an AscResult instance. |
cpt | The AsComponent to remove. |
remove_gcid | `TRUE` if global component ID should be unregistered as well. |

#### Returns

`TRUE` if the component was found and removed.

### asc_result_remove_component_by_id ()

    gboolean
    asc_result_remove_component_by_id (AscResult *result,
                                       const gchar *cid);

Remove a component from the results set.

#### Parameters

result | an AscResult instance. |
cid | a component-ID |

#### Returns

`TRUE` if the component was found and removed.

### asc_result_remove_hints_for_cid ()

    void
    asc_result_remove_hints_for_cid (AscResult *result,
                                     const gchar *cid);

Remove all hints that we have associated with the selected component-ID.

#### Parameters

result | an AscResult instance. |
cid | The component ID |

### asc_result_has_hint ()

    gboolean
    asc_result_has_hint (AscResult *result,
                         AsComponent *cpt,
                         const gchar *tag);

Test if a hint tag is associated with a given component in this result.

#### Parameters

result | an AscResult instance. |
cpt | the AsComponent to check |
tag | the hint tag to check for |

#### Returns

`TRUE` if a hint with this tag exists for the selected component.

### asc_result_add_hint_by_cid ()

    gboolean
    asc_result_add_hint_by_cid (AscResult *result,
                                const gchar *component_id,
                                const gchar *tag,
                                const gchar *key1,
                                ...);

Add an issue hint for a component.

[skip]

#### Parameters

result | an AscResult instance. |
component_id | The component-ID of the affected AsComponent |
tag | AppStream Compose Issue hint tag |
key1 | First key to add a value for, or `NULL` |
... | replacement keys and values for the issue explanation, terminated by `NULL` |

#### Returns

`TRUE` if the added hint did not cause the component to be invalidated.

### asc_result_add_hint_by_cid_v ()

    gboolean
    asc_result_add_hint_by_cid_v (AscResult *result,
                                  const gchar *component_id,
                                  const gchar *tag,
                                  gchar **kv);

Add an issue hint for a component.

[rename-to asc_result_add_hint_by_cid]

#### Parameters

result | an AscResult instance. |
component_id | The component-ID of the affected AsComponent |
tag | AppStream Compose Issue hint tag |
kv | List of key-value pairs for replacement variables. |

#### Returns

`TRUE` if the added hint did not cause the component to be invalidated.

### asc_result_add_hint ()

    gboolean
    asc_result_add_hint (AscResult *result,
                         AsComponent *cpt,
                         const gchar *tag,
                         const gchar *key1,
                         ...);

Add an issue hint for a component.

[skip]

#### Parameters

result | an AscResult instance. |
cpt | The affected AsComponent |
tag | AppStream Compose Issue hint tag |
key1 | First key to add a value for, or `NULL` |
... | replacement keys and values for the issue explanation, terminated by `NULL` |

#### Returns

`TRUE` if the added hint did not cause the component to be invalidated.

### asc_result_add_hint_simple ()

    gboolean
    asc_result_add_hint_simple (AscResult *result,
                                AsComponent *cpt,
                                const gchar *tag);

Add an issue hint which does not have any variables to replace in its explanation text for a component.

[skip]

#### Parameters

result | an AscResult instance. |
cpt | The affected AsComponent |
tag | AppStream Compose Issue hint tag |

#### Returns

`TRUE` if the added hint did not cause the component to be invalidated.

### asc_result_add_hint_v ()

    gboolean
    asc_result_add_hint_v (AscResult *result,
                           AsComponent *cpt,
                           const gchar *tag,
                           gchar **kv);

Add an issue hint for a component.

[rename-to asc_result_add_hint]

#### Parameters

result | an AscResult instance. |
cpt | The affected AsComponent |
tag | AppStream Compose Issue hint tag |
kv | List of key-value pairs for replacement variables. |

#### Returns

`TRUE` if the added hint did not cause the component to be invalidated.

## Types and Values

### ASC_TYPE_RESULT

    #define ASC_TYPE_RESULT (asc_result_get_type ())

### struct AscResultClass

    struct AscResultClass {
    	GObjectClass parent_class;
    };

### AscResult

    typedef struct _AscResult AscResult;