aboutsummaryrefslogtreecommitdiffstats
path: root/ext/atom.lv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-10-27 01:31:16 +0000
committerDavid Robillard <d@drobilla.net>2010-10-27 01:31:16 +0000
commitea48658a1d2f35a7bb88b31841e3ec45f29a604c (patch)
tree72c898424f668859323bd531aecfc8a97b4ffe7b /ext/atom.lv2
parent97bf8024d67baa23fb5ca6da32e0e4abf64dbe15 (diff)
downloadlv2-ea48658a1d2f35a7bb88b31841e3ec45f29a604c.tar.xz
Add atom:BlankID atom type (for references to local anonymous objects).
Simplify object iteration API.
Diffstat (limited to 'ext/atom.lv2')
-rw-r--r--ext/atom.lv2/atom-helpers.h13
-rw-r--r--ext/atom.lv2/atom.ttl13
2 files changed, 17 insertions, 9 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");
}
-
}
}
}
diff --git a/ext/atom.lv2/atom.ttl b/ext/atom.lv2/atom.ttl
index 186268c..7702d21 100644
--- a/ext/atom.lv2/atom.ttl
+++ b/ext/atom.lv2/atom.ttl
@@ -165,7 +165,7 @@ char str[] = "&lt;http://example.org/foo&gt; a &lt;http://example.org/Thing&
atom:ID a rdfs:Class ;
rdfs:subClassOf atom:Atom ;
- rdfs:label "Integer ID mapped from a URI" ;
+ rdfs:label "Integer ID mapped from a URI" ;
rdfs:comment """
An unsigned 32-bit integer mapped from a URI using the
<a href="http://lv2plug.in/ns/ext/uri-map">URI Map</a> extension's
@@ -174,6 +174,17 @@ with <code>map = NULL</code>.
""" .
+atom:BlankID a rdfs:Class ;
+ rdfs:subClassOf atom:Atom ;
+ rdfs:label "Integer ID for a blank node" ;
+ rdfs:comment """
+An unsigned 32-bit integer identifier for a blank node. A BlankID is only
+meaningful within a limited scope (e.g. the Atom in which it appears), and
+MUST NOT be used as a global identifier. In particular, a BlankID is NOT an
+ID, and can not be mapped to/from a URI.
+""" .
+
+
atom:Vector a rdfs:Class ;
rdfs:subClassOf atom:Atom ;
rdfs:label "Vector" ;