diff options
author | David Robillard <d@drobilla.net> | 2012-05-10 06:24:07 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-10 06:24:07 +0000 |
commit | 0c9e861caa8b1eed5068942edc35d5f91bac816e (patch) | |
tree | b241856ddf49e1b1192f8ea442d1733d9d31b2f2 /src | |
parent | 8ec295a0f2a40086ed83e8d2ad8ad38c8125bcb4 (diff) | |
download | ingen-0c9e861caa8b1eed5068942edc35d5f91bac816e.tar.gz ingen-0c9e861caa8b1eed5068942edc35d5f91bac816e.tar.bz2 ingen-0c9e861caa8b1eed5068942edc35d5f91bac816e.zip |
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
Diffstat (limited to 'src')
56 files changed, 292 insertions, 389 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 301737ae..ad5c6a60 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -25,12 +25,11 @@ #include "raul/PathTable.hpp" #include "raul/log.hpp" -#define LOG(s) s << "[ClientStore] " +#define LOG(s) (s("[ClientStore] ")) // #define INGEN_CLIENT_STORE_DUMP 1 using namespace std; -using namespace Raul; namespace Ingen { @@ -102,15 +101,15 @@ ClientStore::add_object(SharedPtr<ObjectModel> object) i != object->properties().end(); ++i) object->signal_property().emit(i->first, i->second); - LOG(debug) << "Added " << object->path() << " {" << endl; + LOG(Raul::debug) << "Added " << object->path() << " {" << endl; for (iterator i = begin(); i != end(); ++i) { - LOG(debug) << "\t" << i->first << endl; + LOG(Raul::debug) << "\t" << i->first << endl; } - LOG(debug) << "}" << endl; + LOG(Raul::debug) << "}" << endl; } SharedPtr<ObjectModel> -ClientStore::remove_object(const Path& path) +ClientStore::remove_object(const Raul::Path& path) { iterator i = find(path); @@ -120,11 +119,11 @@ ClientStore::remove_object(const Path& path) iterator end = find_descendants_end(i); SharedPtr<Store::Objects> removed = yank(i, end); - LOG(debug) << "Removing " << i->first << " {" << endl; + LOG(Raul::debug) << "Removing " << i->first << " {" << endl; for (iterator i = removed->begin(); i != removed->end(); ++i) { - LOG(debug) << "\t" << i->first << endl; + LOG(Raul::debug) << "\t" << i->first << endl; } - LOG(debug) << "}" << endl; + LOG(Raul::debug) << "}" << endl; if (result) result->signal_destroyed().emit(); @@ -148,7 +147,7 @@ ClientStore::remove_object(const Path& path) } SharedPtr<PluginModel> -ClientStore::_plugin(const URI& uri) +ClientStore::_plugin(const Raul::URI& uri) { assert(uri.length() > 0); Plugins::iterator i = _plugins->find(uri); @@ -165,7 +164,7 @@ ClientStore::plugin(const Raul::URI& uri) const } SharedPtr<ObjectModel> -ClientStore::_object(const Path& path) +ClientStore::_object(const Raul::Path& path) { assert(path.length() > 0); iterator i = find(path); @@ -180,15 +179,15 @@ ClientStore::_object(const Path& path) } SharedPtr<const ObjectModel> -ClientStore::object(const Path& path) const +ClientStore::object(const Raul::Path& path) const { return const_cast<ClientStore*>(this)->_object(path); } SharedPtr<Resource> -ClientStore::_resource(const URI& uri) +ClientStore::_resource(const Raul::URI& uri) { - if (Path::is_path(uri)) + if (Raul::Path::is_path(uri)) return _object(uri.str()); else return _plugin(uri); @@ -215,7 +214,7 @@ ClientStore::add_plugin(SharedPtr<PluginModel> pm) /* ****** Signal Handlers ******** */ void -ClientStore::del(const URI& uri) +ClientStore::del(const Raul::URI& uri) { if (!Raul::Path::is_path(uri)) return; @@ -223,16 +222,13 @@ ClientStore::del(const URI& uri) const Raul::Path path(uri.str()); SharedPtr<ObjectModel> removed = remove_object(path); removed.reset(); - LOG(debug) << "Removed object " << path - << ", count: " << removed.use_count(); + LOG(Raul::debug) << "Removed object " << path + << ", count: " << removed.use_count(); } void -ClientStore::move(const Path& old_path_str, const Path& new_path_str) +ClientStore::move(const Raul::Path& old_path, const Raul::Path& new_path) { - Path old_path(old_path_str); - Path new_path(new_path_str); - iterator parent = find(old_path); if (parent == end()) { LOG(Raul::error) << "Failed to find object " << old_path @@ -240,27 +236,27 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str) return; } - typedef Table<Path, SharedPtr<GraphObject> > Removed; + typedef Table<Raul::Path, SharedPtr<GraphObject> > Removed; iterator end = find_descendants_end(parent); SharedPtr<Removed> removed = yank(parent, end); assert(removed->size() > 0); - typedef Table<Path, SharedPtr<GraphObject> > PathTable; + typedef Table<Raul::Path, SharedPtr<GraphObject> > PathTable; for (PathTable::iterator i = removed->begin(); i != removed->end(); ++i) { - const Path& child_old_path = i->first; - assert(Path::descendant_comparator(old_path, child_old_path)); + 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 = new_path.base() + child_old_path.substr(old_path.length() + 1); - LOG(info) << "Renamed " << child_old_path - << " -> " << child_new_path << endl; + LOG(Raul::info)(Raul::fmt("Renamed %1% to %2%\n") + % child_old_path % child_new_path); PtrCast<ObjectModel>(i->second)->set_path(child_new_path); i->first = child_new_path; } @@ -269,17 +265,17 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str) } void -ClientStore::put(const URI& uri, +ClientStore::put(const Raul::URI& uri, const Resource::Properties& properties, Resource::Graph ctx) { typedef Resource::Properties::const_iterator Iterator; #ifdef INGEN_CLIENT_STORE_DUMP - LOG(info) << "PUT " << uri << " {" << endl; + LOG(Raul::info) << "PUT " << uri << " {" << endl; for (Iterator i = properties.begin(); i != properties.end(); ++i) - LOG(info) << '\t' << i->first << " = " << _uris->forge.str(i->second) + LOG(Raul::info) << '\t' << i->first << " = " << _uris->forge.str(i->second) << " :: " << i->second.type() << endl; - LOG(info) << "}" << endl; + LOG(Raul::info) << "}" << endl; #endif bool is_patch, is_node, is_port, is_output; @@ -289,8 +285,8 @@ ClientStore::put(const 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 Atom& type = t->second; - const URI& type_uri = type.get_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; @@ -302,12 +298,12 @@ ClientStore::put(const URI& uri, } } - if (!Path::is_valid(uri.str())) { + if (!Raul::Path::is_valid(uri.str())) { LOG(Raul::error) << "Bad path `" << uri.str() << "'" << endl; return; } - const Path path(uri.str()); + const Raul::Path path(uri.str()); SharedPtr<ObjectModel> obj = PtrCast<ObjectModel>(_object(path)); if (obj) { @@ -328,8 +324,8 @@ ClientStore::put(const URI& uri, SharedPtr<PluginModel> plug; if (p->second.is_valid() && p->second.type() == _uris->forge.URI) { if (!(plug = _plugin(p->second.get_uri()))) { - LOG(warn) << "Unable to find plugin " - << p->second.get_uri() << endl; + 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(), @@ -342,7 +338,7 @@ ClientStore::put(const URI& uri, n->set_properties(properties); add_object(n); } else { - LOG(warn) << "Node " << path << " has no plugin" << endl; + LOG(Raul::warn)(Raul::fmt("Node %1% has no plugin\n") % path); } } else if (is_port) { PortModel::Direction pdir = (is_output) @@ -359,54 +355,54 @@ ClientStore::put(const URI& uri, LOG(Raul::error) << "Port " << path << " has no index" << endl; } } else { - LOG(warn) << "Ignoring object " << path << " with unknown type " - << is_patch << " " << is_node << " " << is_port << endl; + LOG(Raul::warn)(Raul::fmt("Ignoring object %1% with unknown type\n") + % path); } } void -ClientStore::delta(const URI& uri, +ClientStore::delta(const Raul::URI& uri, const Resource::Properties& remove, const Resource::Properties& add) { typedef Resource::Properties::const_iterator iterator; #ifdef INGEN_CLIENT_STORE_DUMP - LOG(info) << "DELTA " << uri << " {" << endl; + LOG(Raul::info) << "DELTA " << uri << " {" << endl; for (iterator i = remove.begin(); i != remove.end(); ++i) - LOG(info) << " - " << i->first - << " = " << _uris->forge.str(i->second) - << " :: " << i->second.type() << endl; + LOG(Raul::info) << " - " << i->first + << " = " << _uris->forge.str(i->second) + << " :: " << i->second.type() << endl; for (iterator i = add.begin(); i != add.end(); ++i) - LOG(info) << " + " << i->first - << " = " << _uris->forge.str(i->second) - << " :: " << i->second.type() << endl; - LOG(info) << "}" << endl; + LOG(Raul::info) << " + " << i->first + << " = " << _uris->forge.str(i->second) + << " :: " << i->second.type() << endl; + LOG(Raul::info) << "}" << endl; #endif - if (!Path::is_valid(uri.str())) { + if (!Raul::Path::is_valid(uri.str())) { LOG(Raul::error) << "Bad path `" << uri.str() << "'" << endl; return; } - const Path path(uri.str()); + const Raul::Path path(uri.str()); SharedPtr<ObjectModel> obj = _object(path); if (obj) { obj->remove_properties(remove); obj->add_properties(add); } else { - LOG(warn) << "Failed to find object `" << path << "'" << endl; + LOG(Raul::warn)(Raul::fmt("Failed to find object `%1%'\n") % path); } } void -ClientStore::set_property(const URI& subject_uri, - const URI& predicate, - const Atom& value) +ClientStore::set_property(const Raul::URI& subject_uri, + const Raul::URI& predicate, + const Raul::Atom& value) { if (subject_uri == _uris->ingen_engine) { - LOG(info) << "Engine property " << predicate - << " = " << _uris->forge.str(value) << endl; + LOG(Raul::info)(Raul::fmt("Engine property <%1%> = %2%\n") + % predicate % _uris->forge.str(value)); return; } SharedPtr<Resource> subject = _resource(subject_uri); @@ -417,13 +413,14 @@ ClientStore::set_property(const URI& subject_uri, if (plugin) plugin->set_property(predicate, value); else - LOG(warn) << "Property '" << predicate << "' for unknown object " - << subject_uri << endl; + LOG(Raul::warn)(Raul::fmt("Property <%1%> for unknown object %2%\n") + % predicate % subject_uri); } } SharedPtr<PatchModel> -ClientStore::connection_patch(const Path& tail_path, const Path& head_path) +ClientStore::connection_patch(const Raul::Path& tail_path, + const Raul::Path& head_path) { SharedPtr<PatchModel> patch; @@ -447,8 +444,8 @@ ClientStore::connection_patch(const Path& tail_path, const Path& head_path) } bool -ClientStore::attempt_connection(const Path& tail_path, - const Path& head_path) +ClientStore::attempt_connection(const Raul::Path& tail_path, + const Raul::Path& head_path) { SharedPtr<PortModel> tail = PtrCast<PortModel>(_object(tail_path)); SharedPtr<PortModel> head = PtrCast<PortModel>(_object(head_path)); @@ -468,24 +465,24 @@ ClientStore::attempt_connection(const Path& tail_path, } void -ClientStore::connect(const Path& src_path, - const Path& dst_path) +ClientStore::connect(const Raul::Path& src_path, + const Raul::Path& dst_path) { attempt_connection(src_path, dst_path); } void -ClientStore::disconnect(const Path& src, - const Path& dst) +ClientStore::disconnect(const Raul::Path& src, + const Raul::Path& dst) { - if (!Path::is_path(src) && !Path::is_path(dst)) { + if (!Raul::Path::is_path(src) && !Raul::Path::is_path(dst)) { std::cerr << "Bad disconnect notification " << src << " => " << dst << std::endl; return; } - const Path src_path(src.str()); - const Path dst_path(dst.str()); + const Raul::Path src_path(src.str()); + const Raul::Path dst_path(dst.str()); SharedPtr<PortModel> tail = PtrCast<PortModel>(_object(src_path)); SharedPtr<PortModel> head = PtrCast<PortModel>(_object(dst_path)); diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 652ed318..f80aa68d 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -22,15 +22,12 @@ #include "ingen/shared/URIs.hpp" #include "ingen/shared/World.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Client { NodeModel::NodeModel(Shared::URIs& uris, SharedPtr<PluginModel> plugin, - const Path& path) + const Raul::Path& path) : Node() , ObjectModel(uris, path) , _plugin_uri(plugin->uri()) @@ -41,9 +38,9 @@ NodeModel::NodeModel(Shared::URIs& uris, { } -NodeModel::NodeModel(Shared::URIs& uris, - const URI& plugin_uri, - const Path& path) +NodeModel::NodeModel(Shared::URIs& uris, + const Raul::URI& plugin_uri, + const Raul::Path& path) : Node() , ObjectModel(uris, path) , _plugin_uri(plugin_uri) @@ -83,7 +80,7 @@ NodeModel::remove_port(SharedPtr<PortModel> port) } void -NodeModel::remove_port(const Path& port_path) +NodeModel::remove_port(const Raul::Path& port_path) { for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { if ((*i)->path() == port_path) { @@ -204,8 +201,8 @@ NodeModel::port_value_range(SharedPtr<const PortModel> port, default_port_value_range(port, min, max); // Possibly overriden - const Atom& min_atom = port->get_property(_uris.lv2_minimum); - const Atom& max_atom = port->get_property(_uris.lv2_maximum); + const Raul::Atom& min_atom = port->get_property(_uris.lv2_minimum); + const Raul::Atom& max_atom = port->get_property(_uris.lv2_maximum); if (min_atom.type() == _uris.forge.Float) min = min_atom.get_float(); if (max_atom.type() == _uris.forge.Float) diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 452a6a3b..271d0b66 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -19,9 +19,6 @@ #include "ingen/shared/URIs.hpp" #include "raul/TableImpl.hpp" -using namespace std; -using namespace Raul; - namespace Ingen { namespace Client { @@ -29,7 +26,7 @@ ObjectModel::ObjectModel(Shared::URIs& uris, const Raul::Path& path) : ResourceImpl(uris, path) , _meta(uris, Raul::URI("http://example.org/FIXME")) , _path(path) - , _symbol((path == Path::root()) ? "root" : path.symbol()) + , _symbol((path == Raul::Path::root()) ? "root" : path.symbol()) { } @@ -58,10 +55,10 @@ ObjectModel::on_property(const Raul::URI& uri, const Raul::Atom& value) _signal_property.emit(uri, value); } -const Atom& +const Raul::Atom& ObjectModel::get_property(const Raul::URI& key) const { - static const Atom null_atom; + static const Raul::Atom null_atom; Resource::Properties::const_iterator i = properties().find(key); return (i != properties().end()) ? i->second : null_atom; } diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index 91c0c7f1..e52e4eea 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -25,7 +25,6 @@ #include "ingen/shared/URIs.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Client { @@ -148,8 +147,8 @@ PatchModel::remove_connection(const Port* tail, const Ingen::Port* head) _signal_removed_connection.emit(c); _connections->erase(i); } else { - warn << "[PatchModel::remove_connection] Failed to find connection " << - tail->path() << " -> " << head->path() << endl; + Raul::warn(Raul::fmt("Failed to remove patch connection %1% => %2%\n") + % tail->path() % head->path()); } } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 1612be45..e6ac0a52 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -28,7 +28,6 @@ #include "ingen_config.h" using namespace std; -using namespace Raul; namespace Ingen { namespace Client { @@ -39,8 +38,8 @@ const LilvPlugins* PluginModel::_lilv_plugins = NULL; Sord::World* PluginModel::_rdf_world = NULL; PluginModel::PluginModel(Shared::URIs& uris, - const URI& uri, - const URI& type_uri, + const Raul::URI& uri, + const Raul::URI& type_uri, const Resource::Properties& properties) : ResourceImpl(uris, uri) , _type(type_from_uri(type_uri.str())) @@ -60,17 +59,17 @@ PluginModel::PluginModel(Shared::URIs& uris, } } -const Atom& -PluginModel::get_property(const URI& key) const +const Raul::Atom& +PluginModel::get_property(const Raul::URI& key) const { - static const Atom nil; - const Atom& val = ResourceImpl::get_property(key); + static const Raul::Atom nil; + const Raul::Atom& val = ResourceImpl::get_property(key); if (val.is_valid()) return val; // No lv2:symbol from data or engine, invent one if (key == _uris.lv2_symbol) { - const URI& uri = this->uri(); + const Raul::URI& uri = this->uri(); size_t last_slash = uri.find_last_of('/'); size_t last_hash = uri.find_last_of('#'); string symbol; @@ -150,12 +149,12 @@ PluginModel::set(SharedPtr<PluginModel> p) _signal_changed.emit(); } -Symbol +Raul::Symbol PluginModel::default_node_symbol() const { - const Atom& name_atom = get_property(LV2_CORE__symbol); + const Raul::Atom& name_atom = get_property(LV2_CORE__symbol); if (name_atom.is_valid() && name_atom.type() == _uris.forge.String) - return Symbol::symbolify(name_atom.get_string()); + return Raul::Symbol::symbolify(name_atom.get_string()); else return "_"; } @@ -163,7 +162,7 @@ PluginModel::default_node_symbol() const string PluginModel::human_name() const { - const Atom& name_atom = get_property("http://usefulinc.com/ns/doap#name"); + const Raul::Atom& name_atom = get_property("http://usefulinc.com/ns/doap#name"); if (name_atom.type() == _uris.forge.String) return name_atom.get_string(); else diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 939716ef..59d4c1b4 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -24,7 +24,6 @@ #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" using namespace std; -using namespace Raul; namespace Ingen { namespace Client { @@ -42,8 +41,8 @@ lv2_ui_write(SuilController controller, const NodeModel::Ports& ports = ui->node()->ports(); if (port_index >= ports.size()) { - error << "UI for " << ui->node()->plugin()->uri() - << " tried to write to non-existent port " << port_index << endl; + Raul::error << (Raul::fmt("%1% UI tried to write to invalid port %2%") + % ui->node()->plugin()->uri() % port_index) << endl; return; } @@ -71,8 +70,8 @@ lv2_ui_write(SuilController controller, val); } else { - warn << "Unknown value format " << format - << " from LV2 UI " << ui->node()->plugin()->uri() << endl; + Raul::warn(Raul::fmt("Unknown value format %1% from LV2 UI\n") + % format % ui->node()->plugin()->uri()); } } @@ -145,7 +144,7 @@ PluginUI::create(Ingen::Shared::World* world, if (instance) { ret->_instance = instance; } else { - error << "Failed to instantiate LV2 UI" << endl; + Raul::error << "Failed to instantiate LV2 UI" << endl; ret.reset(); } diff --git a/src/gui/App.cpp b/src/gui/App.cpp index c4c9cfe6..3b3fa6f9 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -47,7 +47,7 @@ #include "WidgetFactory.hpp" #include "WindowFactory.hpp" -#define LOG(s) s << "[GUI] " +#define LOG(s) (s("[GUI] ")) using namespace std; using namespace Raul; @@ -149,7 +149,7 @@ App::run() break; _main->run(); - LOG(info) << "Exiting" << endl; + LOG(info)("Exiting\n"); } void @@ -226,7 +226,7 @@ App::property_change(const Raul::URI& subject, { if (subject == uris().ingen_engine && key == uris().ingen_sampleRate) { if (value.type() == forge().Int) { - LOG(info) << "Sample rate: " << uris().forge.str(value) << std::endl; + LOG(info)(Raul::fmt("Sample rate: %1%\n") % uris().forge.str(value)); _sample_rate = value.get_int32(); } else { error << "Engine sample rate property is not an integer" << std::endl; diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 282e83bc..4d54f4dc 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -181,7 +181,7 @@ void PatchView::refresh_clicked() { _app->engine()->get(_patch->path()); - Raul::warn << "Refresh plugins" << std::endl; + Raul::warn("Refreshing plugins\n"); _app->engine()->get("ingen:plugins"); } diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index c9c858cb..7d84abca 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -136,7 +136,7 @@ void Port::on_value_changed(GVariant* value) { if (!g_variant_is_of_type(value, G_VARIANT_TYPE_DOUBLE)) { - Raul::warn << "TODO: Non-float port value changed." << std::endl; + Raul::warn("TODO: Non-float port value changed\n"); return; } diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 2878ebc7..2798d7eb 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -50,7 +50,6 @@ #endif using namespace std; -using namespace Raul; using namespace Ingen; Ingen::Shared::World* world = NULL; @@ -168,13 +167,13 @@ main(int argc, char** argv) // Load a patch if (conf.option("load").is_valid() || !conf.files().empty()) { - boost::optional<Path> parent; - boost::optional<Symbol> symbol; + boost::optional<Raul::Path> parent; + boost::optional<Raul::Symbol> symbol; const Raul::Configuration::Value& path_option = conf.option("path"); if (path_option.is_valid()) { - if (Path::is_valid(path_option.get_string())) { - const Path p(path_option.get_string()); + if (Raul::Path::is_valid(path_option.get_string())) { + const Raul::Path p(path_option.get_string()); if (!p.is_root()) { parent = p.parent(); symbol = p.symbol(); @@ -221,7 +220,7 @@ main(int argc, char** argv) while (world->local_engine()->main_iteration()) { Glib::usleep(125000); // 1/8 second } - info << "Finished main loop" << endl; + Raul::info("Finished main loop\n"); } // Shut down diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index c1cce1ee..96afc708 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -32,7 +32,7 @@ #include "sord/sordmm.hpp" #include "sratom/sratom.h" -#define LOG(s) s << "[Parser] " +#define LOG(s) (s("[Parser] ")) #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" @@ -375,7 +375,7 @@ parse_patch(Ingen::Shared::World* world, PortRecord port_record; const int index = get_port(world, model, port, patch_path, port_record); if (index < 0) { - LOG(error) << "Invalid port " << port << endl; + LOG(Raul::error) << "Invalid port " << port << endl; return boost::optional<Path>(); } @@ -580,11 +580,11 @@ Parser::parse_file(Ingen::Shared::World* world, serd_env_free(env); - LOG(info) << "Parsing " << path << endl; + LOG(Raul::info)(Raul::fmt("Parsing %1%\n") % path); if (parent) - LOG(info) << "Parent: " << *parent << endl; + LOG(Raul::info)(Raul::fmt("Parent: %1%\n") % *parent); if (symbol) - LOG(info) << "Symbol: " << *symbol << endl; + LOG(Raul::info)(Raul::fmt("Symbol: %1%\n") % symbol->c_str()); boost::optional<Path> parsed_path = parse(world, target, model, path, parent, symbol, data); @@ -593,7 +593,7 @@ Parser::parse_file(Ingen::Shared::World* world, target->set_property(*parsed_path, "http://drobilla.net/ns/ingen#document", world->forge().alloc_uri(uri)); } else { - LOG(warn) << "Document URI lost" << endl; + LOG(Raul::warn)("Document URI lost\n"); } return parsed_path; @@ -614,7 +614,7 @@ Parser::parse_string(Ingen::Shared::World* world, model.load_string(env, SERD_TURTLE, str.c_str(), str.length(), base_uri); serd_env_free(env); - LOG(info) << "Parsing string"; + LOG(Raul::info) << "Parsing string"; if (!base_uri.empty()) info << " (base " << base_uri << ")"; info << endl; diff --git a/src/server/AudioBuffer.cpp b/src/server/AudioBuffer.cpp index 66977643..476bdf07 100644 --- a/src/server/AudioBuffer.cpp +++ b/src/server/AudioBuffer.cpp @@ -26,7 +26,6 @@ #include "ProcessContext.hpp" using namespace std; -using namespace Raul; /* TODO: Be sure these functions are vectorized by GCC when its vectorizer * stops sucking. Probably a good idea to inline them as well */ diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index fce074da..535da6b5 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -25,8 +25,6 @@ #include "Engine.hpp" #include "ThreadManager.hpp" -using namespace Raul; - namespace Ingen { namespace Server { diff --git a/src/server/ClientBroadcaster.cpp b/src/server/ClientBroadcaster.cpp index 42aad778..1194cd82 100644 --- a/src/server/ClientBroadcaster.cpp +++ b/src/server/ClientBroadcaster.cpp @@ -16,19 +16,18 @@ #include <cassert> #include <unistd.h> -#include "raul/log.hpp" + #include "ingen/Interface.hpp" +#include "raul/log.hpp" + #include "ClientBroadcaster.hpp" -#include "PluginImpl.hpp" #include "ConnectionImpl.hpp" #include "EngineStore.hpp" #include "ObjectSender.hpp" +#include "PluginImpl.hpp" #include "util.hpp" -#define LOG(s) s << "[ClientBroadcaster] " - -using namespace std; -using namespace Raul; +#define LOG(s) (s("[ClientBroadcaster] ")) namespace Ingen { namespace Server { @@ -36,10 +35,11 @@ namespace Server { /** Register a client to receive messages over the notification band. */ void -ClientBroadcaster::register_client(const URI& uri, SharedPtr<Interface> client) +ClientBroadcaster::register_client(const Raul::URI& uri, + SharedPtr<Interface> client) { Glib::Mutex::Lock lock(_clients_mutex); - LOG(info) << "Registered client: " << uri << endl; + LOG(Raul::info)(Raul::fmt("Registered client <%1%>\n") % uri); _clients[uri] = client; } @@ -48,15 +48,13 @@ ClientBroadcaster::register_client(const URI& uri, SharedPtr<Interface> client) * @return true if client was found and removed. */ bool -ClientBroadcaster::unregister_client(const URI& uri) +ClientBroadcaster::unregister_client(const Raul::URI& uri) { Glib::Mutex::Lock lock(_clients_mutex); const size_t erased = _clients.erase(uri); if (erased > 0) { - LOG(info) << "Unregistered client: " << uri << endl; - } else { - LOG(warn) << "Failed to find client to unregister: " << uri << endl; + LOG(Raul::info)(Raul::fmt("Unregistered client <%1%>\n") % uri); } return (erased > 0); @@ -66,7 +64,7 @@ ClientBroadcaster::unregister_client(const URI& uri) * unique identifier for registered clients). */ SharedPtr<Interface> -ClientBroadcaster::client(const URI& uri) +ClientBroadcaster::client(const Raul::URI& uri) { Glib::Mutex::Lock lock(_clients_mutex); Clients::iterator i = _clients.find(uri); @@ -87,7 +85,8 @@ ClientBroadcaster::send_plugins(const NodeFactory::Plugins& plugins) } void -ClientBroadcaster::send_plugins_to(Interface* client, const NodeFactory::Plugins& plugins) +ClientBroadcaster::send_plugins_to(Interface* client, + const NodeFactory::Plugins& plugins) { client->bundle_begin(); diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index ac0d5018..1cf8e969 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -33,7 +33,6 @@ #define LOG(s) s << "[ControlBindings] " using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -68,9 +67,9 @@ ControlBindings::binding_key(const Raul::Atom& binding) const const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); Key key; if (binding.type() == _engine.world()->forge().Dict) { - const Atom::DictValue& dict = binding.get_dict(); - Atom::DictValue::const_iterator t = dict.find(uris.rdf_type); - Atom::DictValue::const_iterator n; + const Raul::Atom::DictValue& dict = binding.get_dict(); + Raul::Atom::DictValue::const_iterator t = dict.find(uris.rdf_type); + Raul::Atom::DictValue::const_iterator n; if (t == dict.end()) { return key; } else if (t->second == uris.midi_Bender) { @@ -225,14 +224,14 @@ ControlBindings::port_value_to_control(PortImpl* port, float normal = (value - min) / (max - min); if (normal < 0.0f) { - warn << "Value " << value << " (normal " << normal << ") for " + LOG(Raul::warn) << "Value " << value << " (normal " << normal << ") for " << port->path() << " out of range" << endl; normal = 0.0f; } if (normal > 1.0f) { - warn << "Value " << value << " (normal " << normal << ") for " - << port->path() << " out of range" << endl; + LOG(Raul::warn) << "Value " << value << " (normal " << normal << ") for " + << port->path() << " out of range" << endl; normal = 1.0f; } diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 004a9806..971b41e0 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -45,7 +45,6 @@ #include "ThreadManager.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { diff --git a/src/server/EngineStore.cpp b/src/server/EngineStore.cpp index 105fcc3c..00856ee5 100644 --- a/src/server/EngineStore.cpp +++ b/src/server/EngineStore.cpp @@ -29,7 +29,6 @@ #define LOG(s) s << "[EngineStore] " using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -42,7 +41,7 @@ EngineStore::~EngineStore() /** Find the Patch at the given path. */ PatchImpl* -EngineStore::find_patch(const Path& path) +EngineStore::find_patch(const Raul::Path& path) { GraphObjectImpl* const object = find_object(path); return dynamic_cast<PatchImpl*>(object); @@ -51,7 +50,7 @@ EngineStore::find_patch(const Path& path) /** Find the Node at the given path. */ NodeImpl* -EngineStore::find_node(const Path& path) +EngineStore::find_node(const Raul::Path& path) { GraphObjectImpl* const object = find_object(path); return dynamic_cast<NodeImpl*>(object); @@ -60,7 +59,7 @@ EngineStore::find_node(const Path& path) /** Find the Port at the given path. */ PortImpl* -EngineStore::find_port(const Path& path) +EngineStore::find_port(const Raul::Path& path) { GraphObjectImpl* const object = find_object(path); return dynamic_cast<PortImpl*>(object); @@ -69,7 +68,7 @@ EngineStore::find_port(const Path& path) /** Find the Object at the given path. */ GraphObjectImpl* -EngineStore::find_object(const Path& path) +EngineStore::find_object(const Raul::Path& path) { iterator i = find(path); return ((i == end()) ? NULL : dynamic_cast<GraphObjectImpl*>(i->second.get())); @@ -99,7 +98,7 @@ EngineStore::add(const Objects& table) * including the object itself, in lexicographically sorted order by Path. */ SharedPtr<EngineStore::Objects> -EngineStore::remove(const Path& path) +EngineStore::remove(const Raul::Path& path) { return remove(find(path)); } @@ -121,7 +120,7 @@ EngineStore::remove(iterator object) return removed; } else { - LOG(warn) << "Removing " << object->first << " failed." << endl; + LOG(Raul::warn) << "Removing " << object->first << " failed." << endl; return SharedPtr<EngineStore>(); } } @@ -132,7 +131,7 @@ EngineStore::remove(iterator object) * in lexicographically sorted order by Path. */ SharedPtr<EngineStore::Objects> -EngineStore::remove_children(const Path& path) +EngineStore::remove_children(const Raul::Path& path) { return remove_children(find(path)); } @@ -153,7 +152,7 @@ EngineStore::remove_children(iterator object) return yank(first_child, descendants_end); } } else { - LOG(warn) << "Removing children of " << object->first << " failed." << endl; + LOG(Raul::warn) << "Removing children of " << object->first << " failed." << endl; return SharedPtr<EngineStore::Objects>(); } diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index 4ec0756b..7286cc9e 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -29,7 +29,6 @@ #define LOG(s) s << "[EventWriter] " using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -62,7 +61,7 @@ EventWriter::set_response_id(int32_t id) } void -EventWriter::put(const URI& uri, +EventWriter::put(const Raul::URI& uri, const Resource::Properties& properties, const Resource::Graph ctx) { @@ -72,7 +71,7 @@ EventWriter::put(const URI& uri, } void -EventWriter::delta(const URI& uri, +EventWriter::delta(const Raul::URI& uri, const Resource::Properties& remove, const Resource::Properties& add) { @@ -82,8 +81,8 @@ EventWriter::delta(const URI& uri, } void -EventWriter::move(const Path& old_path, - const Path& new_path) +EventWriter::move(const Raul::Path& old_path, + const Raul::Path& new_path) { _engine.enqueue_event( new Events::Move(_engine, _respondee.get(), _request_id, now(), @@ -91,7 +90,7 @@ EventWriter::move(const Path& old_path, } void -EventWriter::del(const URI& uri) +EventWriter::del(const Raul::URI& uri) { if (uri == "ingen:engine") { if (_respondee) { @@ -105,8 +104,8 @@ EventWriter::del(const URI& uri) } void -EventWriter::connect(const Path& tail_path, - const Path& head_path) +EventWriter::connect(const Raul::Path& tail_path, + const Raul::Path& head_path) { _engine.enqueue_event( new Events::Connect(_engine, _respondee.get(), _request_id, now(), @@ -115,23 +114,17 @@ EventWriter::connect(const Path& tail_path, } void -EventWriter::disconnect(const Path& src, - const Path& dst) +EventWriter::disconnect(const Raul::Path& src, + const Raul::Path& dst) { - if (!Path::is_path(src) && !Path::is_path(dst)) { - LOG(Raul::error) << "Bad disconnect request " << src - << " => " << dst << std::endl; - return; - } - _engine.enqueue_event( new Events::Disconnect(_engine, _respondee.get(), _request_id, now(), src, dst)); } void -EventWriter::disconnect_all(const Path& patch_path, - const Path& path) +EventWriter::disconnect_all(const Raul::Path& patch_path, + const Raul::Path& path) { _engine.enqueue_event( new Events::DisconnectAll(_engine, _respondee.get(), _request_id, now(), @@ -139,9 +132,9 @@ EventWriter::disconnect_all(const Path& patch_path, } void -EventWriter::set_property(const URI& uri, - const URI& predicate, - const Atom& value) +EventWriter::set_property(const Raul::URI& uri, + const Raul::URI& predicate, + const Raul::Atom& value) { if (uri == "ingen:engine" && predicate == "ingen:enabled" && value.type() == _engine.world()->forge().Bool) { @@ -165,7 +158,7 @@ EventWriter::set_property(const URI& uri, } void -EventWriter::get(const URI& uri) +EventWriter::get(const Raul::URI& uri) { _engine.enqueue_event( new Events::Get(_engine, _respondee.get(), _request_id, now(), uri)); diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp index 8d052540..8310b670 100644 --- a/src/server/GraphObjectImpl.cpp +++ b/src/server/GraphObjectImpl.cpp @@ -22,14 +22,13 @@ #include "ThreadManager.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { GraphObjectImpl::GraphObjectImpl(Ingen::Shared::URIs& uris, - GraphObjectImpl* parent, - const Symbol& symbol) + GraphObjectImpl* parent, + const Raul::Symbol& symbol) : ResourceImpl(uris, parent ? parent->path().child(symbol) : Raul::Path::root()) , _parent(parent) , _path(parent ? parent->path().child(symbol) : "/") @@ -37,11 +36,11 @@ GraphObjectImpl::GraphObjectImpl(Ingen::Shared::URIs& uris, { } -const Atom& +const Raul::Atom& GraphObjectImpl::get_property(const Raul::URI& key) const { ThreadManager::assert_not_thread(THREAD_PROCESS); - static const Atom null_atom; + static const Raul::Atom null_atom; Resource::Properties::const_iterator i = properties().find(key); return (i != properties().end()) ? i->second : null_atom; } diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index edfc75a2..c7c0e0a8 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -26,7 +26,6 @@ #include "InternalPlugin.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 370a4ce8..6fa1f890 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -47,10 +47,9 @@ #include "ingen/shared/World.hpp" #include "util.hpp" -#define LOG(s) s << "[JackDriver] " +#define LOG(s) (s("[JackDriver] ")) using namespace std; -using namespace Raul; typedef jack_default_audio_sample_t jack_sample_t; @@ -87,7 +86,8 @@ JackPort::create() 0); if (_jack_port == NULL) { - error << "[JackPort] Failed to register port " << _patch_port->path() << endl; + LOG(Raul::error)(Raul::fmt("Failed to register port %1%\n") + % _patch_port->path()); throw JackDriver::PortRegistrationFailedException(); } } @@ -97,7 +97,7 @@ JackPort::destroy() { assert(_jack_port); if (jack_port_unregister(_driver->jack_client(), _jack_port)) - error << "[JackPort] Unable to unregister port" << endl; + LOG(Raul::error)("Unable to unregister port\n"); _jack_port = NULL; } @@ -136,7 +136,7 @@ JackPort::pre_process(ProcessContext& context) if (!patch_buf->append_event( ev.time, ev.size, _driver->_midi_event_type, ev.buffer)) { - LOG(warn) << "Failed to write MIDI to port buffer, event(s) lost!" << endl; + LOG(Raul::warn)("Failed to write to MIDI buffer, events lost!\n"); } } } @@ -208,8 +208,8 @@ JackDriver::attach(const std::string& server_name, _client = jack_client_open(client_name.c_str(), JackSessionID, NULL, uuid.c_str()); - LOG(info) << "Connected to JACK server as client `" - << client_name.c_str() << "' UUID `" << uuid << "'" << endl; + LOG(Raul::info)(Raul::fmt("Connected to JACK as `%1%' (UUID `%2%')\n") + % client_name.c_str() % uuid); } #endif @@ -218,7 +218,8 @@ JackDriver::attach(const std::string& server_name, if ((_client = jack_client_open(client_name.c_str(), JackServerName, NULL, server_name.c_str()))) { - LOG(info) << "Connected to JACK server `" << server_name << "'" << endl; + LOG(Raul::info)(Raul::fmt("Connected to JACK server `%1%'\n") + % server_name); } } @@ -226,12 +227,12 @@ JackDriver::attach(const std::string& server_name, // Connect to default server if (!_client) { if ((_client = jack_client_open(client_name.c_str(), JackNullOption, NULL))) - LOG(info) << "Connected to default JACK server" << endl; + LOG(Raul::info)("Connected to default JACK server\n"); } // Still failed if (!_client) { - LOG(error) << "Unable to connect to Jack" << endl; + LOG(Raul::error)("Unable to connect to Jack\n"); return false; } } else { @@ -244,7 +245,6 @@ JackDriver::attach(const std::string& server_name, jack_on_shutdown(_client, shutdown_cb, this); jack_set_thread_init_callback(_client, thread_init_cb, this); - jack_set_sample_rate_callback(_client, sample_rate_cb, this); jack_set_buffer_size_callback(_client, block_length_cb, this); #ifdef INGEN_JACK_SESSION jack_set_session_callback(_client, session_cb, this); @@ -262,7 +262,7 @@ JackDriver::activate() Shared::World* world = _engine.world(); if (_is_activated) { - LOG(warn) << "Jack driver already activated" << endl; + LOG(Raul::warn)("Jack driver already activated\n"); return; } @@ -279,10 +279,10 @@ JackDriver::activate() is_realtime()); if (jack_activate(_client)) { - LOG(error) << "Could not activate Jack client, aborting" << endl; + LOG(Raul::error)("Could not activate Jack client, aborting\n"); exit(EXIT_FAILURE); } else { - LOG(info) << "Activated Jack client" << endl; + LOG(Raul::info)("Activated Jack client\n"); } } @@ -305,7 +305,7 @@ JackDriver::deactivate() _jack_threads.clear(); - LOG(info) << "Deactivated Jack client" << endl; + LOG(Raul::info)("Deactivated Jack client\n"); } } @@ -333,7 +333,7 @@ JackDriver::add_port(EnginePort* port) * It is the callers responsibility to delete the returned port. */ Raul::Deletable* -JackDriver::remove_port(const Path& path, EnginePort** port) +JackDriver::remove_port(const Raul::Path& path, EnginePort** port) { ThreadManager::assert_thread(THREAD_PROCESS); @@ -346,12 +346,12 @@ JackDriver::remove_port(const Path& path, EnginePort** port) } } - LOG(warn) << "Unable to find port " << path << endl; + LOG(Raul::warn)(Raul::fmt("Unable to find port %1%\n") % path); return NULL; } EnginePort* -JackDriver::port(const Path& path) +JackDriver::port(const Raul::Path& path) { for (Raul::List<JackPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) if ((*i)->patch_port()->path() == path) @@ -377,7 +377,7 @@ JackDriver::create_port(DuplexPort* patch_port) } EnginePort* -JackDriver::engine_port(const Path& path) +JackDriver::engine_port(const Raul::Path& path) { ThreadManager::assert_thread(THREAD_PROCESS); @@ -428,7 +428,7 @@ JackDriver::_process_cb(jack_nframes_t nframes) void JackDriver::_thread_init_cb() { - Raul::Thread* thread = &Thread::get(); + Raul::Thread* thread = &Raul::Thread::get(); thread->set_name("Jack"); thread->set_context(THREAD_PROCESS); _jack_threads.push_back(SharedPtr<Raul::Thread>(thread)); @@ -437,25 +437,13 @@ JackDriver::_thread_init_cb() void JackDriver::_shutdown_cb() { - LOG(info) << "Jack shutdown. Exiting." << endl; + LOG(Raul::info)("Jack shutdown, exiting\n"); _is_activated = false; _jack_threads.clear(); _client = NULL; } int -JackDriver::_sample_rate_cb(jack_nframes_t nframes) -{ - if (_is_activated) { - LOG(error) << "On-the-fly sample rate changing not supported (yet). Aborting." << endl; - exit(EXIT_FAILURE); - } else { - _sample_rate = nframes; - } - return 0; -} - -int JackDriver::_block_length_cb(jack_nframes_t nframes) { if (_engine.root_patch()) { @@ -471,7 +459,7 @@ JackDriver::_block_length_cb(jack_nframes_t nframes) void JackDriver::_session_cb(jack_session_event_t* event) { - LOG(info) << "Jack session save to " << event->session_dir << endl; + LOG(Raul::info)(Raul::fmt("Jack session save to %1%\n") % event->session_dir); const string cmd = (boost::format("ingen -eg -n %1% -u %2% -l ${SESSION_DIR}") % jack_get_client_name(_client) @@ -491,7 +479,7 @@ JackDriver::_session_cb(jack_session_event_t* event) case JackSessionSave: break; case JackSessionSaveAndQuit: - LOG(warn) << "Jack session quit" << endl; + LOG(Raul::warn)("Jack session quit\n"); _engine.quit(); break; case JackSessionSaveTemplate: diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp index 3bc9c037..a2da2034 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -135,9 +135,6 @@ private: inline static int block_length_cb(jack_nframes_t nframes, void* const jack_driver) { return ((JackDriver*)jack_driver)->_block_length_cb(nframes); } - inline static int sample_rate_cb(jack_nframes_t nframes, void* const jack_driver) { - return ((JackDriver*)jack_driver)->_sample_rate_cb(nframes); - } #ifdef INGEN_JACK_SESSION inline static void session_cb(jack_session_event_t* event, void* jack_driver) { ((JackDriver*)jack_driver)->_session_cb(event); @@ -149,7 +146,6 @@ private: void _shutdown_cb(); int _process_cb(jack_nframes_t nframes); int _block_length_cb(jack_nframes_t nframes); - int _sample_rate_cb(jack_nframes_t nframes); #ifdef INGEN_JACK_SESSION void _session_cb(jack_session_event_t* event); #endif diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index a3d8b104..68a771e8 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -40,7 +40,6 @@ #include "ProcessContext.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -89,7 +88,7 @@ LV2Node::prepare_poly(BufferFactory& bufs, uint32_t poly) lilv_instance_free); if (!_prepared_instances->at(i)) { - error << "Failed to instantiate plugin" << endl; + Raul::error << "Failed to instantiate plugin" << endl; return false; } @@ -164,8 +163,8 @@ LV2Node::instantiate(BufferFactory& bufs) lilv_instance_free); if (!instance(i)) { - error << "Failed to instantiate plugin " << _lv2_plugin->uri() - << " voice " << i << endl; + Raul::error << "Failed to instantiate plugin " << _lv2_plugin->uri() + << " voice " << i << endl; return false; } @@ -178,8 +177,8 @@ LV2Node::instantiate(BufferFactory& bufs) lilv_node_free(work_schedule); - string port_name; - Path port_path; + string port_name; + Raul::Path port_path; PortImpl* port = NULL; bool ret = true; @@ -213,9 +212,9 @@ LV2Node::instantiate(BufferFactory& bufs) // LV2 port symbols are guaranteed to be unique, valid C identifiers port_name = lilv_node_as_string(lilv_port_get_symbol(plug, id)); - if (!Symbol::is_valid(port_name)) { - error << "Plugin " << _lv2_plugin->uri() << " port " << j - << " has illegal symbol `" << port_name << "'" << endl; + if (!Raul::Symbol::is_valid(port_name)) { + Raul::error << "Plugin " << _lv2_plugin->uri() << " port " << j + << " has illegal symbol `" << port_name << "'" << endl; ret = false; break; } @@ -288,7 +287,7 @@ LV2Node::instantiate(BufferFactory& bufs) } if (port_type == PortType::UNKNOWN || direction == UNKNOWN) { - warn << "Unknown type or direction for port `" << port_name << "'" << endl; + Raul::warn << "Unknown type or direction for port `" << port_name << "'" << endl; ret = false; break; } diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 0989f881..93e2d1d6 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -29,7 +29,6 @@ #include "NodeImpl.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -54,7 +53,7 @@ LV2Plugin::symbol() const const string symbol = working.substr(last_slash+1); if ( (symbol[0] >= 'a' && symbol[0] <= 'z') || (symbol[0] >= 'A' && symbol[0] <= 'Z') ) - return Path::nameify(symbol); + return Raul::Path::nameify(symbol); else working = working.substr(0, last_slash); } diff --git a/src/server/MessageContext.cpp b/src/server/MessageContext.cpp index ed2c8543..d59452d7 100644 --- a/src/server/MessageContext.cpp +++ b/src/server/MessageContext.cpp @@ -27,7 +27,6 @@ #include "ThreadManager.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp index ea8132d1..231a7db1 100644 --- a/src/server/NodeFactory.cpp +++ b/src/server/NodeFactory.cpp @@ -41,7 +41,6 @@ #include "ThreadManager.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { diff --git a/src/server/ObjectSender.cpp b/src/server/ObjectSender.cpp index 9565bd82..167ffb1f 100644 --- a/src/server/ObjectSender.cpp +++ b/src/server/ObjectSender.cpp @@ -27,7 +27,6 @@ #include "AudioBuffer.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -75,8 +74,8 @@ ObjectSender::send_patch(Interface* client, if (recursive) { // Send nodes - for (List<NodeImpl*>::const_iterator j = patch->nodes().begin(); - j != patch->nodes().end(); ++j) { + for (Raul::List<NodeImpl*>::const_iterator j = patch->nodes().begin(); + j != patch->nodes().end(); ++j) { const NodeImpl* const node = (*j); send_node(client, node, true, false); } @@ -109,7 +108,7 @@ ObjectSender::send_node(Interface* client, const NodeImpl* node, bool recursive, } if (plugin->uri().length() == 0) { - error << "Node " << node->path() << "'s plugin has no URI! Not sending." << endl; + Raul::error << "Node " << node->path() << "'s plugin has no URI! Not sending." << endl; return; } diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp index 912ce9c2..b17d0475 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/PatchImpl.cpp @@ -34,7 +34,6 @@ #include "ThreadManager.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -315,7 +314,7 @@ PatchImpl::remove_connection(const PortImpl* tail, const PortImpl* dst_port) _connections.erase(i); return c; } else { - error << "[PatchImpl::remove_connection] Connection not found" << endl; + Raul::error << "[PatchImpl::remove_connection] Connection not found" << endl; return SharedPtr<ConnectionImpl>(); } } @@ -349,7 +348,7 @@ PatchImpl::create_port(BufferFactory& bufs, bool polyphonic) { if (type == PortType::UNKNOWN) { - error << "[PatchImpl::create_port] Unknown port type " << type.uri() << endl; + Raul::error << "[PatchImpl::create_port] Unknown port type " << type.uri() << endl; return NULL; } @@ -393,7 +392,7 @@ PatchImpl::remove_port(const string& symbol) } if ( ! found) - error << "[PatchImpl::remove_port] Port not found!" << endl; + Raul::error << "[PatchImpl::remove_port] Port not found!" << endl; return ret; } diff --git a/src/server/PluginImpl.cpp b/src/server/PluginImpl.cpp index b8ba9c2b..cec70c06 100644 --- a/src/server/PluginImpl.cpp +++ b/src/server/PluginImpl.cpp @@ -18,7 +18,6 @@ #include "PluginImpl.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -27,7 +26,7 @@ void PluginImpl::load() { if (!_module) { - debug << "Loading plugin library " << _library_path << endl; + Raul::debug << "Loading plugin library " << _library_path << endl; _module = new Glib::Module(_library_path, Glib::MODULE_BIND_LOCAL); if (!(*_module)) delete _module; @@ -38,7 +37,7 @@ void PluginImpl::unload() { if (_module) { - debug << "Unloading plugin library " << _library_path << endl; + Raul::debug << "Unloading plugin library " << _library_path << endl; delete _module; _module = NULL; } diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index a775ab91..1e5cc11c 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -29,7 +29,6 @@ #include "ThreadManager.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { @@ -41,7 +40,7 @@ PortImpl::PortImpl(BufferFactory& bufs, uint32_t poly, PortType type, LV2_URID buffer_type, - const Atom& value, + const Raul::Atom& value, size_t buffer_size) : GraphObjectImpl(bufs.uris(), node, name) , _bufs(bufs) @@ -54,7 +53,7 @@ PortImpl::PortImpl(BufferFactory& bufs, , _min(bufs.forge().make(0.0f)) , _max(bufs.forge().make(1.0f)) , _last_broadcasted_value(value) - , _buffers(new Array<BufferRef>(static_cast<size_t>(poly))) + , _buffers(new Raul::Array<BufferRef>(static_cast<size_t>(poly))) , _prepared_buffers(NULL) , _broadcast(false) , _set_by_user(false) @@ -134,7 +133,7 @@ PortImpl::prepare_poly(BufferFactory& bufs, uint32_t poly) } if (!_prepared_buffers) - _prepared_buffers = new Array<BufferRef>(poly, *_buffers, NULL); + _prepared_buffers = new Raul::Array<BufferRef>(poly, *_buffers, NULL); return true; } @@ -147,7 +146,7 @@ PortImpl::prepare_poly_buffers(BufferFactory& bufs) } bool -PortImpl::apply_poly(Maid& maid, uint32_t poly) +PortImpl::apply_poly(Raul::Maid& maid, uint32_t poly) { ThreadManager::assert_thread(THREAD_PROCESS); if (_type != PortType::CONTROL && diff --git a/src/server/PostProcessor.cpp b/src/server/PostProcessor.cpp index 2ad23254..7a51f5e9 100644 --- a/src/server/PostProcessor.cpp +++ b/src/server/PostProcessor.cpp @@ -27,7 +27,6 @@ #include "ThreadManager.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Server { 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<int32_t>(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<Path, SharedPtr<GraphObject> > > removed + SharedPtr< Raul::Table< Raul::Path, SharedPtr<GraphObject> > > removed = _engine.engine_store()->remove(_store_iterator); assert(removed->size() > 0); - for (Table<Path, SharedPtr<GraphObject> >::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<GraphObject> >::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<GraphObjectImpl>(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<Shared::ResourceImpl*>(_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()); } } diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index 0386b2d2..315ba4e4 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -39,7 +39,6 @@ (f_clamp (delaytime * (float)sample_rate, 1.0f, (float)(buffer_mask + 1))) using namespace std; -using namespace Raul; namespace Ingen { namespace Server { diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 3733a274..f488f898 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -37,7 +37,6 @@ #define LOG(s) s << "[NoteNode] " using namespace std; -using namespace Raul; namespace Ingen { namespace Server { diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 3de1ffc6..2224e39f 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -33,7 +33,6 @@ #define LOG(s) s << "[TriggerNode] " using namespace std; -using namespace Raul; namespace Ingen { namespace Server { diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index b0f095ca..68d7ab08 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -26,7 +26,6 @@ #include "raul/Path.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Shared { diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index 3859ef76..89771b0f 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -23,24 +23,23 @@ #include "ingen/shared/Store.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Shared { -const URI +const Raul::URI ClashAvoider::map_uri(const Raul::URI& in) { - if (Path::is_path(in)) + if (Raul::Path::is_path(in)) return map_path(in.str()); else return in; } -const Path +const Raul::Path ClashAvoider::map_path(const Raul::Path& in) { - debug << "MAP PATH: " << in; + Raul::debug << "MAP PATH: " << in; unsigned offset = 0; bool has_offset = false; @@ -50,31 +49,31 @@ ClashAvoider::map_path(const Raul::Path& in) has_offset = (sscanf(trailing.c_str(), "%u", &offset) > 0); } - debug << "OFFSET: " << offset << endl; + Raul::debug << "OFFSET: " << offset << endl; // Path without _n suffix - Path base_path = in; + Raul::Path base_path = in; if (has_offset) base_path = base_path.substr(0, base_path.find_last_of('_')); - debug << "BASE: " << base_path << endl; + Raul::debug << "BASE: " << base_path << endl; SymbolMap::iterator m = _symbol_map.find(in); if (m != _symbol_map.end()) { - debug << " (1) " << m->second << endl; + Raul::debug << " (1) " << m->second << endl; return m->second; } else { typedef std::pair<SymbolMap::iterator, bool> InsertRecord; // See if parent is mapped - Path parent = in.parent(); + Raul::Path parent = in.parent(); do { - debug << "CHECK: " << parent << endl; + Raul::debug << "CHECK: " << parent << endl; SymbolMap::iterator p = _symbol_map.find(parent); if (p != _symbol_map.end()) { - const Path mapped = p->second.base() + in.substr(parent.base().length()); + const Raul::Path mapped = p->second.base() + in.substr(parent.base().length()); InsertRecord i = _symbol_map.insert(make_pair(in, mapped)); - debug << " (2) " << i.first->second << endl; + Raul::debug << " (2) " << i.first->second << endl; return i.first->second; } parent = parent.parent(); @@ -84,7 +83,7 @@ ClashAvoider::map_path(const Raul::Path& in) if (!exists(in) && _symbol_map.find(in) == _symbol_map.end()) { InsertRecord i = _symbol_map.insert(make_pair(in, in)); assert(i.second); - debug << " (3) " << i.first->second << endl; + Raul::debug << " (3) " << i.first->second << endl; return i.first->second; // Append _2 _3 etc until an unused symbol is found @@ -98,7 +97,7 @@ ClashAvoider::map_path(const Raul::Path& in) parent_str = parent_str.substr(0, parent_str.find_last_of("/")); if (parent_str.empty()) parent_str = "/"; - debug << "PARENT: " << parent_str << endl; + Raul::debug << "PARENT: " << parent_str << endl; } if (offset == 0) @@ -112,13 +111,13 @@ ClashAvoider::map_path(const Raul::Path& in) name = "_"; string str = ss.str(); InsertRecord i = _symbol_map.insert(make_pair(in, str)); - debug << "HIT: offset = " << offset << ", str = " << str << endl; + Raul::debug << "HIT: offset = " << offset << ", str = " << str << endl; offset = _store.child_name_offset(in.parent(), name, false); _offsets.insert(make_pair(base_path, offset)); - debug << " (4) " << i.first->second << endl; + Raul::debug << " (4) " << i.first->second << endl; return i.first->second; } else { - debug << "MISSED OFFSET: " << in << " => " << ss.str() << endl; + Raul::debug << "MISSED OFFSET: " << in << " => " << ss.str() << endl; if (o != _offsets.end()) offset = ++o->second; else diff --git a/src/shared/Configuration.cpp b/src/shared/Configuration.cpp index aecf0e5b..28038466 100644 --- a/src/shared/Configuration.cpp +++ b/src/shared/Configuration.cpp @@ -16,8 +16,6 @@ #include "ingen/shared/Configuration.hpp" -using namespace Raul; - namespace Ingen { namespace Shared { diff --git a/src/shared/Module.cpp b/src/shared/Module.cpp index 8ec733aa..9ef8f0d6 100644 --- a/src/shared/Module.cpp +++ b/src/shared/Module.cpp @@ -26,7 +26,7 @@ namespace Shared { Module::~Module() { - Raul::info << "[Module] Unloading " << library->get_name() << std::endl; + Raul::info("[Module] ")(Raul::fmt("Unloading %1%\n") % library->get_name()); } } // namespace Shared diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 9bf7384e..9d97d5df 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -20,7 +20,6 @@ #include "raul/log.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Shared { @@ -120,9 +119,9 @@ ResourceImpl::type(const URIs& uris, patch = node = port = is_output = false; for (iterator i = types_range.first; i != types_range.second; ++i) { - const Atom& atom = i->second; + const Raul::Atom& atom = i->second; if (atom.type() != uris.forge.URI) { - warn << "[ResourceImpl] Non-URI type " << uris.forge.str(atom) << endl; + Raul::warn << "[ResourceImpl] Non-URI type " << uris.forge.str(atom) << endl; continue; } diff --git a/src/shared/Store.cpp b/src/shared/Store.cpp index c3d427a9..c0d373d6 100644 --- a/src/shared/Store.cpp +++ b/src/shared/Store.cpp @@ -23,7 +23,6 @@ #include "ingen/shared/Store.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Shared { @@ -32,7 +31,7 @@ void Store::add(GraphObject* o) { if (find(o->path()) != end()) { - error << "[Store] Attempt to add duplicate object " << o->path() << endl; + Raul::error << "[Store] Attempt to add duplicate object " << o->path() << endl; return; } diff --git a/src/shared/URIMap.cpp b/src/shared/URIMap.cpp index 144941e9..e8c7fbbc 100644 --- a/src/shared/URIMap.cpp +++ b/src/shared/URIMap.cpp @@ -28,7 +28,6 @@ #include "raul/log.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Shared { diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp index 56189ed5..712a0cb2 100644 --- a/src/shared/URIs.cpp +++ b/src/shared/URIs.cpp @@ -32,7 +32,6 @@ #include "raul/log.hpp" using namespace std; -using namespace Raul; namespace Ingen { namespace Shared { diff --git a/src/shared/World.cpp b/src/shared/World.cpp index 1d47100a..28ad1a34 100644 --- a/src/shared/World.cpp +++ b/src/shared/World.cpp @@ -34,10 +34,9 @@ #include "ingen/shared/URIMap.hpp" #include "ingen/shared/URIs.hpp" -#define LOG(s) s << "[Module] " +#define LOG(s) (s("[World] ")) using namespace std; -using namespace Raul; namespace Ingen { namespace Shared { @@ -66,11 +65,11 @@ ingen_load_module(const string& name) if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY); if (*module) { - LOG(info) << "Loading " << filename << endl; + LOG(Raul::info)(Raul::fmt("Loading %1%\n") % filename); return SharedPtr<Glib::Module>(module); } else { delete module; - error << Glib::Module::get_last_error() << endl; + Raul::error << Glib::Module::get_last_error() << endl; } } } @@ -83,16 +82,16 @@ ingen_load_module(const string& name) module->make_resident(); if (*module) { - LOG(info) << "Loading " << Shared::module_path(name) << endl; + LOG(Raul::info)(Raul::fmt("Loading %1%\n") % Shared::module_path(name)); return SharedPtr<Glib::Module>(module); } else if (!module_path_found) { - LOG(error) << "Unable to find " << name - << " (" << Glib::Module::get_last_error() << ")" << endl; + LOG(Raul::error)(Raul::fmt("Unable to find %1% (%2%)\n") + % name % Glib::Module::get_last_error()); return SharedPtr<Glib::Module>(); } else { - LOG(error) << "Unable to load " << name << " from " << module_path - << " (" << Glib::Module::get_last_error() << ")" << endl; - LOG(error) << "Is Ingen installed?" << endl; + LOG(Raul::error)(Raul::fmt("Unable to load %1% from %2% (%3%)\n") + % name % module_path % Glib::Module::get_last_error()); + LOG(Raul::error)("Is Ingen installed?\n"); return SharedPtr<Glib::Module>(); } } @@ -231,7 +230,7 @@ World::load_module(const char* name) { Pimpl::Modules::iterator i = _impl->modules.find(name); if (i != _impl->modules.end()) { - LOG(info) << "Module `" << name << "' already loaded" << endl; + LOG(Raul::info)(Raul::fmt("Module `%1%' already loaded\n") % name); return true; } SharedPtr<Glib::Module> lib = ingen_load_module(name); @@ -243,7 +242,7 @@ World::load_module(const char* name) _impl->modules.insert(make_pair(string(name), module)); return true; } else { - LOG(error) << "Failed to load module `" << name << "'" << endl; + LOG(Raul::error)(Raul::fmt("Failed to load module `%1%'\n") % name); return false; } } @@ -253,7 +252,7 @@ World::run_module(const char* name) { Pimpl::Modules::iterator i = _impl->modules.find(name); if (i == _impl->modules.end()) { - LOG(error) << "Attempt to run unloaded module `" << name << "'" << endl; + LOG(Raul::error) << "Attempt to run unloaded module `" << name << "'" << endl; return false; } @@ -278,7 +277,7 @@ World::interface(const std::string& engine_url, const string scheme = engine_url.substr(0, engine_url.find(":")); const Pimpl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme); if (i == _impl->interface_factories.end()) { - warn << "Unknown URI scheme `" << scheme << "'" << endl; + Raul::warn << "Unknown URI scheme `" << scheme << "'" << endl; return SharedPtr<Interface>(); } @@ -291,7 +290,7 @@ World::run(const std::string& mime_type, const std::string& filename) { const Pimpl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type); if (i == _impl->script_runners.end()) { - warn << "Unknown script MIME type `" << mime_type << "'" << endl; + Raul::warn << "Unknown script MIME type `" << mime_type << "'" << endl; return false; } diff --git a/src/shared/runtime_paths.cpp b/src/shared/runtime_paths.cpp index 9a5b4cdf..48b670bc 100644 --- a/src/shared/runtime_paths.cpp +++ b/src/shared/runtime_paths.cpp @@ -52,7 +52,7 @@ set_bundle_path_from_code(void* function) const char* bin_loc = dli.dli_fname; #endif - Raul::info << "[Module] Binary location: " << bin_loc << std::endl; + Raul::info(Raul::fmt("Binary location: %1%\n") % bin_loc); string bundle = bin_loc; bundle = bundle.substr(0, bundle.find_last_of(G_DIR_SEPARATOR)); diff --git a/src/socket/Socket.cpp b/src/socket/Socket.cpp index daeb6fa2..9c2a050c 100644 --- a/src/socket/Socket.cpp +++ b/src/socket/Socket.cpp @@ -29,7 +29,7 @@ #include "Socket.hpp" -#define LOG(s) s << "[Socket] " +#define LOG(s) (s("[Socket] ")) namespace Ingen { namespace Socket { @@ -96,8 +96,8 @@ Socket::set_addr(const std::string& uri) struct addrinfo* ainfo; int st = 0; if ((st = getaddrinfo(host.c_str(), port.c_str(), NULL, &ainfo))) { - LOG(Raul::error) << "Error in getaddrinfo: " - << gai_strerror(st) << std::endl; + LOG(Raul::error)(Raul::fmt("Error in getaddrinfo: %1%\n") + % gai_strerror(st)); return false; } @@ -117,8 +117,8 @@ Socket::bind(const std::string& uri) return true; } - LOG(Raul::error) << "Failed to bind " << _uri - << ": " << strerror(errno) << std::endl; + LOG(Raul::error)(Raul::fmt("Failed to bind <%1%> (%2%)\n") + % _uri % strerror(errno)); return false; } @@ -129,8 +129,8 @@ Socket::connect(const std::string& uri) return true; } - LOG(Raul::error) << "Failed to connect " << _uri - << ": " << strerror(errno) << std::endl; + LOG(Raul::error)(Raul::fmt("Failed to connect <%1%> (%2%)\n") + % _uri % strerror(errno)); return false; } @@ -138,10 +138,10 @@ bool Socket::listen() { if (::listen(_sock, 64) == -1) { - LOG(Raul::error) << "Failed to listen on " << _uri << std::endl; + LOG(Raul::error)(Raul::fmt("Failed to listen on %1%\n") % _uri); return false; } else { - LOG(Raul::info) << "Listening on " << _uri << std::endl; + LOG(Raul::info)(Raul::fmt("Listening on %1%\n") % _uri); return true; } } @@ -155,8 +155,8 @@ Socket::accept() int conn = ::accept(_sock, client_addr, &client_addr_len); if (conn == -1) { - LOG(Raul::error) << "Error accepting connection: " - << strerror(errno) << std::endl; + LOG(Raul::error)(Raul::fmt("Error accepting connection: %1%\n") + % strerror(errno)); return SharedPtr<Socket>(); } |