LMMS
Loading...
Searching...
No Matches
Utilities

Classes

struct  LV2_Atom_Object_Query

Functions

static uint32_t lv2_atom_pad_size (uint32_t size)
static uint32_t lv2_atom_total_size (const LV2_Atom *atom)
static bool lv2_atom_is_null (const LV2_Atom *atom)
static bool lv2_atom_equals (const LV2_Atom *a, const LV2_Atom *b)
static voidlv2_features_data (const LV2_Feature *const *features, const char *const uri)
static const char * lv2_features_query (const LV2_Feature *const *features,...)

Object Query

static const LV2_Atom_Object_Query LV2_ATOM_OBJECT_QUERY_END = { 0, NULL }
static int lv2_atom_object_query (const LV2_Atom_Object *object, LV2_Atom_Object_Query *query)
static int lv2_atom_object_body_get (uint32_t size, const LV2_Atom_Object_Body *body,...)
static int lv2_atom_object_get (const LV2_Atom_Object *object,...)
static int lv2_atom_object_get_typed (const LV2_Atom_Object *object,...)

Object Query

static const LV2_Atom_Object_Query LV2_ATOM_OBJECT_QUERY_END = {0, NULL}

Sequence Iterator

static const LV2_Atom_Eventlv2_atom_sequence_begin (const LV2_Atom_Sequence_Body *body)
static const LV2_Atom_Eventlv2_atom_sequence_end (const LV2_Atom_Sequence_Body *body, uint32_t size)
static LV2_Atom_Eventlv2_atom_sequence_end2 (LV2_Atom_Sequence_Body *body, uint32_t size)
static bool lv2_atom_sequence_is_end (const LV2_Atom_Sequence_Body *body, uint32_t size, const LV2_Atom_Event *i)
static const LV2_Atom_Eventlv2_atom_sequence_next (const LV2_Atom_Event *i)

Sequence Utilities

static void lv2_atom_sequence_clear (LV2_Atom_Sequence *seq)
static LV2_Atom_Eventlv2_atom_sequence_append_event (LV2_Atom_Sequence *seq, uint32_t capacity, const LV2_Atom_Event *event)

Tuple Iterator

static const LV2_Atomlv2_atom_tuple_begin (const LV2_Atom_Tuple *tup)
static bool lv2_atom_tuple_is_end (const void *body, uint32_t size, const LV2_Atom *i)
static const LV2_Atomlv2_atom_tuple_next (const LV2_Atom *i)

Object Iterator

static const LV2_Atom_Property_Bodylv2_atom_object_begin (const LV2_Atom_Object_Body *body)
static bool lv2_atom_object_is_end (const LV2_Atom_Object_Body *body, uint32_t size, const LV2_Atom_Property_Body *i)
static const LV2_Atom_Property_Bodylv2_atom_object_next (const LV2_Atom_Property_Body *i)

Sequence Iterator

#define LV2_ATOM_SEQUENCE_FOREACH(seq, iter)
#define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter)
#define LV2_ATOM_SEQUENCE_FOREACH(seq, iter)
#define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter)

Tuple Iterator

#define LV2_ATOM_TUPLE_FOREACH(tuple, iter)
#define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter)
#define LV2_ATOM_TUPLE_FOREACH(tuple, iter)
#define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter)

Object Iterator

#define LV2_ATOM_OBJECT_FOREACH(obj, iter)
#define LV2_ATOM_OBJECT_BODY_FOREACH(body, size, iter)
#define LV2_ATOM_OBJECT_FOREACH(obj, iter)
#define LV2_ATOM_OBJECT_BODY_FOREACH(body, size, iter)

Detailed Description

Utilities for working with atoms.

Macro Definition Documentation

◆ LV2_ATOM_OBJECT_BODY_FOREACH [1/2]

