From f936a6da1f4885db54365d81ee5959e84d359e85 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Thu, 28 Apr 2011 06:02:12 +0000
Subject: More future-proof collection APIs.

Make all iterator actions occur through a collection specific function.
Verbose, and a low of API, but allows for the possibility of different
collection implementation types (given a choice between verbosity and no type
safety, I'll take verbosity).


git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3211 a436a847-0d15-0410-975c-d299462d15a1
---
 src/client/PluginModel.cpp |  2 +-
 src/client/PluginUI.cpp    |  2 +-
 src/gui/NodeMenu.cpp       |  4 ++--
 src/gui/PatchCanvas.cpp    |  2 +-
 src/server/LV2Node.cpp     | 10 +++++-----
 src/server/NodeFactory.cpp |  2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

(limited to 'src')

diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index a18eb0fe..77b3e4c9 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -103,7 +103,7 @@ PluginModel::get_property(const URI& key) const
 		SLV2Value  lv2_pred = slv2_value_new_uri(_slv2_world, key.str().c_str());
 		SLV2Values values   = slv2_plugin_get_value(_slv2_plugin, lv2_pred);
 		slv2_value_free(lv2_pred);
-		SLV2_FOREACH(i, values) {
+		SLV2_FOREACH(values, i, values) {
 			SLV2Value val = slv2_values_get(values, i);
 			if (slv2_value_is_uri(val)) {
 				ret = set_property(key, Atom(Atom::URI, slv2_value_as_uri(val)));
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 2df77156..f8232426 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -130,7 +130,7 @@ PluginUI::create(Ingen::Shared::World* world,
 	SLV2UIs      uis      = slv2_plugin_get_uis(plugin);
 	SLV2UI       ui       = NULL;
 	SLV2Value    ui_type  = NULL;
-	SLV2_FOREACH(u, uis) {
+	SLV2_FOREACH(uis, u, uis) {
 		SLV2UI this_ui = slv2_uis_get(uis, u);
 		if (slv2_ui_is_supported(this_ui,
 		                         suil_ui_supported,
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index 3a683027..e89f0d41 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -97,7 +97,7 @@ NodeMenu::init(SharedPtr<NodeModel> node)
 		if (presets) {
 			_presets_menu = Gtk::manage(new Gtk::Menu());
 
-			SLV2_FOREACH(i, presets) {
+			SLV2_FOREACH(values, i, presets) {
 				SLV2Value  uri    = slv2_values_get(presets, i);
 				SLV2Values titles = slv2_plugin_get_value_for_subject(
 					plugin->slv2_plugin(), uri, title_pred);
@@ -197,7 +197,7 @@ NodeMenu::on_preset_activated(const std::string& uri)
 		subject,
 		port_pred);
 	App::instance().engine()->bundle_begin();
-	SLV2_FOREACH(i, ports) {
+	SLV2_FOREACH(values, i, ports) {
 		SLV2Value  uri    = slv2_values_get(ports, i);
 		SLV2Values values = slv2_plugin_get_value_for_subject(
 			plugin->slv2_plugin(), uri, value_pred);
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 334b7035..9ff0ba31 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -263,7 +263,7 @@ PatchCanvas::build_plugin_menu()
 	SLV2PluginClasses classes    = slv2_world_get_plugin_classes(PluginModel::slv2_world());
 
 	LV2Children children;
-	SLV2_FOREACH(i, classes) {
+	SLV2_FOREACH(plugin_classes, i, classes) {
 		SLV2PluginClass c = slv2_plugin_classes_get(classes, i);
 		SLV2Value       p = slv2_plugin_class_get_parent_uri(c);
 		if (!p)
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp
index 26f1e918..48d00a6d 100644
--- a/src/server/LV2Node.cpp
+++ b/src/server/LV2Node.cpp
@@ -243,7 +243,7 @@ LV2Node::instantiate(BufferFactory& bufs)
 		if (data_type == PortType::VALUE || data_type == PortType::MESSAGE) {
 			// Get default value, and its length
 			SLV2Values defaults = slv2_port_get_value(plug, id, default_pred);
-			SLV2_FOREACH(i, defaults) {
+			SLV2_FOREACH(values, i, defaults) {
 				SLV2Value d = slv2_values_get(defaults, i);
 				if (slv2_value_is_string(d)) {
 					const char*  str_val     = slv2_value_as_string(d);
@@ -255,7 +255,7 @@ LV2Node::instantiate(BufferFactory& bufs)
 
 			// Get minimum size, if set in data
 			SLV2Values sizes = slv2_port_get_value(plug, id, min_size_pred);
-			SLV2_FOREACH(i, sizes) {
+			SLV2_FOREACH(values, i, sizes) {
 				SLV2Value d = slv2_values_get(sizes, i);
 				if (slv2_value_is_int(d)) {
 					size_t size_val = slv2_value_as_int(d);
@@ -297,7 +297,7 @@ LV2Node::instantiate(BufferFactory& bufs)
 
 		// Set lv2:portProperty properties
 		SLV2Values properties = slv2_port_get_value(plug, id, port_property_pred);
-		SLV2_FOREACH(i, properties) {
+		SLV2_FOREACH(values, i, properties) {
 			SLV2Value p = slv2_values_get(properties, i);
 			if (slv2_value_is_uri(p)) {
 				port->set_property(uris.lv2_portProperty, Raul::URI(slv2_value_as_uri(p)));
@@ -306,7 +306,7 @@ LV2Node::instantiate(BufferFactory& bufs)
 
 		// Set atom:supports properties
 		SLV2Values types = slv2_port_get_value(plug, id, supports_pred);
-		SLV2_FOREACH(i, types) {
+		SLV2_FOREACH(values, i, types) {
 			SLV2Value type = slv2_values_get(types, i);
 			if (slv2_value_is_uri(type)) {
 				port->add_property(uris.atom_supports, Raul::URI(slv2_value_as_uri(type)));
@@ -314,7 +314,7 @@ LV2Node::instantiate(BufferFactory& bufs)
 		}
 
 		SLV2Values contexts = slv2_port_get_value(plug, id, context_pred);
-		SLV2_FOREACH(i, contexts) {
+		SLV2_FOREACH(values, i, contexts) {
 			SLV2Value c = slv2_values_get(contexts, i);
 			const char* context = slv2_value_as_string(c);
 			if (!strcmp(LV2_CONTEXTS_URI "#MessageContext", context)) {
diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp
index 9c6fc47c..8b336ad2 100644
--- a/src/server/NodeFactory.cpp
+++ b/src/server/NodeFactory.cpp
@@ -129,7 +129,7 @@ NodeFactory::load_lv2_plugins()
 {
 	SLV2Plugins plugins = slv2_world_get_all_plugins(_world->slv2_world());
 
-	SLV2_FOREACH(i, plugins) {
+	SLV2_FOREACH(plugins, i, plugins) {
 		SLV2Plugin lv2_plug = slv2_plugins_get(plugins, i);
 
 		const string uri(slv2_value_as_uri(slv2_plugin_get_uri(lv2_plug)));
-- 
cgit v1.2.1