diff options
author | David Robillard <d@drobilla.net> | 2010-02-04 17:21:44 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-04 17:21:44 +0000 |
commit | 7c19aa2a97c1e19b27b66c58a84c46489101950e (patch) | |
tree | 72b2fac98b6f69bc16770194900c0e0bec86311b /src/gui | |
parent | b8ef9bff8a46a682f68585aad7587bf081e8b7f8 (diff) | |
download | ingen-7c19aa2a97c1e19b27b66c58a84c46489101950e.tar.gz ingen-7c19aa2a97c1e19b27b66c58a84c46489101950e.tar.bz2 ingen-7c19aa2a97c1e19b27b66c58a84c46489101950e.zip |
Use std::string::empty where possible (faster, and less prone to C string errors).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2420 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GladeFactory.cpp | 4 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 2 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 4 | ||||
-rw-r--r-- | src/gui/PatchWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/RenameWindow.cpp | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/GladeFactory.cpp b/src/gui/GladeFactory.cpp index 41fcffc4..6a00a8b5 100644 --- a/src/gui/GladeFactory.cpp +++ b/src/gui/GladeFactory.cpp @@ -54,11 +54,11 @@ GladeFactory::find_glade_file() Glib::RefPtr<Gnome::Glade::Xml> GladeFactory::new_glade_reference(const string& toplevel_widget) { - if (glade_filename == "") + if (glade_filename.empty()) find_glade_file(); try { - if (toplevel_widget == "") + if (toplevel_widget.empty()) return Gnome::Glade::Xml::create(glade_filename); else return Gnome::Glade::Xml::create(glade_filename, toplevel_widget.c_str()); diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index cdf6cc1f..1b8b4859 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -332,10 +332,10 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) bool polyphonic = _polyphonic_checkbutton->get_active(); string name = _node_name_entry->get_text(); - if (name == "" || name == NAME_ENTRY_MULTI_STRING) + if (name.empty() || name == NAME_ENTRY_MULTI_STRING) name = generate_module_name(plugin, _plugin_name_offset); - if (name == "" || !Symbol::is_valid(name)) { + if (name.empty() || !Symbol::is_valid(name)) { Gtk::MessageDialog dialog(*this, "Unable to chose a default name for this node. Please enter a name.", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index cb6a06af..58366377 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -141,7 +141,7 @@ NodeModule::show_human_names(bool b) } else { Glib::ustring hn = node()->plugin_model()->port_human_name( port->model()->index()); - if (hn != "") + if (!hn.empty()) label = hn; } } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index cd2469d1..bd215037 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -372,7 +372,7 @@ PatchCanvas::add_node(SharedPtr<NodeModel> nm) } else { module = NodeModule::create(shared_this, nm, _human_names); const PluginModel* plugm = dynamic_cast<const PluginModel*>(nm->plugin()); - if (plugm && plugm->icon_path() != "") + if (plugm && !plugm->icon_path().empty()) module->set_icon(App::instance().icon_from_path(plugm->icon_path(), 100)); } @@ -662,7 +662,7 @@ PatchCanvas::paste() props.insert(make_pair(uris.ingen_polyphony, Raul::Atom(int32_t(_patch->poly())))); clipboard.put(Path(), props); size_t first_slash; - while (to_create != "/" && to_create != "" + while (to_create != "/" && !to_create.empty() && (first_slash = to_create.find("/")) != string::npos) { created += to_create.substr(0, first_slash); assert(Path::is_valid(created)); diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index 796837e3..9efd4887 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -324,7 +324,7 @@ PatchWindow::show_port_status(PortModel* port, const Raul::Atom& value) const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin()); if (plugin) { const string& human_name = plugin->port_human_name(port->index()); - if (human_name != "") + if (!human_name.empty()) msg << " (" << human_name << ")"; } } diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index f7fa86a9..1c3cbe85 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -99,7 +99,7 @@ void RenameWindow::label_changed() { const string& label = _label_entry->get_text(); - if (label == "") { + if (label.empty()) { _message_label->set_text("Label must be at least 1 character"); _ok_button->property_sensitive() = false; } else { @@ -141,7 +141,7 @@ RenameWindow::ok_clicked() } } - if (label != "" && (!name_atom.is_valid() || label != name_atom.get_string())) { + if (!label.empty() && (!name_atom.is_valid() || label != name_atom.get_string())) { App::instance().engine()->set_property(path, uris.lv2_name, Atom(label)); } |