From a42744e1068a8630d8034df73bb344ca21a53b32 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 16 Aug 2012 13:19:39 +0000 Subject: Remove all 'using namespace Raul'. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4715 a436a847-0d15-0410-975c-d299462d15a1 --- src/serialisation/Parser.cpp | 82 ++++++++++++++++++++-------------------- src/serialisation/Serialiser.cpp | 17 ++++----- 2 files changed, 49 insertions(+), 50 deletions(-) (limited to 'src/serialisation') diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index a32fa9fd..6a34a04b 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -42,7 +42,6 @@ #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" using namespace std; -using namespace Raul; typedef set RDFNodes; @@ -118,7 +117,7 @@ get_properties(Ingen::World* world, sratom_read(sratom, &forge, world->rdf_world()->c_obj(), model.c_obj(), i.get_object().c_obj()); const LV2_Atom* atom = (const LV2_Atom*)out.buf; - Atom atomm; + Raul::Atom atomm; // FIXME: Don't bloat out all URIs if (atom->type == forge.URID) { atomm = world->forge().alloc_uri( @@ -137,7 +136,7 @@ get_properties(Ingen::World* world, return props; } -typedef std::pair PortRecord; +typedef std::pair PortRecord; static boost::optional get_port(Ingen::World* world, @@ -156,7 +155,7 @@ 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 index" << endl; + LOG(Raul::error) << "Port " << subject << " has no valid index" << endl; return boost::optional(); } index = i->second.get_int32(); @@ -164,11 +163,11 @@ get_port(Ingen::World* world, // Get symbol Resource::Properties::const_iterator s = props.find(uris.lv2_symbol); if (s == props.end()) { - LOG(error) << "Port " << subject << " has no symbol" << endl; + LOG(Raul::error) << "Port " << subject << " has no symbol" << endl; return boost::optional(); } - const Symbol port_sym(s->second.get_string()); - const Path port_path = parent.child(port_sym); + const Raul::Symbol port_sym(s->second.get_string()); + const Raul::Path port_path = parent.child(port_sym); return make_pair(port_path, props); } @@ -220,7 +219,7 @@ parse_edges( const Sord::Node& subject, const Raul::Path& patch); -static boost::optional +static boost::optional parse_node(Ingen::World* world, Ingen::Interface* target, Sord::Model& model, @@ -235,8 +234,8 @@ parse_node(Ingen::World* world, Sord::Iter i = model.find(subject, ingen_prototype, nil); if (i.end() || i.get_object().type() != Sord::Node::URI) { - LOG(error) << "Node missing mandatory ingen:prototype" << endl; - return boost::optional(); + LOG(Raul::error) << "Node missing mandatory ingen:prototype" << endl; + return boost::optional(); } const std::string type_uri = relative_uri( @@ -283,7 +282,7 @@ parse_node(Ingen::World* world, return path; } -static boost::optional +static boost::optional parse_patch(Ingen::World* world, Ingen::Interface* target, Sord::Model& model, @@ -312,20 +311,20 @@ parse_patch(Ingen::World* world, if (parent && a_symbol) patch_path_str = parent->child(*a_symbol); - if (!Path::is_valid(patch_path_str)) { - LOG(error) << "Patch has invalid path: " << patch_path_str << endl; + if (!Raul::Path::is_valid(patch_path_str)) { + LOG(Raul::error) << "Patch has invalid path: " << patch_path_str << endl; return boost::optional(); } // Create patch - Path patch_path(patch_path_str); + Raul::Path patch_path(patch_path_str); Resource::Properties props = get_properties(world, model, subject_node); target->put(GraphObject::path_to_uri(patch_path), props); // For each node in this patch for (Sord::Iter n = model.find(subject_node, ingen_node, nil); !n.end(); ++n) { - Sord::Node node = n.get_object(); - const Path node_path = patch_path.child( + Sord::Node node = n.get_object(); + const Raul::Path node_path = patch_path.child( Raul::Symbol(get_basename(node.to_string()))); // Parse and create node @@ -341,8 +340,8 @@ parse_patch(Ingen::World* world, boost::optional port_record = get_port( world, model, port, node_path, index); if (!port_record) { - LOG(error) << "Invalid port " << port << endl; - return boost::optional(); + LOG(Raul::error) << "Invalid port " << port << endl; + return boost::optional(); } // Create port and/or set all port properties @@ -363,7 +362,7 @@ parse_patch(Ingen::World* world, world, model, port, patch_path, index); if (!port_record) { LOG(Raul::error) << "Invalid port " << port << endl; - return boost::optional(); + return boost::optional(); } // Store port information in ports map @@ -398,36 +397,36 @@ parse_edge(Ingen::World* world, const Glib::ustring& base_uri = model.base_uri().to_string(); if (t.end()) { - LOG(error) << "Edge has no tail" << endl; + LOG(Raul::error) << "Edge has no tail" << endl; return false; } else if (h.end()) { - LOG(error) << "Edge has no head" << endl; + LOG(Raul::error) << "Edge has no head" << endl; return false; } const std::string tail_str = relative_uri( base_uri, t.get_object().to_string(), true); - if (!Path::is_valid(tail_str)) { - LOG(error) << "Edge tail has invalid URI" << endl; + if (!Raul::Path::is_valid(tail_str)) { + LOG(Raul::error) << "Edge tail has invalid URI" << endl; return false; } const std::string head_str = relative_uri( base_uri, h.get_object().to_string(), true); - if (!Path::is_valid(head_str)) { - LOG(error) << "Edge head has invalid URI" << endl; + if (!Raul::Path::is_valid(head_str)) { + LOG(Raul::error) << "Edge head has invalid URI" << endl; return false; } if (!(++t).end()) { - LOG(error) << "Edge has multiple tails" << endl; + LOG(Raul::error) << "Edge has multiple tails" << endl; return false; } else if (!(++h).end()) { - LOG(error) << "Edge has multiple heads" << endl; + LOG(Raul::error) << "Edge has multiple heads" << endl; return false; } - target->connect(Path(tail_str), Path(head_str)); + target->connect(Raul::Path(tail_str), Raul::Path(head_str)); return true; } @@ -468,7 +467,7 @@ parse_properties(Ingen::World* world, return true; } -static boost::optional +static boost::optional parse(Ingen::World* world, Ingen::Interface* target, Sord::Model& model, @@ -515,7 +514,7 @@ parse(Ingen::World* world, for (Subjects::const_iterator i = subjects.begin(); i != subjects.end(); ++i) { const Sord::Node& s = i->first; const std::set& types = i->second; - boost::optional ret; + boost::optional ret; const Raul::Path path( relative_uri( model.base_uri().to_string(), s.to_string(), true)); if (types.find(patch_class) != types.end()) { @@ -528,24 +527,24 @@ parse(Ingen::World* world, world, target, model, s, GraphObject::path_to_uri(path), data); ret = path; } else if (types.find(edge_class) != types.end()) { - Path parent_path(parent ? parent.get() : Path("/")); + Raul::Path parent_path(parent ? parent.get() : Raul::Path("/")); parse_edge(world, target, model, s, parent_path); } else { - LOG(error) << "Subject has no known types" << endl; + LOG(Raul::error) << "Subject has no known types" << endl; } if (!ret) { - LOG(error) << "Failed to parse " << path << endl; - LOG(error) << "Types:" << endl; + LOG(Raul::error) << "Failed to parse " << path << endl; + LOG(Raul::error) << "Types:" << endl; for (std::set::const_iterator t = types.begin(); t != types.end(); ++t) { - LOG(error) << " :: " << *t << endl; + LOG(Raul::error) << " :: " << *t << endl; assert((*t).is_uri()); } } } - return boost::optional(); + return boost::optional(); } /** Parse a patch from RDF into a Interface (engine or client). @@ -572,7 +571,7 @@ Parser::parse_file(Ingen::World* world, try { uri = Glib::filename_to_uri(path, ""); } catch (const Glib::ConvertError& e) { - LOG(error) << "Path to URI conversion error: " << e.what() << endl; + LOG(Raul::error) << "Path to URI conversion error: " << e.what() << endl; return false; } @@ -593,7 +592,7 @@ Parser::parse_file(Ingen::World* world, LOG(Raul::info)(Raul::fmt("Symbol: %1%\n") % symbol->c_str()); Sord::Node subject(*world->rdf_world(), Sord::Node::URI, uri); - boost::optional parsed_path + boost::optional parsed_path = parse(world, target, model, path, subject, parent, symbol, data); if (parsed_path) { @@ -625,9 +624,10 @@ Parser::parse_string(Ingen::World* world, serd_env_free(env); LOG(Raul::info) << "Parsing string"; - if (!base_uri.empty()) - info << " (base " << base_uri << ")"; - info << endl; + if (!base_uri.empty()) { + Raul::info << " (base " << base_uri << ")"; + } + Raul::info << endl; Sord::Node subject; return parse(world, target, model, base_uri, subject, parent, symbol, data); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index cff178d6..c8ee42c0 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -46,7 +46,6 @@ #define LOG(s) s << "[Serialiser] " using namespace std; -using namespace Raul; using namespace Sord; using namespace Ingen; @@ -187,7 +186,7 @@ Serialiser::Impl::write_bundle(SharedPtr patch, const string root_file = Glib::build_filename(path, symbol + ".ttl"); start_to_filename(root_file); - const Path old_root_path = _root_path; + const Raul::Path old_root_path = _root_path; _root_path = patch->path(); serialise_patch(patch, Sord::URI(_model->world(), root_file, _base_uri)); _root_path = old_root_path; @@ -255,8 +254,8 @@ Serialiser::Impl::finish() if (_mode == TO_FILE) { SerdStatus st = _model->write_to_file(_base_uri, SERD_TURTLE); if (st) { - LOG(error) << "Error writing file `" << _base_uri << "' (" - << serd_strerror(st) << ")" << std::endl; + LOG(Raul::error) << "Error writing file `" << _base_uri << "' (" + << serd_strerror(st) << ")" << std::endl; } } else { ret = _model->write_to_string(_base_uri, SERD_TURTLE); @@ -270,7 +269,7 @@ Serialiser::Impl::finish() } Sord::Node -Serialiser::Impl::path_rdf_node(const Path& path) +Serialiser::Impl::path_rdf_node(const Raul::Path& path) { assert(_model); assert(path == _root_path || path.is_child_of(_root_path)); @@ -296,8 +295,8 @@ Serialiser::serialise(SharedPtr object) throw (std::logic_err Resource::DEFAULT, me->path_rdf_node(object->path())); } else { - LOG(warn) << "Unsupported object type, " - << object->path() << " not serialised." << endl; + LOG(Raul::warn) << "Unsupported object type, " + << object->path() << " not serialised." << endl; } } @@ -331,10 +330,10 @@ Serialiser::Impl::serialise_patch(SharedPtr patch, GraphObject::Properties::const_iterator s = patch->properties().find(uris.lv2_symbol); if (s == patch->properties().end() || !s->second.type() == _world.forge().String - || !Symbol::is_valid(s->second.get_string())) { + || !Raul::Symbol::is_valid(s->second.get_string())) { const std::string base = Glib::path_get_basename( _model->base_uri().to_c_string()); - symbol = Symbol::symbolify(base.substr(0, base.find('.'))); + symbol = Raul::Symbol::symbolify(base.substr(0, base.find('.'))); _model->add_statement( patch_id, Sord::Curie(world, "lv2:symbol"), -- cgit v1.2.1