summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-08-18 01:22:18 -0400
committerDavid Robillard <d@drobilla.net>2022-08-18 01:22:18 -0400
commit3af246bb3291d8568f6d110884fa55ee5fd20221 (patch)
tree434ac316050356e4db379ba8305b75285b17bbba /src/client
parent44381dbda9dbf8d20894789fe8e3ea941b70a1d0 (diff)
downloadingen-3af246bb3291d8568f6d110884fa55ee5fd20221.tar.gz
ingen-3af246bb3291d8568f6d110884fa55ee5fd20221.tar.bz2
ingen-3af246bb3291d8568f6d110884fa55ee5fd20221.zip
Avoid "else" after "return", "break", and "continue"
Diffstat (limited to 'src/client')
-rw-r--r--src/client/BlockModel.cpp8
-rw-r--r--src/client/ClientStore.cpp24
-rw-r--r--src/client/GraphModel.cpp4
-rw-r--r--src/client/PluginModel.cpp28
4 files changed, 37 insertions, 27 deletions
diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp
index ad216678..256c41f0 100644
--- a/src/client/BlockModel.cpp
+++ b/src/client/BlockModel.cpp
@@ -246,11 +246,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 9728cc4f..80143265 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -168,12 +168,12 @@ ClientStore::_object(const raul::Path& 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>
@@ -281,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));
@@ -452,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..7829a241 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -108,9 +108,9 @@ GraphModel::get_arc(const Node* tail, const Node* head)
auto i = _arcs.find(std::make_pair(tail, head));
if (i != _arcs.end()) {
return std::dynamic_pointer_cast<ArcModel>(i->second);
- } else {
- return nullptr;
}
+
+ return nullptr;
}
/** Add a connection to this graph.
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index a6784928..6ba989b9 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -125,15 +125,21 @@ PluginModel::get_property(const URI& key) const
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;
@@ -179,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
@@ -190,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
@@ -255,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
@@ -265,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