summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/.clang-tidy3
-rw-r--r--src/client/BlockModel.cpp15
-rw-r--r--src/client/ClientStore.cpp46
-rw-r--r--src/client/GraphModel.cpp27
-rw-r--r--src/client/ObjectModel.cpp6
-rw-r--r--src/client/PluginModel.cpp36
-rw-r--r--src/client/PluginUI.cpp10
-rw-r--r--src/client/ingen_client.cpp2
-rw-r--r--src/client/meson.build50
-rw-r--r--src/client/wscript24
10 files changed, 124 insertions, 95 deletions
diff --git a/src/client/.clang-tidy b/src/client/.clang-tidy
new file mode 100644
index 00000000..2561514f
--- /dev/null
+++ b/src/client/.clang-tidy
@@ -0,0 +1,3 @@
+Checks: >
+ -google-readability-todo,
+InheritParentConfig: true
diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp
index cdfb3fcd..aa4ef663 100644
--- a/src/client/BlockModel.cpp
+++ b/src/client/BlockModel.cpp
@@ -26,7 +26,6 @@
#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
-#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdlib>
@@ -47,8 +46,7 @@ BlockModel::BlockModel(URIs& uris,
, _num_values(0)
, _min_values(nullptr)
, _max_values(nullptr)
-{
-}
+{}
BlockModel::BlockModel(URIs& uris, URI plugin_uri, const raul::Path& path)
: ObjectModel(uris, path)
@@ -56,8 +54,7 @@ BlockModel::BlockModel(URIs& uris, URI plugin_uri, const raul::Path& path)
, _num_values(0)
, _min_values(nullptr)
, _max_values(nullptr)
-{
-}
+{}
BlockModel::BlockModel(const BlockModel& copy)
: ObjectModel(copy)
@@ -247,11 +244,13 @@ BlockModel::label() const
const Atom& name_property = get_property(_uris.lv2_name);
if (name_property.type() == _uris.forge.String) {
return name_property.ptr<char>();
- } else if (plugin_model()) {
+ }
+
+ if (plugin_model()) {
return plugin_model()->human_name();
- } else {
- return symbol().c_str();
}
+
+ return symbol().c_str();
}
std::string
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index d8238c8a..80143265 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -103,7 +103,7 @@ std::shared_ptr<ObjectModel>
ClientStore::remove_object(const raul::Path& path)
{
// Find the object, the "top" of the tree to remove
- const iterator top = find(path);
+ const auto top = find(path);
if (top == end()) {
return nullptr;
}
@@ -142,7 +142,7 @@ ClientStore::remove_object(const raul::Path& path)
std::shared_ptr<PluginModel>
ClientStore::_plugin(const URI& uri)
{
- const Plugins::iterator i = _plugins->find(uri);
+ const auto i = _plugins->find(uri);
return (i == _plugins->end()) ? std::shared_ptr<PluginModel>() : (*i).second;
}
@@ -152,7 +152,7 @@ ClientStore::_plugin(const Atom& uri)
/* FIXME: Should probably be stored with URIs rather than strings, to make
this a fast case. */
- const Plugins::iterator i = _plugins->find(URI(_uris.forge.str(uri, false)));
+ const auto i = _plugins->find(URI(_uris.forge.str(uri, false)));
return (i == _plugins->end()) ? std::shared_ptr<PluginModel>() : (*i).second;
}
@@ -165,15 +165,15 @@ ClientStore::plugin(const URI& uri) const
std::shared_ptr<ObjectModel>
ClientStore::_object(const raul::Path& path)
{
- const iterator i = find(path);
+ const auto i = find(path);
if (i == end()) {
return nullptr;
- } else {
- auto model = std::dynamic_pointer_cast<ObjectModel>(i->second);
- assert(model);
- assert(model->path().is_root() || model->parent());
- return model;
}
+
+ auto model = std::dynamic_pointer_cast<ObjectModel>(i->second);
+ assert(model);
+ assert(model->path().is_root() || model->parent());
+ return model;
}
std::shared_ptr<const ObjectModel>
@@ -187,9 +187,9 @@ ClientStore::_resource(const URI& uri)
{
if (uri_is_path(uri)) {
return _object(uri_to_path(uri));
- } else {
- return _plugin(uri);
}
+
+ return _plugin(uri);
}
std::shared_ptr<const Resource>
@@ -235,7 +235,7 @@ ClientStore::operator()(const Copy&)
void
ClientStore::operator()(const Move& msg)
{
- const iterator top = find(msg.old_path);
+ const auto top = find(msg.old_path);
if (top != end()) {
rename(top, msg.new_path);
}
@@ -250,8 +250,6 @@ ClientStore::message(const Message& msg)
void
ClientStore::operator()(const Put& msg)
{
- using Iterator = Properties::const_iterator;
-
const auto& uri = msg.uri;
const auto& properties = msg.properties;
@@ -263,12 +261,12 @@ ClientStore::operator()(const Put& msg)
is_graph, is_block, is_port, is_output);
// Check for specially handled types
- const Iterator t = properties.find(_uris.rdf_type);
+ const auto t = properties.find(_uris.rdf_type);
if (t != properties.end()) {
const Atom& type(t->second);
if (_uris.pset_Preset == type) {
- const Iterator p = properties.find(_uris.lv2_appliesTo);
- const Iterator l = properties.find(_uris.rdfs_label);
+ const auto p = properties.find(_uris.lv2_appliesTo);
+ const auto l = properties.find(_uris.rdfs_label);
std::shared_ptr<PluginModel> plug;
if (p == properties.end()) {
_log.error("Preset <%1%> with no plugin\n", uri.c_str());
@@ -283,7 +281,9 @@ ClientStore::operator()(const Put& msg)
plug->add_preset(uri, l->second.ptr<char>());
}
return;
- } else if (_uris.ingen_Graph == type) {
+ }
+
+ if (_uris.ingen_Graph == type) {
is_graph = true;
} else if (_uris.ingen_Internal == type || _uris.lv2_Plugin == type) {
std::shared_ptr<PluginModel> p(new PluginModel(uris(), uri, type, properties));
@@ -341,8 +341,8 @@ ClientStore::operator()(const Put& msg)
PortModel::Direction pdir = (is_output)
? PortModel::Direction::OUTPUT
: PortModel::Direction::INPUT;
- uint32_t index = 0;
- const Iterator i = properties.find(_uris.lv2_index);
+ uint32_t index = 0;
+ const auto i = properties.find(_uris.lv2_index);
if (i != properties.end() && i->second.type() == _uris.forge.Int) {
index = i->second.get<int32_t>();
}
@@ -454,10 +454,10 @@ ClientStore::attempt_connection(const raul::Path& tail_path,
std::shared_ptr<ArcModel> arc(new ArcModel(tail, head));
graph->add_arc(arc);
return true;
- } else {
- _log.warn("Failed to connect %1% => %2%\n", tail_path, head_path);
- return false;
}
+
+ _log.warn("Failed to connect %1% => %2%\n", tail_path, head_path);
+ return false;
}
void
diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp
index d4104742..a8a40ec7 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -75,7 +75,7 @@ GraphModel::remove_arcs_on(const std::shared_ptr<PortModel>& p)
{
// Remove any connections which referred to this object,
// since they can't possibly exist anymore
- for (auto j = _arcs.begin(); j != _arcs.end();) {
+ for (auto j = _graph_arcs.begin(); j != _graph_arcs.end();) {
auto next = j;
++next;
@@ -85,7 +85,7 @@ GraphModel::remove_arcs_on(const std::shared_ptr<PortModel>& p)
|| arc->head_path().parent() == p->path()
|| arc->head_path() == p->path()) {
_signal_removed_arc.emit(arc);
- _arcs.erase(j); // Cuts our reference
+ _graph_arcs.erase(j); // Cuts our reference
}
j = next;
}
@@ -94,23 +94,23 @@ GraphModel::remove_arcs_on(const std::shared_ptr<PortModel>& p)
void
GraphModel::clear()
{
- _arcs.clear();
+ _graph_arcs.clear();
BlockModel::clear();
- assert(_arcs.empty());
+ assert(_graph_arcs.empty());
assert(_ports.empty());
}
std::shared_ptr<ArcModel>
GraphModel::get_arc(const Node* tail, const Node* head)
{
- auto i = _arcs.find(std::make_pair(tail, head));
- if (i != _arcs.end()) {
+ auto i = _graph_arcs.find(std::make_pair(tail, head));
+ if (i != _graph_arcs.end()) {
return std::dynamic_pointer_cast<ArcModel>(i->second);
- } else {
- return nullptr;
}
+
+ return nullptr;
}
/** Add a connection to this graph.
@@ -142,8 +142,9 @@ GraphModel::add_arc(const std::shared_ptr<ArcModel>& arc)
assert(arc->tail() == existing->tail());
assert(arc->head() == existing->head());
} else {
- _arcs.emplace(std::make_pair(arc->tail().get(), arc->head().get()),
- arc);
+ _graph_arcs.emplace(std::make_pair(arc->tail().get(),
+ arc->head().get()),
+ arc);
_signal_new_arc.emit(arc);
}
}
@@ -151,11 +152,11 @@ GraphModel::add_arc(const std::shared_ptr<ArcModel>& arc)
void
GraphModel::remove_arc(const Node* tail, const Node* head)
{
- auto i = _arcs.find(std::make_pair(tail, head));
- if (i != _arcs.end()) {
+ auto i = _graph_arcs.find(std::make_pair(tail, head));
+ if (i != _graph_arcs.end()) {
auto arc = std::dynamic_pointer_cast<ArcModel>(i->second);
_signal_removed_arc.emit(arc);
- _arcs.erase(i);
+ _graph_arcs.erase(i);
}
}
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index c172c445..9db429c5 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -36,16 +36,14 @@ ObjectModel::ObjectModel(URIs& uris, const raul::Path& path)
: Node(uris, path)
, _path(path)
, _symbol((path == "/") ? "root" : path.symbol())
-{
-}
+{}
ObjectModel::ObjectModel(const ObjectModel& copy)
: Node(copy)
, _parent(copy._parent)
, _path(copy._path)
, _symbol(copy._symbol)
-{
-}
+{}
bool
ObjectModel::is_a(const URIs::Quark& type) const
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 4dddd147..306846ee 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -24,7 +24,6 @@
#include <cctype>
#include <cstring>
-#include <iosfwd>
#include <memory>
#include <string>
#include <utility>
@@ -45,13 +44,12 @@ PluginModel::PluginModel(URIs& uris,
const Properties& properties)
: Resource(uris, uri)
, _type(type)
- , _fetched(false)
{
if (!_type.is_valid()) {
if (uri.string().find("ingen-internals") != string::npos) {
_type = uris.ingen_Internal.urid_atom();
} else {
- _type = uris.lv2_Plugin.urid_atom(); // Assume LV2 and hope for the best...
+ _type = uris.lv2_Plugin.urid_atom(); // Assume LV2 and hope for the best...
}
}
@@ -121,21 +119,27 @@ PluginModel::get_property(const URI& key) const
LilvNode* lv2_pred = lilv_new_uri(_lilv_world, key.c_str());
LilvNodes* values = lilv_plugin_get_value(_lilv_plugin, lv2_pred);
lilv_node_free(lv2_pred);
- LILV_FOREACH(nodes, i, values) {
+ LILV_FOREACH (nodes, i, values) {
const LilvNode* value = lilv_nodes_get(values, i);
if (lilv_node_is_uri(value)) {
ret = set_property(
key, _uris.forge.make_urid(URI(lilv_node_as_uri(value))));
break;
- } else if (lilv_node_is_string(value)) {
+ }
+
+ if (lilv_node_is_string(value)) {
ret = set_property(
key, _uris.forge.alloc(lilv_node_as_string(value)));
break;
- } else if (lilv_node_is_float(value)) {
+ }
+
+ if (lilv_node_is_float(value)) {
ret = set_property(
key, _uris.forge.make(lilv_node_as_float(value)));
break;
- } else if (lilv_node_is_int(value)) {
+ }
+
+ if (lilv_node_is_int(value)) {
ret = set_property(
key, _uris.forge.make(lilv_node_as_int(value)));
break;
@@ -181,9 +185,9 @@ PluginModel::default_block_symbol() const
const Atom& name_atom = get_property(_uris.lv2_symbol);
if (name_atom.is_valid() && name_atom.type() == _uris.forge.String) {
return raul::Symbol::symbolify(name_atom.ptr<char>());
- } else {
- return raul::Symbol("_");
}
+
+ return raul::Symbol("_");
}
string
@@ -192,9 +196,9 @@ PluginModel::human_name() const
const Atom& name_atom = get_property(_uris.doap_name);
if (name_atom.type() == _uris.forge.String) {
return name_atom.ptr<char>();
- } else {
- return default_block_symbol().c_str();
}
+
+ return default_block_symbol().c_str();
}
string
@@ -218,7 +222,7 @@ PluginModel::port_scale_points(const uint32_t index) const
if (_lilv_plugin) {
const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index);
LilvScalePoints* sp = lilv_port_get_scale_points(_lilv_plugin, port);
- LILV_FOREACH(scale_points, i, sp) {
+ LILV_FOREACH (scale_points, i, sp) {
const LilvScalePoint* p = lilv_scale_points_get(sp, i);
points.emplace(
lilv_node_as_float(lilv_scale_point_get_value(p)),
@@ -257,9 +261,9 @@ heading(const std::string& text, bool html, unsigned level)
if (html) {
const std::string tag = std::string("h") + std::to_string(level);
return std::string("<") + tag + ">" + text + "</" + tag + ">\n";
- } else {
- return text + ":\n\n";
}
+
+ return text + ":\n\n";
}
static std::string
@@ -267,9 +271,9 @@ link(const std::string& addr, bool html)
{
if (html) {
return std::string("<a href=\"") + addr + "\">" + addr + "</a>";
- } else {
- return addr;
}
+
+ return addr;
}
std::string
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 7292d8b2..031caceb 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -78,7 +78,7 @@ lv2_ui_write(SuilController controller,
const float value = *static_cast<const float*>(buffer);
if (port->value().type() == uris.atom_Float &&
value == port->value().get<float>()) {
- return; // Ignore feedback
+ return; // Ignore feedback
}
ui->signal_property_changed()(
@@ -166,13 +166,11 @@ PluginUI::PluginUI(ingen::World& world,
const LilvNode* ui_type)
: _world(world)
, _block(std::move(block))
- , _instance(nullptr)
, _uis(uis)
, _ui(ui)
, _ui_node(lilv_node_duplicate(lilv_ui_get_uri(ui)))
, _ui_type(lilv_node_duplicate(ui_type))
-{
-}
+{}
PluginUI::~PluginUI()
{
@@ -205,7 +203,7 @@ PluginUI::create(ingen::World& world,
LilvUIs* uis = lilv_plugin_get_uis(plugin);
const LilvUI* ui = nullptr;
const LilvNode* ui_type = nullptr;
- LILV_FOREACH(uis, u, uis) {
+ LILV_FOREACH (uis, u, uis) {
const LilvUI* this_ui = lilv_uis_get(uis, u);
if (lilv_ui_is_supported(this_ui,
suil_ui_supported,
@@ -247,7 +245,7 @@ PluginUI::instantiate()
LilvNode* ui_plugin = lilv_new_uri(lworld, LV2_UI__plugin);
LilvNodes* notes = lilv_world_find_nodes(
lworld, lilv_ui_get_uri(_ui), ui_portNotification, nullptr);
- LILV_FOREACH(nodes, n, notes) {
+ LILV_FOREACH (nodes, n, notes) {
const LilvNode* note = lilv_nodes_get(notes, n);
const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, nullptr);
const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, nullptr);
diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp
index f4d6bbc7..63705ebc 100644
--- a/src/client/ingen_client.cpp
+++ b/src/client/ingen_client.cpp
@@ -31,7 +31,7 @@ struct ClientModule : public ingen::Module {
extern "C" {
-ingen::Module*
+INGEN_MODULE_EXPORT ingen::Module*
ingen_module_load()
{
return new ingen::client::ClientModule();
diff --git a/src/client/meson.build b/src/client/meson.build
new file mode 100644
index 00000000..7c040634
--- /dev/null
+++ b/src/client/meson.build
@@ -0,0 +1,50 @@
+# Copyright 2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later
+
+################
+# Dependencies #
+################
+
+sigcpp_dep = dependency('sigc++-2.0', include_type: 'system')
+
+##########
+# Module #
+##########
+
+client_sources = files(
+ 'BlockModel.cpp',
+ 'ClientStore.cpp',
+ 'GraphModel.cpp',
+ 'ObjectModel.cpp',
+ 'PluginModel.cpp',
+ 'PluginUI.cpp',
+ 'PortModel.cpp',
+ 'ingen_client.cpp',
+)
+
+client_dependencies = [
+ boost_dep,
+ ingen_dep,
+ lilv_dep,
+ lv2_dep,
+ raul_dep,
+ sigcpp_dep,
+ suil_dep,
+]
+
+libingen_client = shared_library(
+ 'ingen_client',
+ client_sources,
+ cpp_args: cpp_suppressions + platform_defines + ['-DINGEN_CLIENT_INTERNAL'],
+ dependencies: client_dependencies,
+ gnu_symbol_visibility: 'hidden',
+ implicit_include_directories: false,
+ include_directories: ingen_include_dirs,
+ install: true,
+ install_dir: ingen_module_dir,
+)
+
+ingen_client_dep = declare_dependency(
+ dependencies: client_dependencies,
+ link_with: libingen_client,
+)
diff --git a/src/client/wscript b/src/client/wscript
deleted file mode 100644
index d63fb56c..00000000
--- a/src/client/wscript
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-
-
-def build(bld):
- obj = bld(features = 'cxx cxxshlib',
- cflags = ['-fvisibility=hidden'],
- includes = ['../../', '../../include'],
- export_includes = ['../../include'],
- name = 'libingen_client',
- target = 'ingen_client',
- install_path = '${LIBDIR}',
- use = 'libingen',
- uselib = 'GLIBMM LV2 LILV SUIL RAUL SERD SORD SIGCPP')
-
- obj.source = '''
- BlockModel.cpp
- ClientStore.cpp
- GraphModel.cpp
- ObjectModel.cpp
- PluginModel.cpp
- PluginUI.cpp
- PortModel.cpp
- ingen_client.cpp
- '''