#define LV2_ATOM_OBJECT_BODY_FOREACH ( body,
size,
iter )
Value:
for (const LV2_Atom_Property_Body* iter = lv2_atom_object_begin(body); \
!lv2_atom_object_is_end(body, size, (iter)); \
iter = lv2_atom_object_next(iter))
static const LV2_Atom_Property_Body * lv2_atom_object_begin(const LV2_Atom_Object_Body *body)
Definition atom-util.h:248
static bool lv2_atom_object_is_end(const LV2_Atom_Object_Body *body, uint32_t size, const LV2_Atom_Property_Body *i)
Definition atom-util.h:255
static const LV2_Atom_Property_Body * lv2_atom_object_next(const LV2_Atom_Property_Body *i)
Definition atom-util.h:264
Definition atom.h:183
ulg size
Definition extract.c:2350

Like LV2_ATOM_OBJECT_FOREACH but for a headerless object body.

◆ LV2_ATOM_OBJECT_BODY_FOREACH [2/2]

#define LV2_ATOM_OBJECT_BODY_FOREACH ( body,
size,
iter )
Value:
!lv2_atom_object_is_end(body, size, (iter)); \
(iter) = lv2_atom_object_next(iter))

Like LV2_ATOM_OBJECT_FOREACH but for a headerless object body.

◆ LV2_ATOM_OBJECT_FOREACH [1/2]

#define LV2_ATOM_OBJECT_FOREACH ( obj,
iter )
Value:
for (const LV2_Atom_Property_Body* iter = lv2_atom_object_begin(&(obj)->body); \
!lv2_atom_object_is_end(&(obj)->body, (obj)->atom.size, (iter)); \
iter = lv2_atom_object_next(iter))

A macro for iterating over all properties of an Object.

Parameters
objThe object to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), e.g.:

// Do something with prop (an LV2_Atom_Property_Body*) here...
}
register unsigned i
Definition inflate.c:1575
#define LV2_ATOM_OBJECT_FOREACH(obj, iter)
Definition atom-util.h:285

A macro for iterating over all properties of an Object.

Parameters
objThe object to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), for example:

// Do something with i (an LV2_Atom_Property_Body*) here...
}

◆ LV2_ATOM_OBJECT_FOREACH [2/2]

#define LV2_ATOM_OBJECT_FOREACH ( obj,
iter )
Value:
for (LV2_Atom_Property_Body * (iter) = lv2_atom_object_begin(&(obj)->body); \
!lv2_atom_object_is_end(&(obj)->body, (obj)->atom.size, (iter)); \
(iter) = lv2_atom_object_next(iter))

A macro for iterating over all properties of an Object.

Parameters
objThe object to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), for example:

// Do something with i (an LV2_Atom_Property_Body*) here...
}

◆ LV2_ATOM_SEQUENCE_BODY_FOREACH [1/2]

#define LV2_ATOM_SEQUENCE_BODY_FOREACH ( body,
size,
iter )
Value:
for (const LV2_Atom_Event* iter = lv2_atom_sequence_begin(body); \
!lv2_atom_sequence_is_end(body, size, (iter)); \
iter = lv2_atom_sequence_next(iter))
static const LV2_Atom_Event * lv2_atom_sequence_next(const LV2_Atom_Event *i)
Definition atom-util.h:113
static const LV2_Atom_Event * lv2_atom_sequence_begin(const LV2_Atom_Sequence_Body *body)
Definition atom-util.h:83
static bool lv2_atom_sequence_is_end(const LV2_Atom_Sequence_Body *body, uint32_t size, const LV2_Atom_Event *i)
Definition atom-util.h:104
Definition atom.h:210

Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body.

◆ LV2_ATOM_SEQUENCE_BODY_FOREACH [2/2]

#define LV2_ATOM_SEQUENCE_BODY_FOREACH ( body,
size,
iter )
Value:
for (LV2_Atom_Event * (iter) = lv2_atom_sequence_begin(body); \
!lv2_atom_sequence_is_end(body, size, (iter)); \
(iter) = lv2_atom_sequence_next(iter))

Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body.

◆ LV2_ATOM_SEQUENCE_FOREACH [1/2]

#define LV2_ATOM_SEQUENCE_FOREACH ( seq,
iter )
Value:
for (const LV2_Atom_Event* iter = lv2_atom_sequence_begin(&(seq)->body); \
!lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \
iter = lv2_atom_sequence_next(iter))

A macro for iterating over all events in a Sequence.

