OsinfoFilter: Libosinfo Reference Manual

## OsinfoFilter OsinfoFilter — An entity filter |

## Functions

OsinfoFilter * | osinfo_filter_new ()
void | osinfo_filter_add_constraint ()
void | osinfo_filter_clear_constraint ()
void | osinfo_filter_clear_constraints ()
GList * | osinfo_filter_get_constraint_keys ()
GList * | osinfo_filter_get_constraint_values ()
gboolean | osinfo_filter_matches ()

## Types and Values

#define | OSINFO_TYPE_FILTER
struct | OsinfoFilterClass

## Description

OsinfoFilter provides a way to filter OsinfoEntity instances based on their parameter values.

## Functions

### osinfo_filter_new ()

    OsinfoFilter *
    osinfo_filter_new (void);

Construct a new filter that matches all entities

#### Returns

a filter object.

[transfer full]

### osinfo_filter_add_constraint ()

    void
    osinfo_filter_add_constraint (OsinfoFilter *filter,
                                  const gchar *propName,
                                  const gchar *propVal);

Adds a constraint that requires the entity to have a property key `propName` with a value of `propVal` . If multiple constraints are added for the same `propName` , with different values, the entity have all property values.

#### Parameters

filter | a filter object |
propName | the name of the parameter key |
propVal | the required property value |

### osinfo_filter_clear_constraint ()

    void
    osinfo_filter_clear_constraint (OsinfoFilter *filter,
                                    const gchar *propName);

Remove all filter constraints for the matching property name.

#### Parameters

filter | a filter object |
propName | name of the key to remove constraints for |

### osinfo_filter_clear_constraints ()

    void
    osinfo_filter_clear_constraints (OsinfoFilter *filter);

Remove all filter property constraints

#### Parameters

filter | a filter object |

### osinfo_filter_get_constraint_keys ()

    GList *
    osinfo_filter_get_constraint_keys (OsinfoFilter *filter);

Get a list of all constraint property keys

#### Parameters

filter | a filter object |

#### Returns

List of constraint keys.

[transfer container][element-type utf8]

### osinfo_filter_get_constraint_values ()

    GList *
    osinfo_filter_get_constraint_values (OsinfoFilter *filter,
                                         const gchar *propName);

Get a list values for filter constraints with the named key

#### Parameters

filter | a filter object |
propName | the name of the key |

#### Returns

List of constraint values.

[transfer container][element-type utf8]

### osinfo_filter_matches ()

    gboolean
    osinfo_filter_matches (OsinfoFilter *filter,
                           OsinfoEntity *entity);

Determine of an entity matches a filter

#### Parameters

filter | a filter object |
entity | an entity to query |

#### Returns

TRUE if entity passes the filter, FALSE otherwise

## Types and Values

### OSINFO_TYPE_FILTER

    #define OSINFO_TYPE_FILTER (osinfo_filter_get_type ())

### struct OsinfoFilterClass

    struct OsinfoFilterClass {
        GObjectClass parent_class;

        gboolean (*matches)(OsinfoFilter *filter, OsinfoEntity *entity);
    };

## See Also

OsinfoEntity