summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-10-11 21:50:38 +0000
committerDavid Robillard <d@drobilla.net>2008-10-11 21:50:38 +0000
commitfa9837f95a2d3be3f5eb94fcbf8222bb208d87db (patch)
tree2eb8c8eb5a0cf1b27f34ddb141651743b66a2b1e /src/client
parenta18022d4243de7b2093507c574689c7a17c82bb9 (diff)
downloadingen-fa9837f95a2d3be3f5eb94fcbf8222bb208d87db.tar.gz
ingen-fa9837f95a2d3be3f5eb94fcbf8222bb208d87db.tar.bz2
ingen-fa9837f95a2d3be3f5eb94fcbf8222bb208d87db.zip
Remove duplicated code for getting various hints, add generic hint accessor.
Cleanup namespace pollution. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1650 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/NodeModel.hpp16
-rw-r--r--src/client/PatchModel.hpp2
-rw-r--r--src/client/PortModel.cpp22
-rw-r--r--src/client/PortModel.hpp11
4 files changed, 14 insertions, 37 deletions
diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp
index 9b6efde8..b7bbb5af 100644
--- a/src/client/NodeModel.hpp
+++ b/src/client/NodeModel.hpp
@@ -22,7 +22,6 @@
#include <iostream>
#include <string>
#include <sigc++/sigc++.h>
-#include <raul/Table.hpp>
#include <raul/Path.hpp>
#include <raul/SharedPtr.hpp>
#include "interface/Node.hpp"
@@ -31,9 +30,6 @@
#include "PortModel.hpp"
#include "PluginModel.hpp"
-using std::string;
-using Raul::Table;
-
namespace Ingen {
namespace Client {
@@ -51,13 +47,13 @@ public:
NodeModel(const NodeModel& copy);
virtual ~NodeModel();
- typedef vector<SharedPtr<PortModel> > Ports;
+ typedef std::vector< SharedPtr<PortModel> > Ports;
- SharedPtr<PortModel> get_port(const string& port_name) const;
+ SharedPtr<PortModel> get_port(const std::string& port_name) const;
Shared::Port* port(uint32_t index) const;
- const string& plugin_uri() const { return _plugin_uri; }
+ const std::string& plugin_uri() const { return _plugin_uri; }
const Shared::Plugin* plugin() const { return _plugin.get(); }
uint32_t num_ports() const { return _ports.size(); }
const Ports& ports() const { return _ports; }
@@ -71,7 +67,7 @@ public:
protected:
friend class ClientStore;
- NodeModel(const string& plugin_uri, const Path& path);
+ NodeModel(const std::string& plugin_uri, const Path& path);
NodeModel(SharedPtr<PluginModel> plugin, const Path& path);
NodeModel(const Path& path);
@@ -80,14 +76,14 @@ protected:
void add_port(SharedPtr<PortModel> pm);
void remove_port(SharedPtr<PortModel> pm);
void remove_port(const Path& port_path);
- void add_program(int bank, int program, const string& name);
+ void add_program(int bank, int program, const std::string& name);
void remove_program(int bank, int program);
void set(SharedPtr<ObjectModel> model);
virtual void clear();
Ports _ports; ///< Vector of ports (not a Table to preserve order)
- string _plugin_uri; ///< Plugin URI (if PluginModel is unknown)
+ std::string _plugin_uri; ///< Plugin URI (if PluginModel is unknown)
SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of
private:
diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp
index 70c8df0e..ac1e2ac0 100644
--- a/src/client/PatchModel.hpp
+++ b/src/client/PatchModel.hpp
@@ -96,7 +96,7 @@ private:
bool _editable;
};
-typedef Table<string, SharedPtr<PatchModel> > PatchModelMap;
+typedef Raul::Table<string, SharedPtr<PatchModel> > PatchModelMap;
} // namespace Client
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index c18378db..af257ebf 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -21,30 +21,12 @@
namespace Ingen {
namespace Client {
-
-bool
-PortModel::is_logarithmic() const
-{
- const Atom& hint = get_variable("ingen:logarithmic");
- return (hint.is_valid() && hint.get_bool() > 0);
-}
-
-
bool
-PortModel::is_integer() const
+PortModel::has_hint(const std::string& qname) const
{
- const Atom& hint = get_variable("ingen:integer");
+ const Atom& hint = get_variable(qname);
return (hint.is_valid() && hint.get_bool() > 0);
}
-
-
-bool
-PortModel::is_toggle() const
-{
- const Atom& hint = get_variable("ingen:toggled");
- return (hint.is_valid() && hint.get_bool() > 0);
-}
-
void
PortModel::set(SharedPtr<ObjectModel> model)
diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp
index a7f52679..cf0d7ddc 100644
--- a/src/client/PortModel.hpp
+++ b/src/client/PortModel.hpp
@@ -21,15 +21,12 @@
#include <cstdlib>
#include <iostream>
#include <string>
-#include <vector>
#include <sigc++/sigc++.h>
#include <raul/SharedPtr.hpp>
#include <raul/Path.hpp>
#include "interface/Port.hpp"
#include "ObjectModel.hpp"
-using std::string; using std::vector;
-
namespace Ingen {
namespace Client {
@@ -50,9 +47,11 @@ public:
inline bool is_input() const { return (_direction == INPUT); }
inline bool is_output() const { return (_direction == OUTPUT); }
- bool is_logarithmic() const;
- bool is_integer() const;
- bool is_toggle() const;
+ bool has_hint(const std::string& qname) const;
+
+ bool is_logarithmic() const { return has_hint("ingen:logarithmic"); }
+ bool is_integer() const { return has_hint("ingen:integer"); }
+ bool is_toggle() const { return has_hint("ingen:toggled"); }
inline bool operator==(const PortModel& pm) const { return (_path == pm._path); }