Parameters
seqThe sequence to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), e.g.:

// Do something with ev (an LV2_Atom_Event*) here...
}
#define LV2_ATOM_SEQUENCE_FOREACH(seq, iter)
Definition atom-util.h:132

A macro for iterating over all events in a Sequence.

Parameters
seqThe sequence to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), for example:

// Do something with ev (an LV2_Atom_Event*) here...
}

◆ LV2_ATOM_SEQUENCE_FOREACH [2/2]

#define LV2_ATOM_SEQUENCE_FOREACH ( seq,
iter )
Value:
for (LV2_Atom_Event * (iter) = lv2_atom_sequence_begin(&(seq)->body); \
!lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \
(iter) = lv2_atom_sequence_next(iter))

A macro for iterating over all events in a Sequence.

Parameters
seqThe sequence to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), for example:

// Do something with ev (an LV2_Atom_Event*) here...
}

◆ LV2_ATOM_TUPLE_BODY_FOREACH [1/2]

#define LV2_ATOM_TUPLE_BODY_FOREACH ( body,
size,
iter )
Value:
for (const LV2_Atom* iter = (const LV2_Atom*)body; \
!lv2_atom_tuple_is_end(body, size, (iter)); \
iter = lv2_atom_tuple_next(iter))
static const LV2_Atom * lv2_atom_tuple_next(const LV2_Atom *i)
Definition atom-util.h:211
static bool lv2_atom_tuple_is_end(const void *body, uint32_t size, const LV2_Atom *i)
Definition atom-util.h:204
Definition atom.h:106

Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body.

◆ LV2_ATOM_TUPLE_BODY_FOREACH [2/2]

#define LV2_ATOM_TUPLE_BODY_FOREACH ( body,
size,
iter )
Value:
for (LV2_Atom * (iter) = (LV2_Atom*)(body); \
!lv2_atom_tuple_is_end(body, size, (iter)); \
(iter) = lv2_atom_tuple_next(iter))

Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body.

◆ LV2_ATOM_TUPLE_FOREACH [1/2]

#define LV2_ATOM_TUPLE_FOREACH ( tuple,
iter )
Value:
for (const LV2_Atom* iter = lv2_atom_tuple_begin(tuple); \
!lv2_atom_tuple_is_end(LV2_ATOM_BODY_CONST(tuple), (tuple)->atom.size, (iter)); \
iter = lv2_atom_tuple_next(iter))
#define LV2_ATOM_BODY_CONST(atom)
Definition atom.h:103
static const LV2_Atom * lv2_atom_tuple_begin(const LV2_Atom_Tuple *tup)
Definition atom-util.h:197

A macro for iterating over all properties of a Tuple.

Parameters
tupleThe tuple to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), e.g.:

LV2_ATOM_TUPLE_FOREACH(tuple, elem) {
// Do something with elem (an LV2_Atom*) here...
}
#define LV2_ATOM_TUPLE_FOREACH(tuple, iter)
Definition atom-util.h:229

A macro for iterating over all properties of a Tuple.

Parameters
tupleThe tuple to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), for example:

LV2_ATOM_TUPLE_FOREACH(tuple, elem) {
// Do something with elem (an LV2_Atom*) here...
}

◆ LV2_ATOM_TUPLE_FOREACH [2/2]

#define LV2_ATOM_TUPLE_FOREACH ( tuple,
iter )
Value:
for (LV2_Atom * (iter) = lv2_atom_tuple_begin(tuple); \
LV2_ATOM_BODY(tuple), (tuple)->atom.size, (iter)); \
(iter) = lv2_atom_tuple_next(iter))
#define LV2_ATOM_BODY(atom)
Definition atom.h:98

A macro for iterating over all properties of a Tuple.

Parameters
tupleThe tuple to iterate over
iterThe name of the iterator

This macro is used similarly to a for loop (which it expands to), for example:

LV2_ATOM_TUPLE_FOREACH(tuple, elem) {
// Do something with elem (an LV2_Atom*) here...
}

Function Documentation

◆ lv2_atom_equals()

bool lv2_atom_equals ( const LV2_Atom * a,
const LV2_Atom * b )
inlinestatic

