From 0c9e861caa8b1eed5068942edc35d5f91bac816e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 10 May 2012 06:24:07 +0000 Subject: Work towards translatable strings and a cleaner log interface. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4338 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/events/Connect.cpp | 15 ++++++--------- src/server/events/CreateNode.cpp | 7 ++----- src/server/events/CreatePatch.cpp | 5 +---- src/server/events/CreatePort.cpp | 7 ++----- src/server/events/Delete.cpp | 2 -- src/server/events/Disconnect.cpp | 3 --- src/server/events/DisconnectAll.cpp | 15 ++++++--------- src/server/events/Get.cpp | 16 +++++++--------- src/server/events/Move.cpp | 27 ++++++++++++--------------- src/server/events/SetMetadata.cpp | 13 +++++-------- src/server/events/SetPortValue.cpp | 5 +---- 11 files changed, 42 insertions(+), 73 deletions(-) (limited to 'src/server/events') diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 6ad8d4f6..1fe88c22 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -35,19 +35,16 @@ #include "ProcessContext.hpp" #include "types.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { -Connect::Connect(Engine& engine, - Interface* client, - int32_t id, - SampleCount timestamp, - const Path& tail_path, - const Path& head_path) +Connect::Connect(Engine& engine, + Interface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& tail_path, + const Raul::Path& head_path) : Event(engine, client, id, timestamp) , _tail_path(tail_path) , _head_path(head_path) diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index 231cf2e2..9a9df50e 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -32,9 +32,6 @@ #include "PortImpl.hpp" #include "Driver.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { @@ -43,8 +40,8 @@ CreateNode::CreateNode(Engine& engine, Interface* client, int32_t id, SampleCount timestamp, - const Path& path, - const URI& plugin_uri, + const Raul::Path& path, + const Raul::URI& plugin_uri, const Resource::Properties& properties) : Event(engine, client, id, timestamp) , _path(path) diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index ed31130b..d23c4506 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -27,9 +27,6 @@ #include "Driver.hpp" #include "EngineStore.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { @@ -66,7 +63,7 @@ CreatePatch::pre_process() return; } - const Path& path = (const Path&)_path; + const Raul::Path& path = (const Raul::Path&)_path; _parent = _engine.engine_store()->find_patch(path.parent()); if (_parent == NULL) { diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index d2377a36..448f7768 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -33,9 +33,6 @@ #include "PluginImpl.hpp" #include "PortImpl.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { @@ -113,8 +110,8 @@ CreatePort::pre_process() Resource::Properties::const_iterator index_i = _properties.find(uris.lv2_index); if (index_i == _properties.end()) { index_i = _properties.insert( - make_pair(uris.lv2_index, - _engine.world()->forge().make(int32_t(old_num_ports)))); + std::make_pair(uris.lv2_index, + _engine.world()->forge().make(int32_t(old_num_ports)))); } else if (index_i->second.type() != uris.forge.Int || index_i->second.get_int32() != static_cast(old_num_ports)) { Event::pre_process(); diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index a91702cc..c7e658bc 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -30,8 +30,6 @@ #include "PluginImpl.hpp" #include "PortImpl.hpp" -using namespace std; - namespace Ingen { namespace Server { namespace Events { diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index b6432d0b..e7ed572f 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -34,9 +34,6 @@ #include "ThreadManager.hpp" #include "events/Disconnect.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 123b218b..f869c5d3 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -36,19 +36,16 @@ #include "events/DisconnectAll.hpp" #include "util.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { -DisconnectAll::DisconnectAll(Engine& engine, - Interface* client, - int32_t id, - SampleCount timestamp, - const Path& parent_path, - const Path& node_path) +DisconnectAll::DisconnectAll(Engine& engine, + Interface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& parent_path, + const Raul::Path& node_path) : Event(engine, client, id, timestamp) , _parent_path(parent_path) , _path(node_path) diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 1e5e8cd7..0f1a16d7 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -24,17 +24,15 @@ #include "ObjectSender.hpp" #include "PluginImpl.hpp" -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { -Get::Get(Engine& engine, - Interface* client, - int32_t id, - SampleCount timestamp, - const URI& uri) +Get::Get(Engine& engine, + Interface* client, + int32_t id, + SampleCount timestamp, + const Raul::URI& uri) : Event(engine, client, id, timestamp) , _uri(uri) , _object(NULL) @@ -50,8 +48,8 @@ Get::pre_process() if (_uri == "ingen:plugins") { _plugins = _engine.node_factory()->plugins(); - } else if (Path::is_valid(_uri.str())) { - _object = _engine.engine_store()->find_object(Path(_uri.str())); + } else if (Raul::Path::is_valid(_uri.str())) { + _object = _engine.engine_store()->find_object(Raul::Path(_uri.str())); } else { _plugin = _engine.node_factory()->plugin(_uri); } diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 0969eea2..a7273d81 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -27,19 +27,16 @@ #include "PatchImpl.hpp" #include "events/Move.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { -Move::Move(Engine& engine, - Interface* client, - int32_t id, - SampleCount timestamp, - const Path& path, - const Path& new_path) +Move::Move(Engine& engine, + Interface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Raul::Path& new_path) : Event(engine, client, id, timestamp) , _old_path(path) , _new_path(new_path) @@ -75,20 +72,20 @@ Move::pre_process() return; } - SharedPtr< Table > > removed + SharedPtr< Raul::Table< Raul::Path, SharedPtr > > removed = _engine.engine_store()->remove(_store_iterator); assert(removed->size() > 0); - for (Table >::iterator i = removed->begin(); i != removed->end(); ++i) { - const Path& child_old_path = i->first; - assert(Path::descendant_comparator(_old_path, child_old_path)); + for (Raul::Table< Raul::Path, SharedPtr >::iterator i = removed->begin(); i != removed->end(); ++i) { + const Raul::Path& child_old_path = i->first; + assert(Raul::Path::descendant_comparator(_old_path, child_old_path)); - Path child_new_path; + Raul::Path child_new_path; if (child_old_path == _old_path) child_new_path = _new_path; else - child_new_path = Path(_new_path).base() + child_old_path.substr(_old_path.length()+1); + child_new_path = Raul::Path(_new_path).base() + child_old_path.substr(_old_path.length()+1); PtrCast(i->second)->set_path(child_new_path); i->first = child_new_path; diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp index 42392a8a..38e7490c 100644 --- a/src/server/events/SetMetadata.cpp +++ b/src/server/events/SetMetadata.cpp @@ -42,9 +42,6 @@ #define LOG(s) s << "[SetMetadata] " -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { @@ -57,7 +54,7 @@ SetMetadata::SetMetadata(Engine& engine, SampleCount timestamp, bool create, Resource::Graph context, - const URI& subject, + const Raul::URI& subject, const Properties& properties, const Properties& remove) : Event(engine, client, id, timestamp) @@ -107,12 +104,12 @@ SetMetadata::pre_process() { typedef Properties::const_iterator iterator; - const bool is_graph_object = Path::is_path(_subject); + const bool is_graph_object = Raul::Path::is_path(_subject); _lock.acquire(); _object = is_graph_object - ? _engine.engine_store()->find_object(Path(_subject.str())) + ? _engine.engine_store()->find_object(Raul::Path(_subject.str())) : static_cast(_engine.node_factory()->plugin(_subject)); if (!_object && (!is_graph_object || !_create)) { @@ -124,7 +121,7 @@ SetMetadata::pre_process() const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); if (is_graph_object && !_object) { - Path path(_subject.str()); + Raul::Path path(_subject.str()); bool is_patch = false, is_node = false, is_port = false, is_output = false; Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output); @@ -146,7 +143,7 @@ SetMetadata::pre_process() if (_create_event) { _create_event->pre_process(); // Grab the object for applying properties, if the create-event succeeded - _object = _engine.engine_store()->find_object(Path(_subject.str())); + _object = _engine.engine_store()->find_object(Raul::Path(_subject.str())); } else { _status = BAD_OBJECT_TYPE; } diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 2c21fdbb..6305ff1e 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -33,9 +33,6 @@ #include "ProcessContext.hpp" #include "SetPortValue.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Server { namespace Events { @@ -145,7 +142,7 @@ SetPortValue::apply(Context& context) return; } - warn << "Unknown value type " << (int)_value.type() << endl; + Raul::warn(Raul::fmt("Unknown value type %1%\n") % _value.type()); } } -- cgit v1.2.1