summaryrefslogtreecommitdiff
path: root/src/OptionHandlerException.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-10-21 21:56:42 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-10-21 21:56:42 +0900
commit3832ed97c616eff0057d7a0e5a161c4282537160 (patch)
treeac69085552ddce55eed873ab1b4e359805fc5961 /src/OptionHandlerException.cc
parent20e781c2df1fa961a09edafe1ff02202278e3636 (diff)
Rewritten Option. Introduced Pref.
Now preference key is Pref instead of just string. It has Option ID. Now option lookup and setting takes O(1) using Pref object.
Diffstat (limited to 'src/OptionHandlerException.cc')
-rw-r--r--src/OptionHandlerException.cc33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/OptionHandlerException.cc b/src/OptionHandlerException.cc
index f3949768..04507f65 100644
--- a/src/OptionHandlerException.cc
+++ b/src/OptionHandlerException.cc
@@ -34,31 +34,38 @@
/* copyright --> */
#include "OptionHandlerException.h"
#include "fmt.h"
+#include "prefs.h"
namespace aria2 {
const std::string OptionHandlerException::MESSAGE
("We encountered a problem while processing the option '--%s'.");
-OptionHandlerException::OptionHandlerException(const char* file, int line,
- const std::string& optName):
- RecoverableException
- (file, line, fmt(MESSAGE.c_str(), optName.c_str()), error_code::OPTION_ERROR),
- optName_(optName) {}
+OptionHandlerException::OptionHandlerException
+(const char* file, int line,
+ const Pref* pref)
+ : RecoverableException
+ (file, line, fmt(MESSAGE.c_str(), pref->k.c_str()),
+ error_code::OPTION_ERROR),
+ pref_(pref)
+{}
-OptionHandlerException::OptionHandlerException(const char* file, int line,
- const std::string& optName,
- const Exception& cause):
- RecoverableException
- (file, line, fmt(MESSAGE.c_str(), optName.c_str()), error_code::OPTION_ERROR,
- cause),
- optName_(optName) {}
+OptionHandlerException::OptionHandlerException
+(const char* file, int line,
+ const Pref* pref,
+ const Exception& cause)
+ : RecoverableException
+ (file, line, fmt(MESSAGE.c_str(), pref->k.c_str()),
+ error_code::OPTION_ERROR,
+ cause),
+ pref_(pref)
+{}
OptionHandlerException::~OptionHandlerException() throw() {}
const std::string& OptionHandlerException::getOptionName() const throw()
{
- return optName_;
+ return pref_->k;
}
SharedHandle<Exception> OptionHandlerException::copy() const