summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-14 04:23:23 +0000
committerDavid Robillard <d@drobilla.net>2012-08-14 04:23:23 +0000
commit80fee5c311fdbdeda573ec81f59158a5fc87d0a1 (patch)
tree8e7e5a6c9bda32bbe0ae8e8c9f6ab23e44c7c181
parent058eaf65642268047a984a5c80d54a1f62a85130 (diff)
downloadingen-80fee5c311fdbdeda573ec81f59158a5fc87d0a1.tar.gz
ingen-80fee5c311fdbdeda573ec81f59158a5fc87d0a1.tar.bz2
ingen-80fee5c311fdbdeda573ec81f59158a5fc87d0a1.zip
Update for latest Raul.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4687 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--ingen/AtomWriter.hpp4
-rw-r--r--ingen/ClashAvoider.hpp2
-rw-r--r--ingen/GraphObject.hpp8
-rw-r--r--ingen/Plugin.hpp8
-rw-r--r--ingen/Resource.hpp6
-rw-r--r--ingen/Store.hpp2
-rw-r--r--ingen/World.hpp5
-rw-r--r--ingen/client/ClientStore.hpp2
-rw-r--r--ingen/client/PatchModel.hpp3
-rw-r--r--ingen/client/PortModel.hpp12
-rw-r--r--ingen/client/SigClientInterface.hpp2
-rw-r--r--ingen/client/ThreadedSigClientInterface.hpp2
-rw-r--r--src/AtomReader.cpp19
-rw-r--r--src/AtomWriter.cpp2
-rw-r--r--src/ClashAvoider.cpp10
-rw-r--r--src/Store.cpp15
-rw-r--r--src/URIMap.cpp7
-rw-r--r--src/World.cpp9
-rw-r--r--src/client/ClientStore.cpp21
-rw-r--r--src/client/NodeModel.cpp2
-rw-r--r--src/client/ObjectModel.cpp2
-rw-r--r--src/client/PluginModel.cpp20
-rw-r--r--src/client/PortModel.cpp4
-rw-r--r--src/gui/BreadCrumbs.cpp8
-rw-r--r--src/gui/ConnectWindow.cpp37
-rw-r--r--src/gui/LoadPluginWindow.cpp16
-rw-r--r--src/gui/NewSubpatchWindow.cpp7
-rw-r--r--src/gui/NodeMenu.cpp7
-rw-r--r--src/gui/NodeModule.cpp2
-rw-r--r--src/gui/PatchBox.cpp4
-rw-r--r--src/gui/PatchCanvas.cpp22
-rw-r--r--src/gui/PatchTreeWindow.cpp2
-rw-r--r--src/gui/PortMenu.cpp2
-rw-r--r--src/gui/PortPropertiesWindow.cpp2
-rw-r--r--src/gui/PropertiesWindow.cpp14
-rw-r--r--src/gui/RenameWindow.cpp14
-rw-r--r--src/gui/ThreadedLoader.cpp2
-rw-r--r--src/gui/WindowFactory.cpp2
-rw-r--r--src/gui/ingen_gui_lv2.cpp4
-rw-r--r--src/ingen/main.cpp6
-rw-r--r--src/serialisation/Parser.cpp41
-rw-r--r--src/serialisation/Serialiser.cpp16
-rw-r--r--src/server/Broadcaster.hpp2
-rw-r--r--src/server/Context.cpp2
-rw-r--r--src/server/Engine.cpp10
-rw-r--r--src/server/Event.hpp2
-rw-r--r--src/server/EventWriter.hpp2
-rw-r--r--src/server/GraphObjectImpl.cpp11
-rw-r--r--src/server/GraphObjectImpl.hpp2
-rw-r--r--src/server/InternalPlugin.cpp16
-rw-r--r--src/server/InternalPlugin.hpp6
-rw-r--r--src/server/LV2Node.cpp2
-rw-r--r--src/server/LV2Plugin.cpp4
-rw-r--r--src/server/LV2Plugin.hpp6
-rw-r--r--src/server/NodeFactory.cpp6
-rw-r--r--src/server/PatchImpl.cpp5
-rw-r--r--src/server/PatchPlugin.hpp8
-rw-r--r--src/server/PluginImpl.hpp7
-rw-r--r--src/server/PortImpl.cpp4
-rw-r--r--src/server/PortType.hpp10
-rw-r--r--src/server/events/CreateNode.cpp5
-rw-r--r--src/server/events/Move.cpp9
-rw-r--r--src/server/ingen_lv2.cpp4
-rw-r--r--src/server/internals/Controller.cpp3
-rw-r--r--src/server/internals/Delay.cpp3
-rw-r--r--src/server/internals/Note.cpp3
-rw-r--r--src/server/internals/Trigger.cpp3
-rw-r--r--src/socket/Socket.cpp31
-rw-r--r--src/socket/Socket.hpp34
-rw-r--r--src/socket/SocketClient.hpp4
-rw-r--r--src/socket/SocketListener.cpp6
-rw-r--r--src/socket/ingen_socket_client.cpp11
-rw-r--r--tests/ingen_test.cpp7
73 files changed, 302 insertions, 301 deletions
diff --git a/ingen/AtomWriter.hpp b/ingen/AtomWriter.hpp
index ebfece4c..63c86028 100644
--- a/ingen/AtomWriter.hpp
+++ b/ingen/AtomWriter.hpp
@@ -36,7 +36,9 @@ public:
AtomWriter(URIMap& map, URIs& uris, AtomSink& sink);
~AtomWriter() {}
- Raul::URI uri() const { return "http://drobilla.net/ns/ingen#AtomWriter"; }
+ Raul::URI uri() const {
+ return Raul::URI("http://drobilla.net/ns/ingen#AtomWriter");
+ }
void bundle_begin();
diff --git a/ingen/ClashAvoider.hpp b/ingen/ClashAvoider.hpp
index 66b860c2..db3c1b60 100644
--- a/ingen/ClashAvoider.hpp
+++ b/ingen/ClashAvoider.hpp
@@ -44,7 +44,7 @@ public:
ClashAvoider(Store& store, Interface& target, Store* also_avoid=NULL)
: _store(store), _target(target), _also_avoid(also_avoid) {}
- Raul::URI uri() const { return "ingen:ClientStore"; }
+ Raul::URI uri() const { return Raul::URI("ingen:ClientStore"); }
void set_target(Interface& target) { _target = target; }
diff --git a/ingen/GraphObject.hpp b/ingen/GraphObject.hpp
index fef73c6e..048aaebd 100644
--- a/ingen/GraphObject.hpp
+++ b/ingen/GraphObject.hpp
@@ -66,15 +66,17 @@ public:
static Raul::URI root_uri() { return Raul::URI("ingen:root"); }
static bool uri_is_path(const Raul::URI& uri) {
- return uri.substr(0, root_uri().length()) == root_uri().str();
+ return uri.substr(0, root_uri().length()) == root_uri();
}
static Raul::Path uri_to_path(const Raul::URI& uri) {
- return (uri == root_uri()) ? "/" : uri.substr(root_uri().length());
+ return (uri == root_uri())
+ ? Raul::Path("/")
+ : Raul::Path(uri.substr(root_uri().length()));
}
static Raul::URI path_to_uri(const Raul::Path& path) {
- return Raul::URI(root_uri().str() + path.c_str());
+ return Raul::URI(root_uri() + path.c_str());
}
protected:
diff --git a/ingen/Plugin.hpp b/ingen/Plugin.hpp
index 544a2aad..6b0ac63a 100644
--- a/ingen/Plugin.hpp
+++ b/ingen/Plugin.hpp
@@ -41,10 +41,10 @@ public:
static inline const Raul::URI& type_uri(Type type) {
static const Raul::URI uris[] = {
- "http://drobilla.net/ns/ingen#nil",
- LV2_CORE__Plugin,
- "http://drobilla.net/ns/ingen#Internal",
- "http://drobilla.net/ns/ingen#Patch"
+ Raul::URI("http://drobilla.net/ns/ingen#nil"),
+ Raul::URI(LV2_CORE__Plugin),
+ Raul::URI("http://drobilla.net/ns/ingen#Internal"),
+ Raul::URI("http://drobilla.net/ns/ingen#Patch")
};
return uris[type];
diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp
index feb905fb..92f253cd 100644
--- a/ingen/Resource.hpp
+++ b/ingen/Resource.hpp
@@ -49,9 +49,9 @@ public:
static Raul::URI graph_to_uri(Graph g) {
switch (g) {
- case DEFAULT: return NS_INGEN "defaultContext";
- case EXTERNAL: return NS_INGEN "externalContext";
- case INTERNAL: return NS_INGEN "internalContext";
+ case DEFAULT: return Raul::URI(NS_INGEN "defaultContext");
+ case EXTERNAL: return Raul::URI(NS_INGEN "externalContext");
+ case INTERNAL: return Raul::URI(NS_INGEN "internalContext");
}
}
diff --git a/ingen/Store.hpp b/ingen/Store.hpp
index 2f5afa1e..ded18608 100644
--- a/ingen/Store.hpp
+++ b/ingen/Store.hpp
@@ -43,7 +43,7 @@ public:
const_iterator children_end(SharedPtr<const GraphObject> o) const;
SharedPtr<GraphObject> find_child(SharedPtr<const GraphObject> parent,
- const std::string& child_name) const;
+ const Raul::Symbol& symbol) const;
unsigned child_name_offset(const Raul::Path& parent,
const Raul::Symbol& symbol,
diff --git a/ingen/World.hpp b/ingen/World.hpp
index 5d2bddda..68ecd843 100644
--- a/ingen/World.hpp
+++ b/ingen/World.hpp
@@ -22,6 +22,7 @@
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "raul/Noncopyable.hpp"
#include "raul/SharedPtr.hpp"
+#include "raul/URI.hpp"
typedef struct LilvWorldImpl LilvWorld;
@@ -93,7 +94,7 @@ public:
/** A function to create a new remote Interface. */
typedef SharedPtr<Interface> (*InterfaceFactory)(
World* world,
- const std::string& engine_url,
+ const Raul::URI& engine_uri,
SharedPtr<Interface> respondee);
/** Register an InterfaceFactory (for module implementations). */
@@ -106,7 +107,7 @@ public:
* and broadcasts, if applicable.
*/
virtual SharedPtr<Interface> new_interface(
- const std::string& engine_url,
+ const Raul::URI& engine_uri,
SharedPtr<Interface> respondee);
/** Run a script. */
diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp
index 720164d0..3762dcb0 100644
--- a/ingen/client/ClientStore.hpp
+++ b/ingen/client/ClientStore.hpp
@@ -59,7 +59,7 @@ public:
SharedPtr<Interface> engine = SharedPtr<Interface>(),
SharedPtr<SigClientInterface> emitter = SharedPtr<SigClientInterface>());
- Raul::URI uri() const { return "ingen:ClientStore"; }
+ Raul::URI uri() const { return Raul::URI("ingen:clientStore"); }
SharedPtr<const ObjectModel> object(const Raul::Path& path) const;
SharedPtr<const PluginModel> plugin(const Raul::URI& uri) const;
diff --git a/ingen/client/PatchModel.hpp b/ingen/client/PatchModel.hpp
index 64ef3d18..d4c8f511 100644
--- a/ingen/client/PatchModel.hpp
+++ b/ingen/client/PatchModel.hpp
@@ -54,7 +54,8 @@ private:
friend class ClientStore;
PatchModel(URIs& uris, const Raul::Path& patch_path)
- : NodeModel(uris, "http://drobilla.net/ns/ingen#Patch", patch_path)
+ : NodeModel(
+ uris, Raul::URI("http://drobilla.net/ns/ingen#Patch"), patch_path)
{
}
diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp
index 1a5a31be..a59de578 100644
--- a/ingen/client/PortModel.hpp
+++ b/ingen/client/PortModel.hpp
@@ -54,13 +54,13 @@ public:
bool port_property(const Raul::URI& uri) const;
- bool is_logarithmic() const { return port_property(LV2_PORT_PROPS__logarithmic); }
- bool is_enumeration() const { return port_property(LV2_CORE__enumeration); }
- bool is_integer() const { return port_property(LV2_CORE__integer); }
- bool is_toggle() const { return port_property(LV2_CORE__toggled); }
+ bool is_logarithmic() const { return port_property(Raul::URI(LV2_PORT_PROPS__logarithmic)); }
+ bool is_enumeration() const { return port_property(Raul::URI(LV2_CORE__enumeration)); }
+ bool is_integer() const { return port_property(Raul::URI(LV2_CORE__integer)); }
+ bool is_toggle() const { return port_property(Raul::URI(LV2_CORE__toggled)); }
bool is_numeric() const {
- return ObjectModel::is_a(LV2_CORE__ControlPort)
- || ObjectModel::is_a(LV2_CORE__CVPort);
+ return ObjectModel::is_a(Raul::URI(LV2_CORE__ControlPort))
+ || ObjectModel::is_a(Raul::URI(LV2_CORE__CVPort));
}
inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); }
diff --git a/ingen/client/SigClientInterface.hpp b/ingen/client/SigClientInterface.hpp
index 4aef5a40..a330d31e 100644
--- a/ingen/client/SigClientInterface.hpp
+++ b/ingen/client/SigClientInterface.hpp
@@ -45,7 +45,7 @@ class SigClientInterface : public Ingen::Interface,
public:
SigClientInterface() {}
- Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; }
+ Raul::URI uri() const { return Raul::URI("ingen:sigClient"); }
INGEN_SIGNAL(response, void, int32_t, Status, std::string)
INGEN_SIGNAL(bundle_begin, void)
diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp
index c321f438..a6028cc6 100644
--- a/ingen/client/ThreadedSigClientInterface.hpp
+++ b/ingen/client/ThreadedSigClientInterface.hpp
@@ -65,7 +65,7 @@ public:
, property_change_slot(_signal_property_change.make_slot())
{}
- virtual Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; }
+ virtual Raul::URI uri() const { return Raul::URI("ingen:threadedSigClient"); }
void bundle_begin()
{ push_sig(bundle_begin_slot); }
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp
index 127fec13..045660db 100644
--- a/src/AtomReader.cpp
+++ b/src/AtomReader.cpp
@@ -85,8 +85,8 @@ AtomReader::atom_to_path(const LV2_Atom* atom)
{
const char* uri_str = atom_to_uri(atom);
if (uri_str && Raul::URI::is_valid(uri_str) &&
- GraphObject::uri_is_path(uri_str)) {
- return GraphObject::uri_to_path(uri_str);
+ GraphObject::uri_is_path(Raul::URI(uri_str))) {
+ return GraphObject::uri_to_path(Raul::URI(uri_str));
}
return boost::optional<Raul::Path>();
}
@@ -111,8 +111,8 @@ bool
AtomReader::write(const LV2_Atom* msg)
{
if (msg->type != _uris.atom_Blank && msg->type != _uris.atom_Resource) {
- Raul::warn << (Raul::fmt("Unknown message type <%1%>\n")
- % _map.unmap_uri(msg->type)).str();
+ Raul::warn(Raul::fmt("Unknown message type <%1%>\n")
+ % _map.unmap_uri(msg->type));
return false;
}
@@ -124,13 +124,13 @@ AtomReader::write(const LV2_Atom* msg)
if (obj->body.otype == _uris.patch_Get) {
_iface.set_response_id(obj->body.id);
- _iface.get(subject_uri);
+ _iface.get(Raul::URI(subject_uri));
} else if (obj->body.otype == _uris.patch_Delete) {
const LV2_Atom_Object* body = NULL;
lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0);
if (subject_uri && !body) {
- _iface.del(subject_uri);
+ _iface.del(Raul::URI(subject_uri));
return true;
} else if (body && body->body.otype == _uris.ingen_Edge) {
const LV2_Atom* tail = NULL;
@@ -189,7 +189,7 @@ AtomReader::write(const LV2_Atom* msg)
Ingen::Resource::Properties props;
get_props(body, props);
_iface.set_response_id(obj->body.id);
- _iface.put(subject_uri, props);
+ _iface.put(Raul::URI(subject_uri), props);
}
} else if (obj->body.otype == _uris.patch_Set) {
const LV2_Atom_Object* body = NULL;
@@ -205,7 +205,8 @@ AtomReader::write(const LV2_Atom* msg)
LV2_ATOM_OBJECT_FOREACH(body, p) {
Raul::Atom val;
get_atom(&p->value, val);
- _iface.set_property(subject_uri, _map.unmap_uri(p->key), val);
+ _iface.set_property(Raul::URI(subject_uri),
+ Raul::URI(_map.unmap_uri(p->key)), val);
}
} else if (obj->body.otype == _uris.patch_Patch) {
if (!subject) {
@@ -233,7 +234,7 @@ AtomReader::write(const LV2_Atom* msg)
Ingen::Resource::Properties remove_props;
get_props(remove, remove_props);
- _iface.delta(subject_uri, remove_props, add_props);
+ _iface.delta(Raul::URI(subject_uri), remove_props, add_props);
} else if (obj->body.otype == _uris.patch_Move) {
if (!subject) {
Raul::warn << "Move message has no subject" << std::endl;
diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp
index 58b10a5b..466c6a7e 100644
--- a/src/AtomWriter.cpp
+++ b/src/AtomWriter.cpp
@@ -99,7 +99,7 @@ AtomWriter::forge_properties(const Resource::Properties& properties)
i != properties.end(); ++i) {
lv2_atom_forge_property_head(&_forge, _map.map_uri(i->first.c_str()), 0);
if (i->second.type() == _forge.URI) {
- forge_uri(i->second.get_uri());
+ forge_uri(Raul::URI(i->second.get_uri()));
} else {
lv2_atom_forge_atom(&_forge, i->second.size(), i->second.type());
lv2_atom_forge_write(&_forge, i->second.get_body(), i->second.size());
diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp
index 6a21da2c..7af132f5 100644
--- a/src/ClashAvoider.cpp
+++ b/src/ClashAvoider.cpp
@@ -45,7 +45,7 @@ ClashAvoider::map_path(const Raul::Path& in)
unsigned offset = 0;
bool has_offset = false;
- const size_t pos = in.str().find_last_of('_');
+ const size_t pos = in.find_last_of('_');
if (pos != string::npos && pos != (in.length()-1)) {
const std::string trailing = in.substr(pos + 1);
has_offset = (sscanf(trailing.c_str(), "%u", &offset) > 0);
@@ -54,7 +54,7 @@ ClashAvoider::map_path(const Raul::Path& in)
Raul::debug << "OFFSET: " << offset << endl;
// Path without _n suffix
- std::string base_path_str = in.str();
+ std::string base_path_str = in;
if (has_offset) {
base_path_str = base_path_str.substr(0, base_path_str.find_last_of('_'));
}
@@ -75,8 +75,8 @@ ClashAvoider::map_path(const Raul::Path& in)
Raul::debug << "CHECK: " << parent << endl;
SymbolMap::iterator p = _symbol_map.find(parent);
if (p != _symbol_map.end()) {
- const Raul::Path mapped = p->second.base()
- + in.substr(parent.base().length());
+ const Raul::Path mapped = Raul::Path(
+ p->second.base() + in.substr(parent.base().length()));
InsertRecord i = _symbol_map.insert(make_pair(in, mapped));
Raul::debug << " (2) " << i.first->second << endl;
return i.first->second;
@@ -110,7 +110,7 @@ ClashAvoider::map_path(const Raul::Path& in)
std::stringstream ss;
ss << base_path << "_" << offset;
- if (!exists(ss.str())) {
+ if (!exists(Raul::Path(ss.str()))) {
std::string name = base_path.symbol();
if (name == "")
name = "_";
diff --git a/src/Store.cpp b/src/Store.cpp
index e18608c3..c0cb71b8 100644
--- a/src/Store.cpp
+++ b/src/Store.cpp
@@ -61,12 +61,12 @@ Store::children_end(SharedPtr<const GraphObject> o) const
SharedPtr<GraphObject>
Store::find_child(SharedPtr<const GraphObject> parent,
- const string& child_name) const
+ const Raul::Symbol& symbol) const
{
const_iterator pi = find(parent->path());
assert(pi != end());
const_iterator children_end = find_descendants_end(pi);
- const_iterator child = find(pi, children_end, parent->path().base() + child_name);
+ const_iterator child = find(pi, children_end, parent->path().child(symbol));
if (child != end())
return child->second;
else
@@ -83,14 +83,17 @@ Store::child_name_offset(const Raul::Path& parent,
while (true) {
std::stringstream ss;
ss << symbol;
- if (offset > 0)
+ if (offset > 0) {
ss << "_" << offset;
- if (find(parent.base() + ss.str()) == end() && (allow_zero || offset > 0))
+ }
+ if (find(parent.child(Raul::Symbol(ss.str()))) == end() &&
+ (allow_zero || offset > 0)) {
break;
- else if (offset == 0)
+ } else if (offset == 0) {
offset = 2;
- else
+ } else {
++offset;
+ }
}
return offset;
diff --git a/src/URIMap.cpp b/src/URIMap.cpp
index 55a8d6a8..3d55046f 100644
--- a/src/URIMap.cpp
+++ b/src/URIMap.cpp
@@ -18,6 +18,7 @@
#include <glib.h>
+#include "raul/log.hpp"
#include "ingen/URIMap.hpp"
using namespace std;
@@ -52,10 +53,14 @@ URIMap::URIDMapFeature::default_map(LV2_URID_Map_Handle handle,
LV2_URID
URIMap::URIDMapFeature::map(const char* uri)
{
+ if (!Raul::URI::is_valid(uri)) {
+ Raul::warn(Raul::fmt("Attempt to map invalid URI <%1%>\n") % uri);
+ return 0;
+ }
return urid_map.map(urid_map.handle, uri);
}
-URIMap::URIDUnmapFeature::URIDUnmapFeature(URIMap* map,
+URIMap::URIDUnmapFeature::URIDUnmapFeature(URIMap* map,
LV2_URID_Unmap* impl)
: Feature(LV2_URID__unmap, &urid_unmap)
{
diff --git a/src/World.cpp b/src/World.cpp
index 1bf84732..1477544b 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -273,17 +273,16 @@ World::unload_modules()
/** Get an interface for a remote engine at @a url
*/
SharedPtr<Interface>
-World::new_interface(const std::string& engine_url,
+World::new_interface(const Raul::URI& engine_uri,
SharedPtr<Interface> respondee)
{
- const string scheme = engine_url.substr(0, engine_url.find(":"));
- const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme);
+ const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(engine_uri.scheme());
if (i == _impl->interface_factories.end()) {
- Raul::warn << "Unknown URI scheme `" << scheme << "'" << endl;
+ Raul::warn << "Unknown URI scheme `" << engine_uri.scheme() << "'" << endl;
return SharedPtr<Interface>();
}
- return i->second(this, engine_url, respondee);
+ return i->second(this, engine_uri, respondee);
}
/** Run a script of type @a mime_type at filename @a filename */
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index 2c20ec14..eeaa5430 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -218,7 +218,7 @@ ClientStore::del(const Raul::URI& uri)
return;
}
- const Raul::Path path(uri.str());
+ const Raul::Path path(GraphObject::uri_to_path(uri));
SharedPtr<ObjectModel> removed = remove_object(path);
removed.reset();
LOG(Raul::debug) << "Removed object " << path
@@ -248,11 +248,12 @@ ClientStore::move(const Raul::Path& old_path, const Raul::Path& new_path)
assert(Raul::Path::descendant_comparator(old_path, child_old_path));
Raul::Path child_new_path;
- if (child_old_path == old_path)
+ if (child_old_path == old_path) {
child_new_path = new_path;
- else
- child_new_path = new_path.base()
- + child_old_path.substr(old_path.length() + 1);
+ } else {
+ child_new_path = Raul::Path(
+ new_path.base() + child_old_path.substr(old_path.length() + 1));
+ }
LOG(Raul::info)(Raul::fmt("Renamed %1% to %2%\n")
% child_old_path.c_str() % child_new_path.c_str());
@@ -284,9 +285,9 @@ ClientStore::put(const Raul::URI& uri,
// Check if uri is a plugin
Iterator t = properties.find(_uris.rdf_type);
if (t != properties.end() && t->second.type() == _uris.forge.URI) {
- const Raul::Atom& type = t->second;
- const Raul::URI& type_uri = type.get_uri();
- const Plugin::Type plugin_type = Plugin::type_from_uri(type_uri);
+ const Raul::Atom& type(t->second);
+ const Raul::URI type_uri(type.get_uri());
+ const Plugin::Type plugin_type(Plugin::type_from_uri(type_uri));
if (plugin_type == Plugin::Patch) {
is_patch = true;
} else if (plugin_type != Plugin::NIL) {
@@ -323,12 +324,12 @@ ClientStore::put(const Raul::URI& uri,
const Iterator p = properties.find(_uris.ingen_prototype);
SharedPtr<PluginModel> plug;
if (p->second.is_valid() && p->second.type() == _uris.forge.URI) {
- if (!(plug = _plugin(p->second.get_uri()))) {
+ if (!(plug = _plugin(Raul::URI(p->second.get_uri())))) {
LOG(Raul::warn)(Raul::fmt("Unable to find plugin <%1%>\n")
% p->second.get_uri());
plug = SharedPtr<PluginModel>(
new PluginModel(uris(),
- p->second.get_uri(),
+ Raul::URI(p->second.get_uri()),
_uris.ingen_nil,
Resource::Properties()));
add_plugin(plug);
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index dbbb0258..06a3320d 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -230,7 +230,7 @@ NodeModel::label() const
std::string
NodeModel::port_label(SharedPtr<const PortModel> port) const
{
- const Raul::Atom& name = port->get_property(LV2_CORE__name);
+ const Raul::Atom& name = port->get_property(Raul::URI(LV2_CORE__name));
if (name.is_valid()) {
return name.get_string();
}
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index 6904e1f6..cc682936 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -44,7 +44,7 @@ ObjectModel::~ObjectModel()
bool
ObjectModel::is_a(const Raul::URI& type) const
{
- return has_property(_uris.rdf_type, _uris.forge.alloc_uri(type.str()));
+ return has_property(_uris.rdf_type, _uris.forge.alloc_uri(type));
}
void
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 0fb3b859..0f422a89 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -45,19 +45,19 @@ PluginModel::PluginModel(URIs& uris,
const Raul::URI& type_uri,
const Resource::Properties& properties)
: Plugin(uris, uri)
- , _type(type_from_uri(type_uri.str()))
+ , _type(type_from_uri(type_uri))
{
add_properties(properties);
assert(_rdf_world);
- add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
- uris.forge.alloc_uri(this->type_uri().str()));
+ add_property(uris.rdf_type,
+ uris.forge.alloc_uri(this->type_uri()));
LilvNode* plugin_uri = lilv_new_uri(_lilv_world, uri.c_str());
_lilv_plugin = lilv_plugins_get_by_uri(_lilv_plugins, plugin_uri);
lilv_node_free(plugin_uri);
if (_type == Internal) {
- set_property("http://usefulinc.com/ns/doap#name",
+ set_property(uris.doap_name,
uris.forge.alloc(uri.substr(uri.find_last_of('#') + 1)));
}
}
@@ -81,7 +81,7 @@ PluginModel::get_property(const Raul::URI& key) const
if (last_colon != string::npos)
symbol = uri.substr(last_colon + 1);
else
- symbol = uri.str();
+ symbol = uri;
} else if (last_slash == string::npos) {
symbol = uri.substr(last_hash + 1);
} else if (last_hash == string::npos) {
@@ -89,19 +89,19 @@ PluginModel::get_property(const Raul::URI& key) const
} else {
size_t first_delim = std::min(last_slash, last_hash);
size_t last_delim = std::max(last_slash, last_hash);
- if (isalpha(uri.str()[last_delim + 1]))
+ if (isalpha(uri[last_delim + 1]))
symbol = uri.substr(last_delim + 1);
else
symbol = uri.substr(first_delim + 1,
last_delim - first_delim - 1);
}
- set_property(LV2_CORE__symbol, _uris.forge.alloc(symbol));
+ set_property(_uris.lv2_symbol, _uris.forge.alloc(symbol));
return get_property(key);
}
if (_lilv_plugin) {
boost::optional<const Raul::Atom&> ret;
- LilvNode* lv2_pred = lilv_new_uri(_lilv_world, key.str().c_str());
+ LilvNode* lv2_pred = lilv_new_uri(_lilv_world, key.c_str());
LilvNodes* values = lilv_plugin_get_value(_lilv_plugin, lv2_pred);
lilv_node_free(lv2_pred);
LILV_FOREACH(nodes, i, values) {
@@ -155,7 +155,7 @@ PluginModel::set(SharedPtr<PluginModel> p)
Raul::Symbol
PluginModel::default_node_symbol() const
{
- const Raul::Atom& name_atom = get_property(LV2_CORE__symbol);
+ const Raul::Atom& name_atom = get_property(_uris.lv2_symbol);
if (name_atom.is_valid() && name_atom.type() == _uris.forge.String)
return Raul::Symbol::symbolify(name_atom.get_string());
else
@@ -165,7 +165,7 @@ PluginModel::default_node_symbol() const
string
PluginModel::human_name() const
{
- const Raul::Atom& name_atom = get_property("http://usefulinc.com/ns/doap#name");
+ const Raul::Atom& name_atom = get_property(_uris.doap_name);
if (name_atom.type() == _uris.forge.String)
return name_atom.get_string();
else
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index 62579c44..c2493563 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -38,14 +38,14 @@ bool
PortModel::supports(const Raul::URI& value_type) const
{
return has_property(_uris.atom_supports,
- _uris.forge.alloc_uri(value_type.str()));
+ _uris.forge.alloc_uri(value_type));
}
bool
PortModel::port_property(const Raul::URI& uri) const
{
return has_property(_uris.lv2_portProperty,
- _uris.forge.alloc_uri(uri.str()));
+ _uris.forge.alloc_uri(uri));
}
void
diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp
index 8dbb9e21..e496e32b 100644
--- a/src/gui/BreadCrumbs.cpp
+++ b/src/gui/BreadCrumbs.cpp
@@ -88,7 +88,7 @@ BreadCrumbs::build(Path path, SharedPtr<PatchView> view)
if (suffix[0] == '/')
suffix = suffix.substr(1);
const string name = suffix.substr(0, suffix.find("/"));
- _full_path = _full_path.base() + name;
+ _full_path = _full_path.child(Raul::Symbol(name));
BreadCrumb* but = create_crumb(_full_path, view);
pack_start(*but, false, false, 1);
_breadcrumbs.push_back(but);
@@ -116,18 +116,18 @@ BreadCrumbs::build(Path path, SharedPtr<PatchView> view)
_breadcrumbs.clear();
// Add root
- BreadCrumb* root_but = create_crumb("/", view);
+ BreadCrumb* root_but = create_crumb(Raul::Path("/"), view);
pack_start(*root_but, false, false, 1);
_breadcrumbs.push_front(root_but);
root_but->set_active(root_but->path() == _active_path);
- Path working_path = "/";
+ Path working_path("/");
string suffix = path.substr(1);
while (suffix.length() > 0) {
if (suffix[0] == '/')
suffix = suffix.substr(1);
const string name = suffix.substr(0, suffix.find("/"));
- working_path = working_path.base() + name;
+ working_path = working_path.child(Raul::Symbol(name));
BreadCrumb* but = create_crumb(working_path, view);
pack_start(*but, false, false, 1);
_breadcrumbs.push_back(but);
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 3b683cf9..4257b8c5 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string>
+#include <sstream>
#include <gtkmm/stock.h>
@@ -39,8 +40,6 @@ using namespace Ingen::Client;
using namespace std;
using namespace Raul;
-namespace Raul { class Deletable; }
-
namespace Ingen {
namespace GUI {
@@ -164,15 +163,16 @@ ConnectWindow::connect(bool existing)
#ifdef HAVE_SOCKET
if (_mode == CONNECT_REMOTE) {
- string uri = "unix:///tmp/ingen.sock";
+ Raul::URI uri("unix:///tmp/ingen.sock");
if (_widgets_loaded) {
const std::string& user_uri = _url_entry->get_text();
- if (Raul::URI::is_valid(user_uri))
- uri = user_uri;
+ if (Raul::URI::is_valid(user_uri)) {
+ uri = Raul::URI(user_uri);
+ }
}
if (existing) {
- uri = world->interface()->uri().str();
+ uri = world->interface()->uri();
}
SharedPtr<ThreadedSigClientInterface> tsci;
@@ -193,12 +193,13 @@ ConnectWindow::connect(bool existing)
return;
} else if (_mode == LAUNCH_REMOTE) {
int port = _port_spinbutton->get_value_as_int();
- char port_str[8];
- snprintf(port_str, sizeof(port_str), "%u", port);
+ std::stringstream ss;
+ ss << port;
+ const std::string port_str = ss.str();
const string cmd = string("ingen -e -E ").append(port_str);
if (Raul::Process::launch(cmd)) {
- const std::string engine_uri = string("tcp://localhost:").append(port_str);
+ const Raul::URI engine_uri(string("tcp://localhost:") + port_str);
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
world->set_interface(world->new_interface(engine_uri, tsci));
@@ -255,16 +256,16 @@ ConnectWindow::disconnect()
void
ConnectWindow::activate()
{
- _app->interface()->set_property("ingen:driver",
- "ingen:enabled",
+ _app->interface()->set_property(Raul::URI("ingen:driver"),
+ _app->uris().ingen_enabled,
_app->forge().make(true));
}
void
ConnectWindow::deactivate()
{
- _app->interface()->set_property("ingen:driver",
- "ingen:enabled",
+ _app->interface()->set_property(Raul::URI("ingen:driver"),
+ _app->uris().ingen_enabled,
_app->forge().make(false));
}
@@ -390,7 +391,7 @@ ConnectWindow::gtk_callback()
_ping_id = g_random_int();
_app->interface()->set_response_id(_ping_id);
- _app->interface()->get("ingen:engine");
+ _app->interface()->get(Raul::URI("ingen:engine"));
if (_widgets_loaded) {
_progress_label->set_text("Connecting to engine...");
@@ -407,7 +408,7 @@ ConnectWindow::gtk_callback()
(now.tv_usec - last.tv_usec) * 0.001f;
if (ms_since_last > 1000) {
_app->interface()->set_response_id(_ping_id);
- _app->interface()->get("ingen:engine");
+ _app->interface()->get(Raul::URI("ingen:engine"));
last = now;
}
}
@@ -419,18 +420,18 @@ ConnectWindow::gtk_callback()
} else if (_connect_stage == 3) {
if (_app->store()->size() > 0) {
SharedPtr<const PatchModel> root = PtrCast<const PatchModel>(
- _app->store()->object("/"));
+ _app->store()->object(Raul::Path("/")));
if (root) {
set_connected_to(_app->interface());
_app->window_factory()->present_patch(root);
- _app->interface()->get("ingen:plugins");
+ _app->interface()->get(Raul::URI("ingen:plugins"));
if (_widgets_loaded)
_progress_label->set_text(string("Loading plugins..."));
++_connect_stage;
}
}
} else if (_connect_stage == 4) {
- _app->interface()->get("ingen:plugins");
+ _app->interface()->get(Raul::URI("ingen:plugins"));
hide();
if (_widgets_loaded)
_progress_label->set_text("Connected to engine");
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index 691da285..b7e118bd 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -132,12 +132,10 @@ LoadPluginWindow::name_changed()
{
// Toggle add button sensitivity according name legality
if (_selection->get_selected_rows().size() == 1) {
- string name = _node_name_entry->get_text();
- if (!Symbol::is_valid(name)) {
+ const string sym = _node_name_entry->get_text();
+ if (!Symbol::is_valid(sym)) {
_add_button->property_sensitive() = false;
- } else if (_app->store()->find_child(_patch, name)) {
- _add_button->property_sensitive() = false;
- } else if (name.length() == 0) {
+ } else if (_app->store()->find_child(_patch, Symbol(sym))) {
_add_button->property_sensitive() = false;
} else {
_add_button->property_sensitive() = true;
@@ -247,7 +245,7 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row,
break;
}
- row[_plugins_columns._col_uri] = plugin->uri().str();
+ row[_plugins_columns._col_uri] = plugin->uri();
row[_plugins_columns._col_plugin] = plugin;
}
@@ -349,7 +347,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
props.insert(make_pair(uris.rdf_type,
uris.ingen_Node));
props.insert(make_pair(uris.ingen_prototype,
- _app->forge().alloc_uri(plugin->uri().str())));
+ _app->forge().alloc_uri(plugin->uri())));
props.insert(make_pair(uris.ingen_polyphonic,
_app->forge().make(polyphonic)));
_app->interface()->put(GraphObject::path_to_uri(path), props);
@@ -405,10 +403,10 @@ LoadPluginWindow::filter_changed()
field = name.get_string();
break;
case CriteriaColumns::TYPE:
- field = plugin->type_uri().str();
+ field = plugin->type_uri();
break;
case CriteriaColumns::URI:
- field = plugin->uri().str();
+ field = plugin->uri();
break;
default:
throw;
diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp
index 3c1546d5..0026f8ef 100644
--- a/src/gui/NewSubpatchWindow.cpp
+++ b/src/gui/NewSubpatchWindow.cpp
@@ -78,13 +78,10 @@ NewSubpatchWindow::name_changed()
if (!Symbol::is_valid(name)) {
_message_label->set_text("Name contains invalid characters.");
_ok_button->property_sensitive() = false;
- } else if (_app->store()->find(_patch->path().base() + name)
- != _app->store()->end()) {
+ } else if (_app->store()->find(_patch->path().child(Symbol(name)))
+ != _app->store()->end()) {
_message_label->set_text("An object already exists with that name.");
_ok_button->property_sensitive() = false;
- } else if (name.length() == 0) {
- _message_label->set_text("");
- _ok_button->property_sensitive() = false;
} else {
_message_label->set_text("");
_ok_button->property_sensitive() = true;
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index 5c573d9b..08f88c8b 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -129,8 +129,8 @@ NodeMenu::init(App& app, SharedPtr<const Client::NodeModel> node)
else
_randomize_menuitem->hide();
- if (plugin && (plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Controller"
- || plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Trigger"))
+ if (plugin && (plugin->uri() == "http://drobilla.net/ns/ingen-internals#Controller"
+ || plugin->uri() == "http://drobilla.net/ns/ingen-internals#Trigger"))
_learn_menuitem->show();
else
_learn_menuitem->hide();
@@ -200,7 +200,8 @@ NodeMenu::on_preset_activated(const std::string& uri)
const LilvNode* val = lilv_nodes_get_first(values);
const LilvNode* sym = lilv_nodes_get_first(symbols);
_app->interface()->set_property(
- node->path().base() + lilv_node_as_string(sym),
+ GraphObject::path_to_uri(
+ node->path().child(Raul::Symbol(lilv_node_as_string(sym)))),
_app->uris().ingen_value,
_app->forge().make(lilv_node_as_float(val)));
}
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index af63164f..f6df0673 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -321,7 +321,7 @@ NodeModule::popup_gui()
if (!_plugin_ui->is_resizable()) {
_gui_window->set_resizable(false);
}
- _gui_window->set_title(_node->path().str() + " UI - Ingen");
+ _gui_window->set_title(_node->path() + " UI - Ingen");
_gui_window->set_role("plugin_ui");
_gui_window->add(*_gui_widget);
_gui_widget->show_all();
diff --git a/src/gui/PatchBox.cpp b/src/gui/PatchBox.cpp
index 30330fd5..c5a5a6c2 100644
--- a/src/gui/PatchBox.cpp
+++ b/src/gui/PatchBox.cpp
@@ -174,7 +174,7 @@ PatchBox::init_box(App& app)
{
_app = &app;
- std::string engine_name = _app->interface()->uri().str();
+ std::string engine_name = _app->interface()->uri();
if (engine_name == "http://drobilla.net/ns/ingen#internal") {
engine_name = "internal engine";
}
@@ -584,7 +584,7 @@ PatchBox::event_draw()
_view->canvas()->export_dot(filename.c_str());
_status_bar->push(
(boost::format("Rendered %1% to %2%")
- % _patch->path().str() % filename).str(),
+ % _patch->path() % filename).str(),
STATUS_CONTEXT_PATCH);
}
}
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index eaab0b0c..936fb259 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -96,25 +96,27 @@ PatchCanvas::PatchCanvas(App& app,
xml->get_widget("canvas_menu_new_patch", _menu_new_patch);
xml->get_widget("canvas_menu_edit", _menu_edit);
+ const URIs& uris = _app.uris();
+
// Add port menu items
_menu_add_audio_input->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "audio_in", "Audio In", LV2_CORE__AudioPort, false));
+ "audio_in", "Audio In", uris.lv2_AudioPort, false));
_menu_add_audio_output->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "audio_out", "Audio Out", LV2_CORE__AudioPort, true));
+ "audio_out", "Audio Out", uris.lv2_AudioPort, true));
_menu_add_control_input->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "control_in", "Control In", LV2_CORE__ControlPort, false));
+ "control_in", "Control In", uris.lv2_ControlPort, false));
_menu_add_control_output->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "control_out", "Control Out", LV2_CORE__ControlPort, true));
+ "control_out", "Control Out", uris.lv2_ControlPort, true));
_menu_add_event_input->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "event_in", "Event In", LV2_ATOM__AtomPort, false));
+ "event_in", "Event In", uris.atom_AtomPort, false));
_menu_add_event_output->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "event_out", "Event Out", LV2_ATOM__AtomPort, true));
+ "event_out", "Event Out", uris.atom_AtomPort, true));
signal_event.connect(
sigc::mem_fun(this, &PatchCanvas::on_event));
@@ -729,7 +731,7 @@ PatchCanvas::paste()
&& (first_slash = to_create.find("/")) != string::npos) {
created += to_create.substr(0, first_slash);
assert(Path::is_valid(created));
- clipboard.put(created, props);
+ clipboard.put(GraphObject::path_to_uri(Path(created)), props);
to_create = to_create.substr(first_slash + 1);
}
@@ -800,13 +802,13 @@ PatchCanvas::menu_add_port(const string& sym_base, const string& name_base,
{
string sym, name;
generate_port_name(sym_base, sym, name_base, name);
- const Path& path = _patch->path().base() + sym;
+ const Path& path = _patch->path().child(Raul::Symbol(sym));
const URIs& uris = _app.uris();
Resource::Properties props = get_initial_data();
props.insert(make_pair(uris.rdf_type,
- _app.forge().alloc_uri(type.str())));
+ _app.forge().alloc_uri(type)));
if (type == uris.atom_AtomPort) {
props.insert(make_pair(uris.atom_bufferType,
uris.atom_Sequence));
@@ -842,7 +844,7 @@ PatchCanvas::load_plugin(WeakPtr<PluginModel> weak_plugin)
GraphObject::Properties props = get_initial_data();
props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
props.insert(make_pair(uris.ingen_prototype,
- uris.forge.alloc_uri(plugin->uri().str())));
+ uris.forge.alloc_uri(plugin->uri())));
_app.interface()->put(GraphObject::path_to_uri(path), props);
}
diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp
index bd7b62b7..24c56f1e 100644
--- a/src/gui/PatchTreeWindow.cpp
+++ b/src/gui/PatchTreeWindow.cpp
@@ -92,7 +92,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
Gtk::TreeModel::iterator iter = _patch_treestore->append();
Gtk::TreeModel::Row row = *iter;
if (pm->path().is_root()) {
- row[_patch_tree_columns.name_col] = _app->interface()->uri().str();
+ row[_patch_tree_columns.name_col] = _app->interface()->uri();
} else {
row[_patch_tree_columns.name_col] = pm->symbol().c_str();
}
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index b2a7cc21..a5b907c3 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -147,7 +147,7 @@ PortMenu::on_menu_expose()
SharedPtr<const NodeModel> node = PtrCast<const NodeModel>(port->parent());
const std::string label = node->label() + " " + node->port_label(port);
- const Raul::Path path = node->path().str() + "_" + port->symbol().c_str();
+ const Raul::Path path = Raul::Path(node->path() + Raul::Symbol("_" + port->symbol()));
Ingen::Resource r(*_object.get());
r.remove_property(uris.lv2_index, uris.wildcard);
diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp
index 900c93c2..e0e95a67 100644
--- a/src/gui/PortPropertiesWindow.cpp
+++ b/src/gui/PortPropertiesWindow.cpp
@@ -65,7 +65,7 @@ PortPropertiesWindow::present(SharedPtr<const PortModel> pm)
_port_model = pm;
- set_title(pm->path().str() + " Properties - Ingen");
+ set_title(pm->path() + " Properties - Ingen");
float min = 0.0f, max = 1.0f;
boost::shared_ptr<NodeModel> parent = PtrCast<NodeModel>(_port_model->parent());
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index a79e2737..8fdb8f78 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -114,7 +114,7 @@ get_types(World* world, SharedPtr<const ObjectModel> model)
URISet types;
PropRange range = model->properties().equal_range(world->uris().rdf_type);
for (PropIter t = range.first; t != range.second; ++t) {
- types.insert(t->second.get_uri());
+ types.insert(Raul::URI(t->second.get_uri()));
}
LilvNode* rdfs_subClassOf = lilv_new_uri(
@@ -133,7 +133,7 @@ get_types(World* world, SharedPtr<const ObjectModel> model)
LILV_FOREACH(nodes, s, sups) {
const LilvNode* super_node = lilv_nodes_get(sups, s);
if (lilv_node_is_uri(super_node)) {
- Raul::URI super = lilv_node_as_uri(super_node);
+ Raul::URI super(lilv_node_as_uri(super_node));
if (!types.count(super)) {
++added;
supers.insert(super);
@@ -182,7 +182,7 @@ get_properties(World* world, SharedPtr<const ObjectModel> model)
if (n_matching_domains > 0 &&
n_matching_domains == lilv_nodes_size(domains)) {
- properties.insert(lilv_node_as_uri(prop));
+ properties.insert(Raul::URI(lilv_node_as_uri(prop)));
}
lilv_nodes_free(domains);
@@ -224,9 +224,9 @@ PropertiesWindow::add_property(const Raul::URI& uri, const Raul::Atom& value)
LilvNode* prop = lilv_new_uri(world->lilv_world(), uri.c_str());
Glib::ustring lab_text = get_label(world, prop);
if (lab_text.empty()) {
- lab_text = world->rdf_world()->prefixes().qualify(uri.str());
+ lab_text = world->rdf_world()->prefixes().qualify(uri);
}
- lab_text = Glib::ustring("<a href=\"") + uri.str() + "\">"
+ lab_text = Glib::ustring("<a href=\"") + uri + "\">"
+ lab_text + "</a>";
Gtk::Label* lab = manage(new Gtk::Label(lab_text, 1.0, 0.5));
lab->set_use_markup(true);
@@ -254,7 +254,7 @@ PropertiesWindow::set_object(SharedPtr<const ObjectModel> model)
reset();
_model = model;
- set_title(model->path().str() + " Properties - Ingen");
+ set_title(model->path() + " Properties - Ingen");
World* world = _app->world();
@@ -282,7 +282,7 @@ PropertiesWindow::set_object(SharedPtr<const ObjectModel> model)
// At least one applicable object, add property to key combo
Gtk::ListStore::iterator ki = _key_store->append();
Gtk::ListStore::Row row = *ki;
- row[_combo_columns.uri_col] = p->str();
+ row[_combo_columns.uri_col] = *p;
row[_combo_columns.label_col] = label;
break;
}
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index 31ebbf22..926135a8 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -64,7 +64,7 @@ RenameWindow::set_object(SharedPtr<const ObjectModel> object)
{
_object = object;
_symbol_entry->set_text(object->path().symbol());
- const Atom& name_atom = object->get_property(LV2_CORE__name);
+ const Atom& name_atom = object->get_property(_app->uris().lv2_name);
_label_entry->set_text(
(name_atom.type() == _app->forge().String) ? name_atom.get_string() : "");
}
@@ -82,14 +82,12 @@ RenameWindow::values_changed()
{
const string& symbol = _symbol_entry->get_text();
const string& label = _label_entry->get_text();
- if (symbol.length() == 0) {
- _message_label->set_text("Symbol must be at least 1 character");
+ if (!Symbol::is_valid(symbol)) {
+ _message_label->set_text("Invalid symbol");
_ok_button->property_sensitive() = false;
- } else if (!Symbol::is_valid(symbol)) {
- _message_label->set_text("Symbol contains invalid characters");
- _ok_button->property_sensitive() = false;
- } else if (_object->symbol().c_str() != symbol &&
- _app->store()->object(_object->parent()->path().child(symbol))) {
+ } else if (_object->symbol() != symbol &&
+ _app->store()->object(
+ _object->parent()->path().child(Raul::Symbol(symbol)))) {
_message_label->set_text("An object already exists with that path");
_ok_button->property_sensitive() = false;
} else if (label.empty()) {
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 054838c6..961ed340 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -78,7 +78,7 @@ ThreadedLoader::load_patch(bool merge,
Glib::ustring engine_base = "";
if (engine_parent) {
if (merge)
- engine_base = engine_parent.get().str();
+ engine_base = engine_parent.get();
else
engine_base = engine_parent.get().base();
}
diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp
index 0834f666..98af4c19 100644
--- a/src/gui/WindowFactory.cpp
+++ b/src/gui/WindowFactory.cpp
@@ -204,7 +204,7 @@ WindowFactory::present_load_plugin(SharedPtr<const PatchModel> patch,
_load_plugin_win->set_default_size(width - width / 8, height / 2);
}
_load_plugin_win->set_title(
- string("Load Plugin - ") + patch->path().str() + " - Ingen");
+ string("Load Plugin - ") + patch->path() + " - Ingen");
_load_plugin_win->present(patch, data);
}
diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp
index 069b8031..3dcb6d71 100644
--- a/src/gui/ingen_gui_lv2.cpp
+++ b/src/gui/ingen_gui_lv2.cpp
@@ -129,7 +129,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
*ui->client.get()));
// Request plugins
- ui->world->interface()->get("ingen:plugins");
+ ui->world->interface()->get(Raul::URI("ingen:plugins"));
// Create empty root patch model
Ingen::Resource::Properties props;
@@ -139,7 +139,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
// Create a PatchBox for the root and set as the UI widget
SharedPtr<const Ingen::Client::PatchModel> root = PtrCast<const Ingen::Client::PatchModel>(
- ui->app->store()->object("/"));
+ ui->app->store()->object(Raul::Path("/")));
ui->view = Ingen::GUI::PatchBox::create(*ui->app, root);
ui->view->unparent();
*widget = ui->view->gobj();
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index defba485..dcb27ea1 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -123,8 +123,10 @@ main(int argc, char** argv)
"Unable to load socket client module");
#endif
const char* const uri = conf.option("connect").get_string();
+ ingen_try(Raul::URI::is_valid(uri),
+ (Raul::fmt("Invalid URI <%1%>") % uri).str().c_str());
SharedPtr<Interface> client(new Client::ThreadedSigClientInterface(1024));
- ingen_try((engine_interface = world->new_interface(uri, client)),
+ ingen_try((engine_interface = world->new_interface(Raul::URI(uri), client)),
(string("Unable to create interface to `") + uri + "'").c_str());
}
@@ -174,7 +176,7 @@ main(int argc, char** argv)
conf.option("load").get_string() :
conf.files().front();
- engine_interface->get("ingen:plugins");
+ engine_interface->get(Raul::URI("ingen:plugins"));
engine_interface->get(GraphObject::root_uri());
world->parser()->parse_file(
world, engine_interface.get(), path, parent, symbol);
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index f67eaf7f..a32fa9fd 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -139,12 +139,12 @@ get_properties(Ingen::World* world,
typedef std::pair<Path, Resource::Properties> PortRecord;
-static int
+static boost::optional<PortRecord>
get_port(Ingen::World* world,
Sord::Model& model,
const Sord::Node& subject,
const Raul::Path& parent,
- PortRecord& record)
+ uint32_t& index)
{
const URIs& uris = world->uris();
@@ -156,22 +156,21 @@ get_port(Ingen::World* world,
if (i == props.end()
|| i->second.type() != world->forge().Int
|| i->second.get_int32() < 0) {
- LOG(error) << "Port " << subject << " has no valid lv2:index" << endl;
- return -1;
+ LOG(error) << "Port " << subject << " has no valid index" << endl;
+ return boost::optional<PortRecord>();
}
- const uint32_t index = i->second.get_int32();
+ index = i->second.get_int32();
// Get symbol
Resource::Properties::const_iterator s = props.find(uris.lv2_symbol);
if (s == props.end()) {
LOG(error) << "Port " << subject << " has no symbol" << endl;
- return -1;
+ return boost::optional<PortRecord>();
}
const Symbol port_sym(s->second.get_string());
const Path port_path = parent.child(port_sym);
- record = make_pair(port_path, props);
- return index;
+ return make_pair(port_path, props);
}
static boost::optional<Raul::Path>
@@ -278,7 +277,7 @@ parse_node(Ingen::World* world,
} else {
Resource::Properties props = get_properties(world, model, subject);
props.insert(make_pair(uris.rdf_type,
- uris.forge.alloc_uri(uris.ingen_Node.str())));
+ uris.forge.alloc_uri(uris.ingen_Node)));
target->put(GraphObject::path_to_uri(path), props);
}
return path;
@@ -311,7 +310,7 @@ parse_patch(Ingen::World* world,
string patch_path_str = relative_uri(base_uri, subject_node.to_string(), true);
if (parent && a_symbol)
- patch_path_str = parent->child(*a_symbol).str();
+ patch_path_str = parent->child(*a_symbol);
if (!Path::is_valid(patch_path_str)) {
LOG(error) << "Patch has invalid path: " << patch_path_str << endl;
@@ -338,16 +337,17 @@ parse_patch(Ingen::World* world,
Sord::Node port = p.get_object();
// Get all properties
- PortRecord port_record;
- const int index = get_port(world, model, port, node_path, port_record);
- if (index < 0) {
+ uint32_t index = 0;
+ boost::optional<PortRecord> port_record = get_port(
+ world, model, port, node_path, index);
+ if (!port_record) {
LOG(error) << "Invalid port " << port << endl;
return boost::optional<Path>();
}
// Create port and/or set all port properties
- target->put(GraphObject::path_to_uri(port_record.first),
- port_record.second);
+ target->put(GraphObject::path_to_uri(port_record->first),
+ port_record->second);
}
}
@@ -358,15 +358,16 @@ parse_patch(Ingen::World* world,
Sord::Node port = p.get_object();
// Get all properties
- PortRecord port_record;
- const int index = get_port(world, model, port, patch_path, port_record);
- if (index < 0) {
+ uint32_t index = 0;
+ boost::optional<PortRecord> port_record = get_port(
+ world, model, port, patch_path, index);
+ if (!port_record) {
LOG(Raul::error) << "Invalid port " << port << endl;
return boost::optional<Path>();
}
// Store port information in ports map
- ports[index] = port_record;
+ ports[index] = *port_record;
}
// Create ports in order by index
@@ -597,7 +598,7 @@ Parser::parse_file(Ingen::World* world,
if (parsed_path) {
target->set_property(GraphObject::path_to_uri(*parsed_path),
- "http://drobilla.net/ns/ingen#document",
+ Raul::URI("http://drobilla.net/ns/ingen#document"),
world->forge().alloc_uri(uri));
} else {
LOG(Raul::warn)("Document URI lost\n");
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index bd7dfed5..a6af8923 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -275,9 +275,9 @@ Serialiser::Impl::path_rdf_node(const Path& path)
{
assert(_model);
assert(path == _root_path || path.is_child_of(_root_path));
- const Path rel_path(path.relative_to_base(_root_path));
+ // FIXME: if path == root_path() then "/" ?
return Sord::URI(_model->world(),
- rel_path.substr(1).c_str(),
+ path.substr(_root_path.base().length()),
_base_uri);
}
@@ -290,7 +290,7 @@ Serialiser::serialise(SharedPtr<const GraphObject> object) throw (std::logic_err
if (object->graph_type() == GraphObject::PATCH) {
me->serialise_patch(object, me->path_rdf_node(object->path()));
} else if (object->graph_type() == GraphObject::NODE) {
- const Sord::URI plugin_id(me->_model->world(), object->plugin()->uri().str());
+ const Sord::URI plugin_id(me->_model->world(), object->plugin()->uri());
me->serialise_node(object, plugin_id, me->path_rdf_node(object->path()));
} else if (object->graph_type() == GraphObject::PORT) {
me->serialise_port(object.get(),
@@ -347,7 +347,7 @@ Serialiser::Impl::serialise_patch(SharedPtr<const GraphObject> patch,
// If the patch has no doap:name (required by LV2), use the symbol
if (patch->properties().find(uris.doap_name) == patch->properties().end())
_model->add_statement(patch_id,
- Sord::URI(world, uris.doap_name.str()),
+ Sord::URI(world, uris.doap_name),
Sord::Literal(world, symbol.c_str()));
const GraphObject::Properties props = patch->properties(Resource::INTERNAL);
@@ -395,7 +395,7 @@ Serialiser::Impl::serialise_patch(SharedPtr<const GraphObject> patch,
} else if (n->second->graph_type() == GraphObject::NODE) {
SharedPtr<const GraphObject> node = n->second;
- const Sord::URI class_id(world, node->plugin()->uri().str());
+ const Sord::URI class_id(world, node->plugin()->uri());
const Sord::Node node_id(path_rdf_node(n->second->path()));
_model->add_statement(patch_id,
Sord::Curie(world, "ingen:node"),
@@ -409,8 +409,8 @@ Serialiser::Impl::serialise_patch(SharedPtr<const GraphObject> patch,
const Sord::Node port_id = path_rdf_node(p->path());
// Ensure lv2:name always exists so Patch is a valid LV2 plugin
- if (p->properties().find(LV2_CORE__name) == p->properties().end())
- p->set_property(LV2_CORE__name,
+ if (p->properties().find(uris.lv2_name) == p->properties().end())
+ p->set_property(uris.lv2_name,
_world.forge().alloc(p->symbol().c_str()));
_model->add_statement(patch_id,
@@ -537,7 +537,7 @@ Serialiser::Impl::serialise_properties(Sord::Node id,
typedef GraphObject::Properties::const_iterator iterator;
for (iterator v = props.begin(); v != props.end(); ++v) {
- const Sord::URI key(_model->world(), v->first.str());
+ const Sord::URI key(_model->world(), v->first);
if (!skip_property(key)) {
sratom_write(_sratom, unmap, 0,
sord_node_to_serd_node(id.c_obj()),
diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp
index 85b133b3..507e8eec 100644
--- a/src/server/Broadcaster.hpp
+++ b/src/server/Broadcaster.hpp
@@ -100,7 +100,7 @@ public:
BROADCAST(set_property, subject, predicate, value);
}
- Raul::URI uri() const { return "http://drobilla.net/ns/ingen#broadcaster"; } ///< N/A
+ Raul::URI uri() const { return Raul::URI("ingen:broadcaster"); }
void set_response_id(int32_t id) {} ///< N/A
void get(const Raul::URI& uri) {} ///< N/A
diff --git a/src/server/Context.cpp b/src/server/Context.cpp
index 846368d2..a7a78b43 100644
--- a/src/server/Context.cpp
+++ b/src/server/Context.cpp
@@ -91,7 +91,7 @@ Context::emit_notifications(FrameTime end)
const char* key = _engine.world()->uri_map().unmap_uri(note.key);
if (key) {
_engine.broadcaster()->set_property(
- note.port->uri(), key, value);
+ note.port->uri(), Raul::URI(key), value);
} else {
Raul::error("Error unmapping notification key URI\n");
}
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index 504c78bc..372090ef 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -225,8 +225,9 @@ Engine::activate()
SharedPtr<Interface> respondee;
execute_and_delete_event(
- context, new Events::CreatePort(*this, respondee, -1, 0,
- "/control_in", false, in_properties));
+ context, new Events::CreatePort(
+ *this, respondee, -1, 0, Raul::Path("/control_in"),
+ false, in_properties));
// Add control out
Resource::Properties out_properties(control_properties);
@@ -242,8 +243,9 @@ Engine::activate()
Resource::Property(forge.make(32.0f), Resource::EXTERNAL)));
execute_and_delete_event(
- context, new Events::CreatePort(*this, respondee, -1, 0,
- "/control_out", true, out_properties));
+ context, new Events::CreatePort(
+ *this, respondee, -1, 0, Raul::Path("/control_out"),
+ true, out_properties));
}
_driver->activate();
diff --git a/src/server/Event.hpp b/src/server/Event.hpp
index e35e1895..d627b5dc 100644
--- a/src/server/Event.hpp
+++ b/src/server/Event.hpp
@@ -103,7 +103,7 @@ protected:
inline bool pre_process_done(Status st, const Raul::URI& subject) {
_status = st;
- _err_subject = subject.str();
+ _err_subject = subject;
return !st;
}
diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp
index d25dc113..67b3b83b 100644
--- a/src/server/EventWriter.hpp
+++ b/src/server/EventWriter.hpp
@@ -40,7 +40,7 @@ public:
explicit EventWriter(Engine& engine);
virtual ~EventWriter();
- Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; }
+ Raul::URI uri() const { return Raul::URI("ingen:eventWriter"); }
virtual SharedPtr<Interface> respondee() const {
return _respondee;
diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp
index 0b66d05e..cdb299ee 100644
--- a/src/server/GraphObjectImpl.cpp
+++ b/src/server/GraphObjectImpl.cpp
@@ -30,9 +30,9 @@ namespace Server {
GraphObjectImpl::GraphObjectImpl(Ingen::URIs& uris,
GraphObjectImpl* parent,
const Raul::Symbol& symbol)
- : GraphObject(uris, parent ? parent->path().child(symbol) : "/")
+ : GraphObject(uris, parent ? parent->path().child(symbol) : Raul::Path("/"))
, _parent(parent)
- , _path(parent ? parent->path().child(symbol) : "/")
+ , _path(parent ? parent->path().child(symbol) : Raul::Path("/"))
, _symbol(symbol)
{
}
@@ -52,12 +52,5 @@ GraphObjectImpl::parent_patch() const
return dynamic_cast<PatchImpl*>((NodeImpl*)_parent);
}
-SharedPtr<GraphObject>
-GraphObjectImpl::find_child(const std::string& name) const
-{
- Raul::error("GraphObjectImpl::find_child called\n");
- return SharedPtr<GraphObject>();
-}
-
} // namespace Server
} // namespace Ingen
diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp
index 4e626692..4f2dcbc2 100644
--- a/src/server/GraphObjectImpl.hpp
+++ b/src/server/GraphObjectImpl.hpp
@@ -76,8 +76,6 @@ public:
const Raul::Path& path() const { return _path; }
- SharedPtr<GraphObject> find_child(const std::string& name) const;
-
/** Prepare for a new (external) polyphony value.
*
* Preprocessor thread, poly is actually applied by apply_poly.
diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp
index 0f1d380b..db43558c 100644
--- a/src/server/InternalPlugin.cpp
+++ b/src/server/InternalPlugin.cpp
@@ -32,9 +32,9 @@ namespace Server {
using namespace Internals;
-InternalPlugin::InternalPlugin(URIs& uris,
- const std::string& uri,
- const std::string& symbol)
+InternalPlugin::InternalPlugin(URIs& uris,
+ const Raul::URI& uri,
+ const Raul::Symbol& symbol)
: PluginImpl(uris, Plugin::Internal, uri)
, _symbol(symbol)
{
@@ -52,15 +52,13 @@ InternalPlugin::instantiate(BufferFactory& bufs,
const SampleCount srate = engine.driver()->sample_rate();
- const string uri_str = uri().str();
-
- if (uri_str == NS_INTERNALS "Controller") {
+ if (uri() == NS_INTERNALS "Controller") {
return new ControllerNode(this, bufs, symbol, polyphonic, parent, srate);
- } else if (uri_str == NS_INTERNALS "Delay") {
+ } else if (uri() == NS_INTERNALS "Delay") {
return new DelayNode(this, bufs, symbol, polyphonic, parent, srate);
- } else if (uri_str == NS_INTERNALS "Note") {
+ } else if (uri() == NS_INTERNALS "Note") {
return new NoteNode(this, bufs, symbol, polyphonic, parent, srate);
- } else if (uri_str == NS_INTERNALS "Trigger") {
+ } else if (uri() == NS_INTERNALS "Trigger") {
return new TriggerNode(this, bufs, symbol, polyphonic, parent, srate);
} else {
return NULL;
diff --git a/src/server/InternalPlugin.hpp b/src/server/InternalPlugin.hpp
index 043b56cb..59ba6d5a 100644
--- a/src/server/InternalPlugin.hpp
+++ b/src/server/InternalPlugin.hpp
@@ -38,9 +38,9 @@ class BufferFactory;
class InternalPlugin : public PluginImpl
{
public:
- InternalPlugin(URIs& uris,
- const std::string& uri,
- const std::string& symbol);
+ InternalPlugin(URIs& uris,
+ const Raul::URI& uri,
+ const Raul::Symbol& symbol);
NodeImpl* instantiate(BufferFactory& bufs,
const Raul::Symbol& symbol,
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp
index 21fd3c34..7b3a2ca5 100644
--- a/src/server/LV2Node.cpp
+++ b/src/server/LV2Node.cpp
@@ -344,7 +344,7 @@ LV2Node::instantiate(BufferFactory& bufs)
LILV_FOREACH(nodes, v, values) {
const LilvNode* val = lilv_nodes_get(values, v);
if (lilv_node_is_uri(val)) {
- port->add_property(lilv_node_as_uri(preds[p]),
+ port->add_property(Raul::URI(lilv_node_as_uri(preds[p])),
forge.alloc_uri(lilv_node_as_uri(val)));
}
}
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index ddd58aca..0e2a16b2 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -28,7 +28,7 @@ using namespace std;
namespace Ingen {
namespace Server {
-LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri)
+LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const Raul::URI& uri)
: PluginImpl(lv2_info->world().uris(), Plugin::LV2, uri)
, _lilv_plugin(NULL)
, _lv2_info(lv2_info)
@@ -39,7 +39,7 @@ LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri)
const Raul::Symbol
LV2Plugin::symbol() const
{
- string working = uri().str();
+ string working = uri();
if (working[working.length() - 1] == '/')
working = working.substr(0, working.length() - 1);
diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp
index 9cf69daa..8e8effab 100644
--- a/src/server/LV2Plugin.hpp
+++ b/src/server/LV2Plugin.hpp
@@ -20,11 +20,9 @@
#include <cstdlib>
#include <string>
-#include <glibmm/module.h>
-#include <boost/utility.hpp>
-
#include "lilv/lilv.h"
#include "raul/SharedPtr.hpp"
+#include "raul/URI.hpp"
#include "PluginImpl.hpp"
#include "LV2Info.hpp"
@@ -40,7 +38,7 @@ class NodeImpl;
class LV2Plugin : public PluginImpl
{
public:
- LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri);
+ LV2Plugin(SharedPtr<LV2Info> lv2_info, const Raul::URI& uri);
NodeImpl* instantiate(BufferFactory& bufs,
const Raul::Symbol& symbol,
diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp
index 502e5370..17c0bb79 100644
--- a/src/server/NodeFactory.cpp
+++ b/src/server/NodeFactory.cpp
@@ -103,7 +103,7 @@ NodeFactory::load_plugin(const Raul::URI& uri)
const LilvPlugins* plugs = lilv_world_get_all_plugins(_world->lilv_world());
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugs, node);
if (plug) {
- LV2Plugin* const ingen_plugin = new LV2Plugin(_lv2_info, uri.str());
+ LV2Plugin* const ingen_plugin = new LV2Plugin(_lv2_info, uri);
ingen_plugin->lilv_plugin(plug);
_plugins.insert(make_pair(uri, ingen_plugin));
}
@@ -119,10 +119,10 @@ NodeFactory::load_lv2_plugins()
LILV_FOREACH(plugins, i, plugins) {
const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i);
- const string uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug)));
+ const Raul::URI uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug)));
if (_plugins.find(uri) != _plugins.end()) {
- Raul::warn(Raul::fmt("Already discovered <%s>\n") % uri.c_str());
+ Raul::warn(Raul::fmt("Already discovered <%s>\n") % uri);
continue;
}
diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp
index 9b1e1a1f..acf0c46d 100644
--- a/src/server/PatchImpl.cpp
+++ b/src/server/PatchImpl.cpp
@@ -43,8 +43,9 @@ PatchImpl::PatchImpl(Engine& engine,
SampleRate srate,
uint32_t internal_poly)
: NodeImpl(new PatchPlugin(engine.world()->uris(),
- engine.world()->uris().ingen_Patch.c_str(),
- "patch", "Ingen Patch"),
+ engine.world()->uris().ingen_Patch,
+ Raul::Symbol("patch"),
+ "Ingen Patch"),
symbol, poly, parent, srate)
, _engine(engine)
, _poly_pre(internal_poly)
diff --git a/src/server/PatchPlugin.hpp b/src/server/PatchPlugin.hpp
index fc5d808f..ba1cfa40 100644
--- a/src/server/PatchPlugin.hpp
+++ b/src/server/PatchPlugin.hpp
@@ -32,10 +32,10 @@ class NodeImpl;
class PatchPlugin : public PluginImpl
{
public:
- PatchPlugin(URIs& uris,
- const std::string& uri,
- const std::string& symbol,
- const std::string& name)
+ PatchPlugin(URIs& uris,
+ const Raul::URI& uri,
+ const Raul::Symbol& symbol,
+ const std::string& name)
: PluginImpl(uris, Plugin::Patch, uri)
{}
diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp
index 8ef569ab..8aa741e0 100644
--- a/src/server/PluginImpl.hpp
+++ b/src/server/PluginImpl.hpp
@@ -25,6 +25,7 @@
#include "ingen/Plugin.hpp"
#include "ingen/Resource.hpp"
#include "raul/Symbol.hpp"
+#include "raul/URI.hpp"
namespace Ingen {
@@ -45,9 +46,9 @@ class PluginImpl : public Plugin
, public boost::noncopyable
{
public:
- PluginImpl(Ingen::URIs& uris,
- Type type,
- const std::string& uri)
+ PluginImpl(Ingen::URIs& uris,
+ Type type,
+ const Raul::URI& uri)
: Plugin(uris, uri)
, _type(type)
{}
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index b7eaa5d4..9a12028a 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -72,7 +72,7 @@ PortImpl::PortImpl(BufferFactory& bufs,
set_type(type, buffer_type);
add_property(uris.atom_bufferType, bufs.forge().make_urid(buffer_type));
- add_property(uris.rdf_type, bufs.forge().alloc_uri(type.uri().str()));
+ add_property(uris.rdf_type, bufs.forge().alloc_uri(type.uri()));
set_property(uris.lv2_index, bufs.forge().make((int32_t)index));
}
@@ -107,7 +107,7 @@ bool
PortImpl::supports(const Raul::URI& value_type) const
{
return has_property(_bufs.uris().atom_supports,
- _bufs.forge().alloc_uri(value_type.str()));
+ _bufs.forge().alloc_uri(value_type));
}
Raul::Array<BufferRef>*
diff --git a/src/server/PortType.hpp b/src/server/PortType.hpp
index c84cefb4..883b352f 100644
--- a/src/server/PortType.hpp
+++ b/src/server/PortType.hpp
@@ -78,11 +78,11 @@ private:
static inline const Raul::URI& type_uri(unsigned symbol_num) {
assert(symbol_num <= ATOM);
static const Raul::URI uris[] = {
- "http://drobilla.net/ns/ingen#nil",
- LV2_CORE__AudioPort,
- LV2_CORE__ControlPort,
- LV2_CORE__CVPort,
- LV2_ATOM__AtomPort
+ Raul::URI("http://drobilla.net/ns/ingen#nil"),
+ Raul::URI(LV2_CORE__AudioPort),
+ Raul::URI(LV2_CORE__ControlPort),
+ Raul::URI(LV2_CORE__CVPort),
+ Raul::URI(LV2_ATOM__AtomPort)
};
return uris[symbol_num];
}
diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp
index 0c3e34bf..acdc9091 100644
--- a/src/server/events/CreateNode.cpp
+++ b/src/server/events/CreateNode.cpp
@@ -57,10 +57,10 @@ CreateNode::pre_process()
return Event::pre_process_done(BAD_URI, _path);
}
- std::string plugin_uri;
+ std::string plugin_uri_str;
const iterator t = _properties.find(uris.ingen_prototype);
if (t != _properties.end() && t->second.type() == uris.forge.URI) {
- plugin_uri = t->second.get_uri();
+ plugin_uri_str = t->second.get_uri();
} else {
return Event::pre_process_done(BAD_REQUEST);
}
@@ -73,6 +73,7 @@ CreateNode::pre_process()
return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent());
}
+ const Raul::URI plugin_uri(plugin_uri_str);
PluginImpl* plugin = _engine.node_factory()->plugin(plugin_uri);
if (!plugin) {
return Event::pre_process_done(PLUGIN_NOT_FOUND, Raul::URI(plugin_uri));
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index 5c16ca8b..17ad1a70 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -77,11 +77,12 @@ Move::pre_process()
assert(Raul::Path::descendant_comparator(_old_path, child_old_path));
Raul::Path child_new_path;
- if (child_old_path == _old_path)
+ if (child_old_path == _old_path) {
child_new_path = _new_path;
- else
- child_new_path = Raul::Path(_new_path).base()
- + child_old_path.substr(_old_path.length() + 1);
+ } else {
+ child_new_path = Raul::Path(
+ _new_path.base() + child_old_path.substr(_old_path.length() + 1));
+ }
PtrCast<GraphObjectImpl>(i->second)->set_path(child_new_path);
i->first = child_new_path;
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index bb566113..4c9c7d85 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -566,7 +566,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
Since we are not yet rolling, it won't be drained, causing a deadlock. */
SharedPtr<Interface> client(&driver->writer(), NullDeleter<Interface>);
interface->set_respondee(client);
- engine->register_client("http://drobilla.net/ns/ingen#internal", client);
+ engine->register_client(Raul::URI("ingen:lv2"), client);
return (LV2_Handle)plugin;
}
@@ -666,7 +666,7 @@ ingen_save(LV2_Handle instance,
char* real_path = make_path->path(make_path->handle, "patch.ttl");
char* state_path = map_path->abstract_path(map_path->handle, real_path);
- Ingen::Store::iterator root = plugin->world->store()->find("/");
+ Ingen::Store::iterator root = plugin->world->store()->find(Raul::Path("/"));
plugin->world->serialiser()->to_file(root->second, real_path);
store(handle,
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index 09eafa87..62fe0520 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -39,7 +39,8 @@ namespace Server {
namespace Internals {
InternalPlugin* ControllerNode::internal_plugin(URIs& uris) {
- return new InternalPlugin(uris, NS_INTERNALS "Controller", "controller");
+ return new InternalPlugin(
+ uris, Raul::URI(NS_INTERNALS "Controller"), Raul::Symbol("controller"));
}
ControllerNode::ControllerNode(InternalPlugin* plugin,
diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp
index f687a04e..b6d05f68 100644
--- a/src/server/internals/Delay.cpp
+++ b/src/server/internals/Delay.cpp
@@ -50,7 +50,8 @@ namespace Internals {
static const float MAX_DELAY_SECONDS = 8.0f;
InternalPlugin* DelayNode::internal_plugin(URIs& uris) {
- return new InternalPlugin(uris, NS_INTERNALS "Delay", "delay");
+ return new InternalPlugin(
+ uris, Raul::URI(NS_INTERNALS "Delay"), Raul::Symbol("delay"));
}
DelayNode::DelayNode(InternalPlugin* plugin,
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index d8993659..899e01df 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -46,7 +46,8 @@ namespace Server {
namespace Internals {
InternalPlugin* NoteNode::internal_plugin(URIs& uris) {
- return new InternalPlugin(uris, NS_INTERNALS "Note", "note");
+ return new InternalPlugin(
+ uris, Raul::URI(NS_INTERNALS "Note"), Raul::Symbol("note"));
}
NoteNode::NoteNode(InternalPlugin* plugin,
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index ca37bd59..4745ffbb 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -41,7 +41,8 @@ namespace Server {
namespace Internals {
InternalPlugin* TriggerNode::internal_plugin(URIs& uris) {
- return new InternalPlugin(uris, NS_INTERNALS "Trigger", "trigger");
+ return new InternalPlugin(
+ uris, Raul::URI(NS_INTERNALS "Trigger"), Raul::Symbol("trigger"));
}
TriggerNode::TriggerNode(InternalPlugin* plugin,
diff --git a/src/socket/Socket.cpp b/src/socket/Socket.cpp
index d6162df2..13a684bc 100644
--- a/src/socket/Socket.cpp
+++ b/src/socket/Socket.cpp
@@ -42,6 +42,7 @@ namespace Socket {
Socket::Socket(Type t)
: _type(t)
+ , _uri(t == UNIX ? "unix:" : "tcp:")
, _addr(NULL)
, _addr_len(0)
, _sock(-1)
@@ -56,11 +57,11 @@ Socket::Socket(Type t)
}
}
-Socket::Socket(Type t,
- const std::string& uri,
- struct sockaddr* addr,
- socklen_t addr_len,
- int fd)
+Socket::Socket(Type t,
+ const Raul::URI& uri,
+ struct sockaddr* addr,
+ socklen_t addr_len,
+ int fd)
: _type(t)
, _uri(uri)
, _addr(addr)
@@ -76,7 +77,7 @@ Socket::~Socket()
}
bool
-Socket::set_addr(const std::string& uri)
+Socket::set_addr(const Raul::URI& uri)
{
free(_addr);
if (_type == UNIX && uri.substr(0, strlen("unix://")) == "unix://") {
@@ -90,14 +91,14 @@ Socket::set_addr(const std::string& uri)
_addr_len = sizeof(struct sockaddr_un);
return true;
} else if (_type == TCP && uri.find("://") != std::string::npos) {
- const std::string no_scheme = uri.substr(uri.find("://") + 4);
- const size_t port_sep = no_scheme.find(':');
+ const std::string authority = uri.substr(uri.find("://") + 3);
+ const size_t port_sep = authority.find(':');
if (port_sep == std::string::npos) {
return false;
}
- const std::string host = no_scheme.substr(0, port_sep);
- const std::string port = no_scheme.substr(port_sep + 1).c_str();
+ const std::string host = authority.substr(0, port_sep);
+ const std::string port = authority.substr(port_sep + 1).c_str();
struct addrinfo* ainfo;
int st = 0;
@@ -118,7 +119,7 @@ Socket::set_addr(const std::string& uri)
}
bool
-Socket::bind(const std::string& uri)
+Socket::bind(const Raul::URI& uri)
{
if (set_addr(uri) && ::bind(_sock, _addr, _addr_len) != -1) {
return true;
@@ -130,7 +131,7 @@ Socket::bind(const std::string& uri)
}
bool
-Socket::connect(const std::string& uri)
+Socket::connect(const Raul::URI& uri)
{
if (set_addr(uri) && ::connect(_sock, _addr, _addr_len) != -1) {
return true;
@@ -167,11 +168,11 @@ Socket::accept()
return SharedPtr<Socket>();
}
- std::string client_uri = _uri;
- char host[NI_MAXHOST];
+ Raul::URI client_uri = _uri;
+ char host[NI_MAXHOST];
if (getnameinfo(client_addr, client_addr_len,
host, sizeof(host), NULL, 0, 0)) {
- client_uri = _uri.substr(0, _uri.find(":") + 1) + host;
+ client_uri = Raul::URI(_uri.scheme() + "://" + host);
}
return SharedPtr<Socket>(
diff --git a/src/socket/Socket.hpp b/src/socket/Socket.hpp
index 13f18be8..49d03d48 100644
--- a/src/socket/Socket.hpp
+++ b/src/socket/Socket.hpp
@@ -18,13 +18,11 @@
#define INGEN_SOCKET_SOCKET_HPP
#include <stdint.h>
-#include <string.h>
#include <sys/socket.h>
-#include <string>
-
-#include "raul/SharedPtr.hpp"
#include "raul/Noncopyable.hpp"
+#include "raul/SharedPtr.hpp"
+#include "raul/URI.hpp"
namespace Ingen {
namespace Socket {
@@ -37,23 +35,19 @@ public:
TCP
};
- static Type type_from_uri(const std::string& uri) {
- if (uri.substr(0, strlen("unix://")) == "unix://") {
- return UNIX;
- } else {
- return TCP;
- }
+ static Type type_from_uri(const Raul::URI uri) {
+ return (uri.scheme() == "unix") ? UNIX : TCP;
}
/** Create a new unbound/unconnected socket of a given type. */
explicit Socket(Type t);
/** Wrap an existing open socket. */
- Socket(Type t,
- const std::string& uri,
- struct sockaddr* addr,
- socklen_t addr_len,
- int fd);
+ Socket(Type t,
+ const Raul::URI& uri,
+ struct sockaddr* addr,
+ socklen_t addr_len,
+ int fd);
~Socket();
@@ -61,13 +55,13 @@ public:
* @param uri Address URI, e.g. unix:///tmp/foo or tcp://somehost:1234
* @return True on success.
*/
- bool bind(const std::string& uri);
+ bool bind(const Raul::URI& uri);
/** Connect a client socket to a server address.
* @param uri Address URI, e.g. unix:///tmp/foo or tcp://somehost:1234
* @return True on success.
*/
- bool connect(const std::string& uri);
+ bool connect(const Raul::URI& uri);
/** Mark server socket as passive to listen for incoming connections.
* @return True on success.
@@ -82,16 +76,16 @@ public:
/** Return the file descriptor for the socket. */
int fd() { return _sock; }
- const std::string& uri() const { return _uri; }
+ const Raul::URI& uri() const { return _uri; }
/** Close the socket. */
void close();
private:
- bool set_addr(const std::string& uri);
+ bool set_addr(const Raul::URI& uri);
Type _type;
- std::string _uri;
+ Raul::URI _uri;
struct sockaddr* _addr;
socklen_t _addr_len;
int _sock;
diff --git a/src/socket/SocketClient.hpp b/src/socket/SocketClient.hpp
index c316e4a4..14227c90 100644
--- a/src/socket/SocketClient.hpp
+++ b/src/socket/SocketClient.hpp
@@ -17,8 +17,6 @@
#ifndef INGEN_SOCKET_SOCKET_CLIENT_HPP
#define INGEN_SOCKET_SOCKET_CLIENT_HPP
-#include <string>
-
#include "SocketReader.hpp"
#include "SocketWriter.hpp"
@@ -30,7 +28,7 @@ class SocketClient : public SocketWriter
{
public:
SocketClient(World& world,
- const std::string& uri,
+ const Raul::URI& uri,
SharedPtr<Socket> sock,
SharedPtr<Interface> respondee)
: SocketWriter(world.uri_map(), world.uris(), uri, sock)
diff --git a/src/socket/SocketListener.cpp b/src/socket/SocketListener.cpp
index f79c055a..6b68c36c 100644
--- a/src/socket/SocketListener.cpp
+++ b/src/socket/SocketListener.cpp
@@ -45,7 +45,7 @@ SocketListener::SocketListener(Ingen::World& world)
{
// Create UNIX socket
_unix_path = world.conf().option("socket").get_string();
- const std::string unix_uri = "unix://" + _unix_path;
+ const Raul::URI unix_uri("unix://" + _unix_path);
if (!_unix_sock.bind(unix_uri) || !_unix_sock.listen()) {
LOG(Raul::error) << "Failed to create UNIX socket" << std::endl;
_unix_sock.close();
@@ -54,9 +54,9 @@ SocketListener::SocketListener(Ingen::World& world)
// Create TCP socket
int port = world.conf().option("engine-port").get_int();
std::ostringstream ss;
- ss << "tcp:///localhost:";
+ ss << "tcp://localhost:";
ss << port;
- if (!_net_sock.bind(ss.str()) || !_net_sock.listen()) {
+ if (!_net_sock.bind(Raul::URI(ss.str())) || !_net_sock.listen()) {
LOG(Raul::error) << "Failed to create TCP socket" << std::endl;
_net_sock.close();
}
diff --git a/src/socket/ingen_socket_client.cpp b/src/socket/ingen_socket_client.cpp
index 8819ea2c..148f2b2a 100644
--- a/src/socket/ingen_socket_client.cpp
+++ b/src/socket/ingen_socket_client.cpp
@@ -25,19 +25,16 @@
static SharedPtr<Ingen::Interface>
new_socket_interface(Ingen::World* world,
- const std::string& url,
+ const Raul::URI& uri,
SharedPtr<Ingen::Interface> respondee)
{
SharedPtr<Ingen::Socket::Socket> sock(
- new Ingen::Socket::Socket(Ingen::Socket::Socket::type_from_uri(url)));
- if (!sock->connect(url)) {
+ new Ingen::Socket::Socket(Ingen::Socket::Socket::type_from_uri(uri)));
+ if (!sock->connect(uri)) {
return SharedPtr<Ingen::Interface>();
}
Ingen::Socket::SocketClient* client = new Ingen::Socket::SocketClient(
- *world,
- url,
- sock,
- respondee);
+ *world, uri, sock, respondee);
return SharedPtr<Ingen::Interface>(client);
}
diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp
index ce3f3c30..68981078 100644
--- a/tests/ingen_test.cpp
+++ b/tests/ingen_test.cpp
@@ -70,7 +70,7 @@ public:
TestClient() {}
~TestClient() {}
- Raul::URI uri() const { return "http://drobilla.net/ns/ingen#AtomWriter"; }
+ Raul::URI uri() const { return Raul::URI("ingen:testClient"); }
void bundle_begin() {}
@@ -198,9 +198,8 @@ main(int argc, char** argv)
SharedPtr<Interface> client(new TestClient());
world->interface()->set_respondee(client);
- world->engine()->register_client(
- "http://drobilla.net/ns/ingen#AtomWriter",
- client);
+ world->engine()->register_client(Raul::URI("ingen:testClient"),
+ client);
SerdURI cmds_base;
const SerdNode cmds_file_uri = serd_node_new_file_uri(