diff options
Diffstat (limited to 'src/gui/RDFS.cpp')
-rw-r--r-- | src/gui/RDFS.cpp | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index ed8d7e8c..64aa893b 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -26,9 +26,7 @@ #include <utility> -namespace ingen { -namespace gui { -namespace rdfs { +namespace ingen::gui::rdfs { std::string label(World& world, const LilvNode* node) @@ -76,10 +74,10 @@ closure(World& world, const LilvNode* pred, URISet& types, bool super) world.lilv_world(), type, pred, nullptr) : lilv_world_find_nodes( world.lilv_world(), nullptr, pred, type); - LILV_FOREACH(nodes, m, matches) { + LILV_FOREACH (nodes, m, matches) { const LilvNode* klass_node = lilv_nodes_get(matches, m); if (lilv_node_is_uri(klass_node)) { - URI klass(lilv_node_as_uri(klass_node)); + const URI klass{lilv_node_as_uri(klass_node)}; if (!types.count(klass)) { ++added; klasses.insert(klass); @@ -118,20 +116,17 @@ datatypes(World& world, URISet& types, bool super) URISet types(World& world, const std::shared_ptr<const client::ObjectModel>& model) { - using PropIter = Properties::const_iterator; - using PropRange = std::pair<PropIter, PropIter>; - // Start with every rdf:type URISet types; types.insert(URI(LILV_NS_RDFS "Resource")); - PropRange range = model->properties().equal_range(world.uris().rdf_type); + const auto range = model->properties().equal_range(world.uris().rdf_type); for (auto t = range.first; t != range.second; ++t) { if (t->second.type() == world.forge().URI || t->second.type() == world.forge().URID) { const URI type(world.forge().str(t->second, false)); types.insert(type); if (world.uris().ingen_Graph == type) { - // Add lv2:Plugin as a type for graphs so plugin properties show up + // Add lv2:Plugin as a type so plugin properties show up types.insert(world.uris().lv2_Plugin); } } else { @@ -149,8 +144,8 @@ URISet properties(World& world, const std::shared_ptr<const client::ObjectModel>& model) { - URISet properties; - URISet types = rdfs::types(world, model); + URISet properties; + const URISet types = rdfs::types(world, model); LilvNode* rdf_type = lilv_new_uri(world.lilv_world(), LILV_NS_RDF "type"); @@ -161,13 +156,13 @@ properties(World& world, LilvNodes* props = lilv_world_find_nodes( world.lilv_world(), nullptr, rdf_type, rdf_Property); - LILV_FOREACH(nodes, p, props) { + LILV_FOREACH (nodes, p, props) { const LilvNode* prop = lilv_nodes_get(props, p); if (lilv_node_is_uri(prop)) { LilvNodes* domains = lilv_world_find_nodes( world.lilv_world(), prop, rdfs_domain, nullptr); unsigned n_matching_domains = 0; - LILV_FOREACH(nodes, d, domains) { + LILV_FOREACH (nodes, d, domains) { const LilvNode* domain_node = lilv_nodes_get(domains, d); if (!lilv_node_is_uri(domain_node)) { // TODO: Blank node domains (e.g. unions) @@ -208,7 +203,7 @@ instances(World& world, const URISet& types) LilvNode* type = lilv_new_uri(world.lilv_world(), t.c_str()); LilvNodes* objects = lilv_world_find_nodes( world.lilv_world(), nullptr, rdf_type, type); - LILV_FOREACH(nodes, o, objects) { + LILV_FOREACH (nodes, o, objects) { const LilvNode* object = lilv_nodes_get(objects, o); if (!lilv_node_is_uri(object)) { continue; @@ -233,7 +228,7 @@ range(World& world, const LilvNode* prop, bool recursive) world.lilv_world(), prop, rdfs_range, nullptr); URISet ranges; - LILV_FOREACH(nodes, n, nodes) { + LILV_FOREACH (nodes, n, nodes) { if (lilv_node_is_uri(lilv_nodes_get(nodes, n))) { ranges.insert(URI(lilv_node_as_string(lilv_nodes_get(nodes, n)))); } @@ -260,6 +255,4 @@ is_a(World& world, const LilvNode* inst, const LilvNode* klass) return is_instance; } -} // namespace rdfs -} // namespace gui -} // namespace ingen +} // namespace ingen::gui::rdfs |