AsComponentBox

AsComponentBox — A collection of components that are managed together.

Functions

Types and Values

Includes

#include <appstream.h>

Description

This class is a container for AsComponent objects which usually share the same AsContext and are manipulated together. It also provides binding-safe accessor functions to manipulate an array of components.

See also: AsComponent

Functions

as_component_box_new ()

AsComponentBox *
as_component_box_new (AsComponentBoxFlags flags);

Creates a new AsComponentBox.

Returns

an AsComponentBox.

[transfer full]

Since: 1.0

as_component_box_new_simple ()

AsComponentBox *
as_component_box_new_simple (void);

Creates a new AsComponentBox with the simplest parameters, so it is basically an array storage without overhead.

Only the most basic checks on inserted components will be performed, and it is assumed that the inserted components have been checked already prior to insertion.

Returns

an AsComponentBox.

[transfer full]

as_component_box_index()

#define             as_component_box_index(cbox, index_)

Returns the AsComponent at the given index of the array.

This does not perform bounds checking on the given index_ , so you are responsible for checking it against the array length. Use as_component_box_len to determine the amount of components present in the AsComponentBox.

Parameters

cbox

a AsComponentBox

 

index_

the index of the AsComponent to return

 

Returns

the AsComponent at the given index.

[transfer none]

as_component_box_len()

#define as_component_box_len(cbox) (cbox)->cpts->len

Get the amount of components in its box array.

Parameters

cbox

a AsComponentBox

 

Returns

Size of components in AsComponentBox.

as_component_box_array ()

GPtrArray *
as_component_box_array (AsComponentBox *cbox);

Get the contents of this component box as GPtrArray.

Parameters

cbox

An instance of AsComponentBox.

 

Returns

an array of AsComponent instances.

[transfer none][element-type AsComponent]

as_component_box_get_flags ()

AsComponentBoxFlags
as_component_box_get_flags (AsComponentBox *cbox);

Get the flags this component box was constructed with.

Parameters

cbox

An instance of AsComponentBox.

 

Returns

The AsComponentBoxFlags that are in effect.

as_component_box_get_size ()

guint
as_component_box_get_size (AsComponentBox *cbox);

Get the amount of components in this box.

Parameters

cbox

An instance of AsComponentBox.

 

Returns

Amount of components.

as_component_box_index_safe ()

AsComponent *
as_component_box_index_safe (AsComponentBox *cbox,
                             guint index);

Retrieve a component at the expective index from the internal component array.

Parameters

cbox

An instance of AsComponentBox.

 

index

The component index.

 

Returns

An AsComponent or NULL.

[transfer none]

as_component_box_is_empty ()

gboolean
as_component_box_is_empty (AsComponentBox *cbox);

Check if there are any components present.

Parameters

cbox

An instance of AsComponentBox.

 

Returns

TRUE if this component box is empty.

as_component_box_add ()

gboolean
as_component_box_add (AsComponentBox *cbox,
                      AsComponent *cpt,
                      GError **error);

Add a component to the box. Returns an error if we could not add it (most likely due to component box constraints).

Parameters

cbox

An instance of AsComponentBox.

 

Returns

TRUE on success.

as_component_box_sort ()

void
as_component_box_sort (AsComponentBox *cbox);

Sort components to bring them into a deterministic order.

Parameters

cbox

An instance of AsComponentBox.

 

as_component_box_sort_by_score ()

void
as_component_box_sort_by_score (AsComponentBox *cbox);

Sort components by their (search) match score.

Parameters

cbox

An instance of AsComponentBox.

 

Types and Values

enum AsComponentBoxFlags

Flags controlling the component box behavior.

Members

AS_COMPONENT_BOX_FLAG_NONE

No flags.

 

AS_COMPONENT_BOX_FLAG_NO_CHECKS

Only perform the most basic verification.