From 8ec295a0f2a40086ed83e8d2ad8ad38c8125bcb4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 10 May 2012 04:02:24 +0000 Subject: LV2URIMap => URIMap. Trim unnecessary includes. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4337 a436a847-0d15-0410-975c-d299462d15a1 --- src/shared/AtomReader.cpp | 3 +- src/shared/AtomWriter.cpp | 3 +- src/shared/Builder.cpp | 8 ++-- src/shared/Forge.cpp | 3 +- src/shared/LV2Features.cpp | 2 +- src/shared/LV2URIMap.cpp | 105 -------------------------------------------- src/shared/ResourceImpl.cpp | 5 +-- src/shared/URIMap.cpp | 105 ++++++++++++++++++++++++++++++++++++++++++++ src/shared/URIs.cpp | 7 +-- src/shared/World.cpp | 22 +++++----- src/shared/wscript | 2 +- 11 files changed, 133 insertions(+), 132 deletions(-) delete mode 100644 src/shared/LV2URIMap.cpp create mode 100644 src/shared/URIMap.cpp (limited to 'src/shared') diff --git a/src/shared/AtomReader.cpp b/src/shared/AtomReader.cpp index 45b60c35..dc2aa15c 100644 --- a/src/shared/AtomReader.cpp +++ b/src/shared/AtomReader.cpp @@ -17,6 +17,7 @@ #include #include "ingen/shared/AtomReader.hpp" +#include "ingen/shared/URIMap.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/Path.hpp" #include "raul/log.hpp" @@ -24,7 +25,7 @@ namespace Ingen { namespace Shared { -AtomReader::AtomReader(LV2URIMap& map, URIs& uris, Forge& forge, Interface& iface) +AtomReader::AtomReader(URIMap& map, URIs& uris, Forge& forge, Interface& iface) : _map(map) , _uris(uris) , _forge(forge) diff --git a/src/shared/AtomWriter.cpp b/src/shared/AtomWriter.cpp index 8d88ef11..ab65f435 100644 --- a/src/shared/AtomWriter.cpp +++ b/src/shared/AtomWriter.cpp @@ -16,6 +16,7 @@ #include "ingen/shared/AtomSink.hpp" #include "ingen/shared/AtomWriter.hpp" +#include "ingen/shared/URIMap.hpp" #include "raul/Path.hpp" #include "serd/serd.h" @@ -40,7 +41,7 @@ forge_deref(LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref) return (LV2_Atom*)(chunk->buf + ref - 1); } -AtomWriter::AtomWriter(LV2URIMap& map, URIs& uris, AtomSink& sink) +AtomWriter::AtomWriter(URIMap& map, URIs& uris, AtomSink& sink) : _map(map) , _uris(uris) , _sink(sink) diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index 272a3394..b0f095ca 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -14,18 +14,16 @@ along with Ingen. If not, see . */ -#include "raul/Atom.hpp" -#include "raul/Path.hpp" - -#include "ingen/Interface.hpp" #include "ingen/Connection.hpp" +#include "ingen/Interface.hpp" #include "ingen/Node.hpp" #include "ingen/Patch.hpp" #include "ingen/Plugin.hpp" #include "ingen/Port.hpp" #include "ingen/shared/Builder.hpp" -#include "ingen/shared/LV2URIMap.hpp" #include "ingen/shared/URIs.hpp" +#include "raul/Atom.hpp" +#include "raul/Path.hpp" using namespace std; using namespace Raul; diff --git a/src/shared/Forge.cpp b/src/shared/Forge.cpp index fc8116c6..c481b50e 100644 --- a/src/shared/Forge.cpp +++ b/src/shared/Forge.cpp @@ -17,11 +17,12 @@ #include #include "ingen/shared/Forge.hpp" +#include "ingen/shared/URIMap.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" namespace Ingen { -Forge::Forge(Shared::LV2URIMap& map) +Forge::Forge(Shared::URIMap& map) { Int = map.map_uri(LV2_ATOM__Int); Float = map.map_uri(LV2_ATOM__Float); diff --git a/src/shared/LV2Features.cpp b/src/shared/LV2Features.cpp index 0b1b7b3c..1bfd3936 100644 --- a/src/shared/LV2Features.cpp +++ b/src/shared/LV2Features.cpp @@ -17,7 +17,7 @@ #include #include "ingen/shared/LV2Features.hpp" -#include "ingen/shared/LV2URIMap.hpp" +#include "ingen/shared/URIMap.hpp" using namespace std; diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp deleted file mode 100644 index dae8bd69..00000000 --- a/src/shared/LV2URIMap.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#define __STDC_LIMIT_MACROS 1 - -#include -#include - -#include - -#include - -#include "ingen/shared/LV2URIMap.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" -#include "raul/log.hpp" - -using namespace std; -using namespace Raul; - -namespace Ingen { -namespace Shared { - -LV2URIMap::LV2URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap) - : _urid_map_feature(new URIDMapFeature(this, map)) - , _urid_unmap_feature(new URIDUnmapFeature(this, unmap)) -{ -} - -LV2URIMap::URIDMapFeature::URIDMapFeature(LV2URIMap* map, - LV2_URID_Map* impl) - : Feature(LV2_URID__map, &urid_map) -{ - if (impl) { - urid_map = *impl; - } else { - urid_map.map = default_map; - urid_map.handle = NULL; - } -} - -LV2_URID -LV2URIMap::URIDMapFeature::default_map(LV2_URID_Map_Handle handle, - const char* uri) -{ - return static_cast(g_quark_from_string(uri)); -} - -LV2_URID -LV2URIMap::URIDMapFeature::map(const char* uri) -{ - return urid_map.map(urid_map.handle, uri); -} - -LV2URIMap::URIDUnmapFeature::URIDUnmapFeature(LV2URIMap* map, - LV2_URID_Unmap* impl) - : Feature(LV2_URID__unmap, &urid_unmap) -{ - if (impl) { - urid_unmap = *impl; - } else { - urid_unmap.unmap = default_unmap; - urid_unmap.handle = NULL; - } -} - -const char* -LV2URIMap::URIDUnmapFeature::default_unmap(LV2_URID_Unmap_Handle handle, - LV2_URID urid) -{ - return g_quark_to_string(urid); -} - -const char* -LV2URIMap::URIDUnmapFeature::unmap(LV2_URID urid) -{ - return urid_unmap.unmap(urid_unmap.handle, urid); -} - -uint32_t -LV2URIMap::map_uri(const char* uri) -{ - return _urid_map_feature->map(uri); -} - -const char* -LV2URIMap::unmap_uri(uint32_t urid) -{ - return _urid_unmap_feature->unmap(urid); -} - -} // namespace Shared -} // namespace Ingen diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 5ec07b13..9bf7384e 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -14,11 +14,10 @@ along with Ingen. If not, see . */ -#include "raul/log.hpp" -#include "raul/Atom.hpp" -#include "ingen/shared/LV2URIMap.hpp" #include "ingen/shared/ResourceImpl.hpp" #include "ingen/shared/URIs.hpp" +#include "raul/Atom.hpp" +#include "raul/log.hpp" using namespace std; using namespace Raul; diff --git a/src/shared/URIMap.cpp b/src/shared/URIMap.cpp new file mode 100644 index 00000000..144941e9 --- /dev/null +++ b/src/shared/URIMap.cpp @@ -0,0 +1,105 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#define __STDC_LIMIT_MACROS 1 + +#include +#include + +#include + +#include + +#include "ingen/shared/URIMap.hpp" +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" +#include "raul/log.hpp" + +using namespace std; +using namespace Raul; + +namespace Ingen { +namespace Shared { + +URIMap::URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap) + : _urid_map_feature(new URIDMapFeature(this, map)) + , _urid_unmap_feature(new URIDUnmapFeature(this, unmap)) +{ +} + +URIMap::URIDMapFeature::URIDMapFeature(URIMap* map, + LV2_URID_Map* impl) + : Feature(LV2_URID__map, &urid_map) +{ + if (impl) { + urid_map = *impl; + } else { + urid_map.map = default_map; + urid_map.handle = NULL; + } +} + +LV2_URID +URIMap::URIDMapFeature::default_map(LV2_URID_Map_Handle handle, + const char* uri) +{ + return static_cast(g_quark_from_string(uri)); +} + +LV2_URID +URIMap::URIDMapFeature::map(const char* uri) +{ + return urid_map.map(urid_map.handle, uri); +} + +URIMap::URIDUnmapFeature::URIDUnmapFeature(URIMap* map, + LV2_URID_Unmap* impl) + : Feature(LV2_URID__unmap, &urid_unmap) +{ + if (impl) { + urid_unmap = *impl; + } else { + urid_unmap.unmap = default_unmap; + urid_unmap.handle = NULL; + } +} + +const char* +URIMap::URIDUnmapFeature::default_unmap(LV2_URID_Unmap_Handle handle, + LV2_URID urid) +{ + return g_quark_to_string(urid); +} + +const char* +URIMap::URIDUnmapFeature::unmap(LV2_URID urid) +{ + return urid_unmap.unmap(urid_unmap.handle, urid); +} + +uint32_t +URIMap::map_uri(const char* uri) +{ + return _urid_map_feature->map(uri); +} + +const char* +URIMap::unmap_uri(uint32_t urid) +{ + return _urid_unmap_feature->unmap(urid); +} + +} // namespace Shared +} // namespace Ingen diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp index 058e4216..56189ed5 100644 --- a/src/shared/URIs.cpp +++ b/src/shared/URIs.cpp @@ -23,11 +23,12 @@ #include +#include "ingen/shared/URIMap.hpp" #include "ingen/shared/URIs.hpp" -#include "lv2/lv2plug.in/ns/lv2core/lv2.h" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "lv2/lv2plug.in/ns/ext/midi/midi.h" #include "lv2/lv2plug.in/ns/ext/patch/patch.h" +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" #include "raul/log.hpp" using namespace std; @@ -36,7 +37,7 @@ using namespace Raul; namespace Ingen { namespace Shared { -URIs::Quark::Quark(Ingen::Forge& forge, LV2URIMap* map, const char* c_str) +URIs::Quark::Quark(Ingen::Forge& forge, URIMap* map, const char* c_str) : Raul::URI(c_str) , id(map->map_uri(c_str)) , atom(forge.alloc_uri(c_str)) @@ -47,7 +48,7 @@ URIs::Quark::Quark(Ingen::Forge& forge, LV2URIMap* map, const char* c_str) #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" -URIs::URIs(Ingen::Forge& f, LV2URIMap* map) +URIs::URIs(Ingen::Forge& f, URIMap* map) : forge(f) , atom_AtomPort (forge, map, LV2_ATOM__AtomPort) , atom_Blank (forge, map, LV2_ATOM__Blank) diff --git a/src/shared/World.cpp b/src/shared/World.cpp index d2d5f74c..1d47100a 100644 --- a/src/shared/World.cpp +++ b/src/shared/World.cpp @@ -31,7 +31,7 @@ #include "ingen/shared/World.hpp" #include "ingen/shared/runtime_paths.hpp" #include "ingen/shared/LV2Features.hpp" -#include "ingen/shared/LV2URIMap.hpp" +#include "ingen/shared/URIMap.hpp" #include "ingen/shared/URIs.hpp" #define LOG(s) s << "[Module] " @@ -109,14 +109,14 @@ public: , conf(conf) , lv2_features(NULL) , rdf_world(new Sord::World()) - , lv2_uri_map(new Ingen::Shared::LV2URIMap(map, unmap)) - , forge(new Ingen::Forge(*lv2_uri_map)) - , uris(new Shared::URIs(*forge, lv2_uri_map.get())) + , uri_map(new Ingen::Shared::URIMap(map, unmap)) + , forge(new Ingen::Forge(*uri_map)) + , uris(new Shared::URIs(*forge, uri_map.get())) , lilv_world(lilv_world_new()) { lv2_features = new Ingen::Shared::LV2Features(); - lv2_features->add_feature(lv2_uri_map->urid_map_feature()); - lv2_features->add_feature(lv2_uri_map->urid_unmap_feature()); + lv2_features->add_feature(uri_map->urid_map_feature()); + lv2_features->add_feature(uri_map->urid_unmap_feature()); lilv_world_load_all(lilv_world); // Set up RDF namespaces @@ -173,7 +173,7 @@ public: Raul::Configuration* conf; LV2Features* lv2_features; Sord::World* rdf_world; - SharedPtr lv2_uri_map; + SharedPtr uri_map; Ingen::Forge* forge; SharedPtr uris; SharedPtr engine; @@ -218,10 +218,10 @@ Raul::Configuration* World::conf() { return _impl->conf; Ingen::Forge& World::forge() { return *_impl->forge; } LV2Features* World::lv2_features() { return _impl->lv2_features; } -LilvWorld* World::lilv_world() { return _impl->lilv_world; } -Sord::World* World::rdf_world() { return _impl->rdf_world; } -SharedPtr World::uris() { return _impl->uris; } -SharedPtr World::lv2_uri_map() { return _impl->lv2_uri_map; } +LilvWorld* World::lilv_world() { return _impl->lilv_world; } +Sord::World* World::rdf_world() { return _impl->rdf_world; } +SharedPtr World::uris() { return _impl->uris; } +SharedPtr World::uri_map() { return _impl->uri_map; } /** Load an Ingen module. * @return true on success, false on failure diff --git a/src/shared/wscript b/src/shared/wscript index 3a122306..15e6097e 100644 --- a/src/shared/wscript +++ b/src/shared/wscript @@ -20,10 +20,10 @@ def build(bld): Configuration.cpp Forge.cpp LV2Features.cpp - LV2URIMap.cpp Module.cpp ResourceImpl.cpp Store.cpp + URIMap.cpp URIs.cpp World.cpp runtime_paths.cpp -- cgit v1.2.1