diff options
author | David Robillard <d@drobilla.net> | 2012-03-12 06:59:48 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-12 06:59:48 +0000 |
commit | ffa270b487c29d02d3faab7120a484309f2f600f (patch) | |
tree | 16708ca3e48d2d909769a35f3de4a5c256868f9f /src | |
parent | 052b0c2658d2959dc02f9a752ee2a251bc60dc59 (diff) | |
download | raul-ffa270b487c29d02d3faab7120a484309f2f600f.tar.gz raul-ffa270b487c29d02d3faab7120a484309f2f600f.tar.bz2 raul-ffa270b487c29d02d3faab7120a484309f2f600f.zip |
Centralise atom creation in forge object.
Aside from being more greppable and making realtime violations more obvious, this is a step towards using LV2 atoms internally (which needs a factory since the type numbers are dynamic).
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4054 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/Configuration.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 88756e7..aa721fe 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -70,7 +70,8 @@ Configuration::print_usage(const std::string& program, std::ostream& os) } int -Configuration::set_value_from_string(Configuration::Option& option, const std::string& value) +Configuration::set_value_from_string(Configuration::Option& option, + const std::string& value) throw (Configuration::CommandLineError) { int intval = 0; @@ -79,14 +80,14 @@ Configuration::set_value_from_string(Configuration::Option& option, const std::s case Atom::INT: intval = static_cast<int>(strtol(value.c_str(), &endptr, 10)); if (endptr && *endptr == '\0') { - option.value = intval; + option.value = _forge->make(intval); } else { throw CommandLineError("option `" + option.name + "' has non-integer value `" + value + "'"); } break; case Atom::STRING: - option.value = Atom(value.c_str()); + option.value = _forge->make(value.c_str()); break; default: throw CommandLineError(string("bad option type `--") + option.name + "'"); @@ -108,7 +109,7 @@ Configuration::parse(int argc, char** argv) throw (Configuration::CommandLineErr throw CommandLineError(string("unrecognized option `--") + name + "'"); } if (o->second.type == Atom::BOOL) { - o->second.value = true; + o->second.value = _forge->make(true); } else { if (++i >= argc) throw CommandLineError("missing value for `--" + name + "'"); @@ -125,10 +126,10 @@ Configuration::parse(int argc, char** argv) throw (Configuration::CommandLineErr if (j < len - 1) { if (o->second.type != Atom::BOOL) throw CommandLineError(string("missing value for `-") + letter + "'"); - o->second.value = true; + o->second.value = _forge->make(true); } else { if (o->second.type == Atom::BOOL) { - o->second.value = true; + o->second.value = _forge->make(true); } else { if (++i >= argc) throw CommandLineError(string("missing value for `-") + letter + "'"); |