summaryrefslogtreecommitdiffstats
path: root/src/Configuration.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-11-21 06:28:25 +0000
committerDavid Robillard <d@drobilla.net>2012-11-21 06:28:25 +0000
commit480c0e362aec524d992ed7adaccf3c13b71e6f93 (patch)
tree6999cdf1edea7caaab0d4e22629e86a8f98a7a41 /src/Configuration.cpp
parent0583e0b72b6bf7064c2e8af498b18f0bc168485f (diff)
downloadingen-480c0e362aec524d992ed7adaccf3c13b71e6f93.tar.gz
ingen-480c0e362aec524d992ed7adaccf3c13b71e6f93.tar.bz2
ingen-480c0e362aec524d992ed7adaccf3c13b71e6f93.zip
Use translatable strings for command line error messages.
Update for Raul Exception namespace change. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4840 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/Configuration.cpp')
-rw-r--r--src/Configuration.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 9c9402c0..a7f45e7f 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -17,6 +17,7 @@
#include <iostream>
#include "ingen/Configuration.hpp"
+#include "raul/fmt.hpp"
namespace Ingen {
@@ -111,8 +112,9 @@ Configuration::set_value_from_string(Configuration::Option& option,
if (endptr && *endptr == '\0') {
option.value = Value(intval);
} else {
- throw CommandLineError("option `" + option.name
- + "' has non-integer value `" + value + "'");
+ throw CommandLineError(
+ (Raul::fmt("option `%1%' has non-integer value `%2%'")
+ % option.name % value).str());
}
break;
case STRING:
@@ -120,7 +122,8 @@ Configuration::set_value_from_string(Configuration::Option& option,
assert(option.value.type() == STRING);
break;
default:
- throw CommandLineError(std::string("bad option type `--") + option.name + "'");
+ throw CommandLineError(
+ (Raul::fmt("bad option type `%1%'") % option.name).str());
}
return EXIT_SUCCESS;
}
@@ -136,13 +139,15 @@ Configuration::parse(int argc, char** argv) throw (Configuration::CommandLineErr
const std::string name = std::string(argv[i]).substr(2);
Options::iterator o = _options.find(name);
if (o == _options.end()) {
- throw CommandLineError(std::string("unrecognized option `--") + name + "'");
+ throw CommandLineError(
+ (Raul::fmt("unrecognized option `%1%'") % name).str());
}
if (o->second.type == BOOL) {
o->second.value = Value(true);
} else {
if (++i >= argc)
- throw CommandLineError("missing value for `--" + name + "'");
+ throw CommandLineError(
+ (Raul::fmt("missing value for `%1'") % name).str());
set_value_from_string(o->second, argv[i]);
}
} else {
@@ -151,18 +156,21 @@ Configuration::parse(int argc, char** argv) throw (Configuration::CommandLineErr
char letter = argv[i][j];
ShortNames::iterator n = _short_names.find(letter);
if (n == _short_names.end())
- throw CommandLineError(std::string("unrecognized option `-") + letter + "'");
+ throw CommandLineError(
+ (Raul::fmt("unrecognized option `%1%'") % letter).str());
Options::iterator o = _options.find(n->second);
if (j < len - 1) {
if (o->second.type != BOOL)
- throw CommandLineError(std::string("missing value for `-") + letter + "'");
+ throw CommandLineError(
+ (Raul::fmt("missing value for `%1%'") % letter).str());
o->second.value = Value(true);
} else {
if (o->second.type == BOOL) {
o->second.value = Value(true);
} else {
if (++i >= argc)
- throw CommandLineError(std::string("missing value for `-") + letter + "'");
+ throw CommandLineError(
+ (Raul::fmt("missing value for `%1%'") % letter).str());
set_value_from_string(o->second, argv[i]);
}
}