Return true iff a is equal to b.

◆ lv2_atom_is_null()

bool lv2_atom_is_null ( const LV2_Atom * atom)
inlinestatic

Return true iff Atom is null.

◆ lv2_atom_object_begin()

const LV2_Atom_Property_Body * lv2_atom_object_begin ( const LV2_Atom_Object_Body * body)
inlinestatic

Return a pointer to the first property in body.

◆ lv2_atom_object_body_get()

int lv2_atom_object_body_get ( uint32_t size,
const LV2_Atom_Object_Body * body,
... )
inlinestatic

Body only version of lv2_atom_object_get().

◆ lv2_atom_object_get()

int lv2_atom_object_get ( const LV2_Atom_Object * object,
... )
inlinestatic

Variable argument version of lv2_atom_object_query().

This is nicer-looking in code, but a bit more error-prone since it is not type safe and the argument list must be terminated.

The arguments should be a series of uint32_t key and const LV2_Atom** value pairs, terminated by a zero key. The value pointers MUST be initialized to NULL. For example:

const LV2_Atom* name = NULL;
const LV2_Atom* age = NULL;
uris.name_key, &name,
uris.age_key, &age,
0);
#define NULL
Definition CarlaBridgeFormat.cpp:30
static char ** uris
Definition atom-test-utils.c:27
static const char * name
Definition pugl.h:1582
static int lv2_atom_object_get(const LV2_Atom_Object *object,...)
Definition atom-util.h:420

◆ lv2_atom_object_get_typed()

int lv2_atom_object_get_typed ( const LV2_Atom_Object * object,
... )
inlinestatic

Variable argument version of lv2_atom_object_query() with types.

This is like lv2_atom_object_get(), but each entry has an additional parameter to specify the required type. Only atoms with a matching type will be selected.

The arguments should be a series of uint32_t key, const LV2_Atom**, uint32_t type triples, terminated by a zero key. The value pointers MUST be initialized to NULL. For example:

const LV2_Atom_Int* age = NULL;
uris.name_key, &name, uris.atom_String,
uris.age_key, &age, uris.atom_Int
0);
Definition atom.h:112
Definition atom.h:145

◆ lv2_atom_object_is_end()

bool lv2_atom_object_is_end ( const LV2_Atom_Object_Body * body,
uint32_t size,
const LV2_Atom_Property_Body * i )
inlinestatic

Return true iff i has reached the end of obj.

◆ lv2_atom_object_next()

const LV2_Atom_Property_Body * lv2_atom_object_next ( const LV2_Atom_Property_Body * i)
inlinestatic

Return an iterator to the property following i.

◆ lv2_atom_object_query()

int lv2_atom_object_query ( const LV2_Atom_Object * object,
LV2_Atom_Object_Query * query )
inlinestatic

Get an object's values for various keys.

The value pointer of each item in query will be set to the location of the corresponding value in object. Every value pointer in query MUST be initialised to NULL. This function reads object in a single linear sweep. By allocating query on the stack, objects can be "queried" quickly without allocating any memory. This function is realtime safe.

This function can only do "flat" queries, it is not smart enough to match variables in nested objects.

For example:

const LV2_Atom* name = NULL;
const LV2_Atom* age = NULL;
{ urids.eg_name, &name },
{ urids.eg_age, &age },
};
// name and age are now set to the appropriate values in obj, or NULL.
static const LV2_Atom_Object_Query LV2_ATOM_OBJECT_QUERY_END
Definition atom-util.h:308
static int lv2_atom_object_query(const LV2_Atom_Object *object, LV2_Atom_Object_Query *query)
Definition atom-util.h:336
Definition atom-util.h:303
register uch * q
Definition fileio.c:817

◆ lv2_atom_pad_size()

uint32_t lv2_atom_pad_size ( uint32_t size)
inlinestatic

Pad a size to 64 bits.

◆ lv2_atom_sequence_append_event()

LV2_Atom_Event * lv2_atom_sequence_append_event ( LV2_Atom_Sequence * seq,
uint32_t capacity,
const LV2_Atom_Event * event )
inlinestatic

