Collections — Lilv 0.24.20 documentation

# Collections

Lilv has several collection types for holding various types of value.

Each collection type supports a similar basic API, except `LilvPlugins` which is internal and thus lacks a free function:

- void PREFIX_free (coll)

- unsigned PREFIX_size (coll)

- LilvIter* PREFIX_begin (coll)

The types of collection are:

- LilvPlugins, with function prefix `lilv_plugins_`.

- LilvPluginClasses, with function prefix `lilv_plugin_classes_`.

- LilvScalePoints, with function prefix `lilv_scale_points_`.

- LilvNodes, with function prefix `lilv_nodes_`.

- LilvUIs, with function prefix `lilv_uis_`.

void lilv_plugin_classes_free(LilvPluginClasses *collection)

unsigned lilv_plugin_classes_size(const LilvPluginClasses *collection)

LilvIter *lilv_plugin_classes_begin(const LilvPluginClasses *collection)

const LilvPluginClass *lilv_plugin_classes_get(const LilvPluginClasses *collection, LilvIter *i)

LilvIter *lilv_plugin_classes_next(const LilvPluginClasses *collection, LilvIter *i)

bool lilv_plugin_classes_is_end(const LilvPluginClasses *collection, LilvIter *i)

const LilvPluginClass *lilv_plugin_classes_get_by_uri(const LilvPluginClasses *classes, const LilvNode *uri)

  Get a plugin class from `classes` by URI.

  Return value is shared (stored in `classes`) and must not be freed or modified by the caller in any way.

  Returns:

    NULL if no plugin class with `uri` is found in `classes`.

void lilv_scale_points_free(LilvScalePoints *collection)

unsigned lilv_scale_points_size(const LilvScalePoints *collection)

LilvIter *lilv_scale_points_begin(const LilvScalePoints *collection)

const LilvScalePoint *lilv_scale_points_get(const LilvScalePoints *collection, LilvIter *i)

LilvIter *lilv_scale_points_next(const LilvScalePoints *collection, LilvIter *i)

bool lilv_scale_points_is_end(const LilvScalePoints *collection, LilvIter *i)

void lilv_uis_free(LilvUIs *collection)

unsigned lilv_uis_size(const LilvUIs *collection)

LilvIter *lilv_uis_begin(const LilvUIs *collection)

const LilvUI *lilv_uis_get(const LilvUIs *collection, LilvIter *i)

LilvIter *lilv_uis_next(const LilvUIs *collection, LilvIter *i)

bool lilv_uis_is_end(const LilvUIs *collection, LilvIter *i)

const LilvUI *lilv_uis_get_by_uri(const LilvUIs *uis, const LilvNode *uri)

  Get a UI from `uis` by URI.

  Return value is shared (stored in `uis`) and must not be freed or modified by the caller in any way.

  Returns:

    NULL if no UI with `uri` is found in `list`.

void lilv_nodes_free(LilvNodes *collection)

unsigned lilv_nodes_size(const LilvNodes *collection)

LilvIter *lilv_nodes_begin(const LilvNodes *collection)

const LilvNode *lilv_nodes_get(const LilvNodes *collection, LilvIter *i)

LilvIter *lilv_nodes_next(const LilvNodes *collection, LilvIter *i)

bool lilv_nodes_is_end(const LilvNodes *collection, LilvIter *i)

LilvNode *lilv_nodes_get_first(const LilvNodes *collection)

bool lilv_nodes_contains(const LilvNodes *nodes, const LilvNode *value)

  Return whether `values` contains `value`.

LilvNodes *lilv_nodes_merge(const LilvNodes *a, const LilvNodes *b)

  Return a new LilvNodes that contains all nodes from both `a` and `b`.

unsigned lilv_plugins_size(const LilvPlugins *collection)

LilvIter *lilv_plugins_begin(const LilvPlugins *collection)

const LilvPlugin *lilv_plugins_get(const LilvPlugins *collection, LilvIter *i)

LilvIter *lilv_plugins_next(const LilvPlugins *collection, LilvIter *i)

bool lilv_plugins_is_end(const LilvPlugins *collection, LilvIter *i)

const LilvPlugin *lilv_plugins_get_by_uri(const LilvPlugins *plugins, const LilvNode *uri)

  Get a plugin from `plugins` by URI.

  Return value is shared (stored in `plugins`) and must not be freed or modified by the caller in any way.

  Returns:

    NULL if no plugin with `uri` is found in `plugins`.

LILV_FOREACH

  Iterate over each element of a collection.

      LILV_FOREACH(plugin_classes, i, classes) {
         LilvPluginClass c = lilv_plugin_classes_get(classes, i);
         // ...
      }