summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-04 17:21:44 +0000
committerDavid Robillard <d@drobilla.net>2010-02-04 17:21:44 +0000
commit7c19aa2a97c1e19b27b66c58a84c46489101950e (patch)
tree72b2fac98b6f69bc16770194900c0e0bec86311b /src/serialisation
parentb8ef9bff8a46a682f68585aad7587bf081e8b7f8 (diff)
downloadingen-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/serialisation')
-rw-r--r--src/serialisation/Parser.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index bcc45fd1..92fe78d1 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -66,9 +66,9 @@ relative_uri(Glib::ustring base, const Glib::ustring uri, bool leading_slash)
else
ret = uri;
- if (leading_slash && (ret == "" || ret[0] != '/'))
+ if (leading_slash && (ret.empty() || ret[0] != '/'))
ret = "/" + ret;
- else if (!leading_slash && ret != "" && ret[0] == '/')
+ else if (!leading_slash && !ret.empty() && ret[0] == '/')
ret = ret.substr(1);
return ret;
@@ -137,7 +137,7 @@ Parser::parse_string(
Redland::Model model(*world->rdf_world, str.c_str(), str.length(), base_uri);
LOG(info) << "Parsing " << (data_path ? data_path->str() : "*") << " from string";
- if (base_uri != "")
+ if (!base_uri.empty())
LOG(info) << " (base " << base_uri << ")";
LOG(info) << endl;
@@ -189,7 +189,7 @@ Parser::parse_update(
if (obj_uri.find(":") == string::npos)
obj_uri = Path(obj_uri).str();
obj_uri = relative_uri(base_uri, obj_uri, true);
- if (key != "")
+ if (!key.empty())
target->set_property(string("path:") + obj_uri, key, a);
}
@@ -276,7 +276,7 @@ Parser::parse(
const Glib::ustring subject_uri_tok = Glib::ustring("<").append(subject).append(">");
if (is_object) {
- if (path_str == "" || path_str[0] != '/')
+ if (path_str.empty() || path_str[0] != '/')
path_str = "/" + path_str;
if (!Path::is_valid(path_str)) {
@@ -375,7 +375,7 @@ Parser::parse_patch(
} else { // Guess symbol from base URI (filename) if we need to
symbol = base_uri.substr(base_uri.find_last_of("/") + 1);
symbol = symbol.substr(0, symbol.find("."));
- if (symbol != "")
+ if (!symbol.empty())
symbol = Path::nameify(symbol);
}
@@ -726,7 +726,7 @@ Parser::parse_properties(
const Redland::Node& val = (*i)["val"];
if (skip_property((*i)["key"]))
continue;
- if (key != "" && val.type() != Redland::Node::BLANK)
+ if (!key.empty() && val.type() != Redland::Node::BLANK)
properties.insert(make_pair(key, AtomRDF::node_to_atom(model, val)));
}