Append an event at the end of sequence.

Parameters
seqSequence to append to.
capacityTotal capacity of the sequence atom (e.g. as set by the host for sequence output ports).
EventEvent to write.
Returns
A pointer to the newly written event in seq, or NULL on failure (insufficient space).

◆ lv2_atom_sequence_begin()

const LV2_Atom_Event * lv2_atom_sequence_begin ( const LV2_Atom_Sequence_Body * body)
inlinestatic

Get an iterator pointing to the first event in a Sequence body.

◆ lv2_atom_sequence_clear()

void lv2_atom_sequence_clear ( LV2_Atom_Sequence * seq)
inlinestatic

Clear all events from sequence.

This simply resets the size field, the other fields are left untouched.

◆ lv2_atom_sequence_end()

const LV2_Atom_Event * lv2_atom_sequence_end ( const LV2_Atom_Sequence_Body * body,
uint32_t size )
inlinestatic

Get an iterator pointing to the end of a Sequence body.

◆ lv2_atom_sequence_end2()

LV2_Atom_Event * lv2_atom_sequence_end2 ( LV2_Atom_Sequence_Body * body,
uint32_t size )
inlinestatic

Get an iterator pointing to the end of a Sequence body.

◆ lv2_atom_sequence_is_end()

bool lv2_atom_sequence_is_end ( const LV2_Atom_Sequence_Body * body,
uint32_t size,
const LV2_Atom_Event * i )
inlinestatic

Return true iff i has reached the end of body.

◆ lv2_atom_sequence_next()

const LV2_Atom_Event * lv2_atom_sequence_next ( const LV2_Atom_Event * i)
inlinestatic

Return an iterator to the element following i.

◆ lv2_atom_total_size()

uint32_t lv2_atom_total_size ( const LV2_Atom * atom)
inlinestatic

Return the total size of Atom, including the header.

◆ lv2_atom_tuple_begin()

const LV2_Atom * lv2_atom_tuple_begin ( const LV2_Atom_Tuple * tup)
inlinestatic

Get an iterator pointing to the first element in tup.

◆ lv2_atom_tuple_is_end()

bool lv2_atom_tuple_is_end ( const void * body,
uint32_t size,
const LV2_Atom * i )
inlinestatic

Return true iff i has reached the end of body.

◆ lv2_atom_tuple_next()

const LV2_Atom * lv2_atom_tuple_next ( const LV2_Atom * i)
inlinestatic

Return an iterator to the element following i.

◆ lv2_features_data()

void * lv2_features_data ( const LV2_Feature *const * features,
const char *const uri )
inlinestatic

Return the data for a feature in a features array.

If the feature is not found, NULL is returned. Note that this function is only useful for features with data, and can not detect features that are present but have NULL data.

◆ lv2_features_query()

const char * lv2_features_query ( const LV2_Feature *const * features,
... )
inlinestatic

Query a features array.

This function allows getting several features in one call, and detect missing required features, with the same caveat of lv2_features_data().

The arguments should be a series of const char* uri, void** data, bool required, terminated by a NULL URI. The data pointers MUST be initialized to NULL. For example:

LV2_URID_Log* log = NULL;
const char* missing = lv2_features_query(
features,
LV2_LOG__log, &log, false,
LV2_URID__map, &map, true,
NULL);
#define LV2_LOG__log
http://lv2plug.in/ns/ext/log#log
Definition log.h:37
#define LV2_URID__map
http://lv2plug.in/ns/ext/urid#map
Definition urid.h:33
static const char * lv2_features_query(const LV2_Feature *const *features,...)
Definition lv2_util.h:77
Definition urid.h:69
Returns
NULL on success, otherwise the URI of this missing feature.

Variable Documentation

◆ LV2_ATOM_OBJECT_QUERY_END [1/2]

const LV2_Atom_Object_Query LV2_ATOM_OBJECT_QUERY_END = { 0, NULL }
static

◆ LV2_ATOM_OBJECT_QUERY_END [2/2]

const LV2_Atom_Object_Query LV2_ATOM_OBJECT_QUERY_END = {0, NULL}
static

Sentinel for lv2_atom_object_query().