diff options
author | David Robillard <d@drobilla.net> | 2010-10-27 01:31:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-10-27 01:31:16 +0000 |
commit | ea48658a1d2f35a7bb88b31841e3ec45f29a604c (patch) | |
tree | 72c898424f668859323bd531aecfc8a97b4ffe7b /ext/atom.lv2/atom-helpers.h | |
parent | 97bf8024d67baa23fb5ca6da32e0e4abf64dbe15 (diff) | |
download | lv2-ea48658a1d2f35a7bb88b31841e3ec45f29a604c.tar.xz |
Add atom:BlankID atom type (for references to local anonymous objects).
Simplify object iteration API.
Diffstat (limited to 'ext/atom.lv2/atom-helpers.h')
-rw-r--r-- | ext/atom.lv2/atom-helpers.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ext/atom.lv2/atom-helpers.h b/ext/atom.lv2/atom-helpers.h index 5c98a3f..787d0c7 100644 --- a/ext/atom.lv2/atom-helpers.h +++ b/ext/atom.lv2/atom-helpers.h @@ -48,9 +48,9 @@ typedef LV2_Atom_Property* LV2_Object_Iter; /** Get an iterator pointing to @a prop in some LV2_Object */ static inline LV2_Object_Iter -lv2_object_get_iter(LV2_Atom_Property* prop) +lv2_object_begin(LV2_Atom* obj) { - return (LV2_Object_Iter)prop; + return (LV2_Object_Iter)(((LV2_Object*)obj->body)->properties); } /** Return true iff @a iter has reached the end of @a object */ @@ -94,7 +94,7 @@ lv2_object_iter_get(LV2_Object_Iter iter) * </pre> */ #define LV2_OBJECT_FOREACH(obj, iter) \ - for (LV2_Object_Iter (iter) = lv2_object_get_iter((LV2_Atom_Property*)(obj)->body); \ + for (LV2_Object_Iter (iter) = lv2_object_begin(obj); \ !lv2_object_iter_is_end(obj, (iter)); \ (iter) = lv2_object_iter_next(iter)) @@ -149,10 +149,8 @@ lv2_atom_is_a(LV2_Atom* object, return true; if (object->type == atom_Object) { - for (LV2_Object_Iter i = lv2_object_get_iter((LV2_Atom_Property*)object->body); - !lv2_object_iter_is_end(object, i); - i = lv2_object_iter_next(i)) { - LV2_Atom_Property* prop = lv2_object_iter_get(i); + LV2_OBJECT_FOREACH(object, o) { + LV2_Atom_Property* prop = lv2_object_iter_get(o); if (prop->key == rdf_type) { if (prop->value.type == atom_URIInt) { const uint32_t object_type = *(uint32_t*)prop->value.body; @@ -161,7 +159,6 @@ lv2_atom_is_a(LV2_Atom* object, } else { fprintf(stderr, "error: rdf:type is not a URIInt\n"); } - } } } |