Made Pref::k_, OptionHandler::getName() and getDescription() const char*.

pull/2/head
Tatsuhiro Tsujikawa 2011-11-11 01:59:23 +09:00
parent 787bfd75da
commit 35a3f41346
13 changed files with 95 additions and 90 deletions

View File

@ -45,7 +45,7 @@ namespace aria2 {
AbstractOptionHandler::AbstractOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
ARG_TYPE argType,
char shortName)
@ -89,7 +89,7 @@ std::string AbstractOptionHandler::toTagString() const
return strjoin(tags_.begin(), tags_.end(), ", ");
}
const std::string& AbstractOptionHandler::getName() const
const char* AbstractOptionHandler::getName() const
{
return pref_->k;
}

View File

@ -50,7 +50,7 @@ class AbstractOptionHandler : public OptionHandler {
protected:
const Pref* pref_;
std::string description_;
const char* description_;
std::string defaultValue_;
@ -73,7 +73,7 @@ protected:
virtual void parseArg(Option& option, const std::string& arg) = 0;
public:
AbstractOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
ARG_TYPE argType = REQ_ARG,
char shortName = 0);
@ -88,9 +88,9 @@ public:
virtual std::string toTagString() const;
virtual const std::string& getName() const;
virtual const char* getName() const;
virtual const std::string& getDescription() const
virtual const char* getDescription() const
{
return description_;
}

View File

@ -41,7 +41,7 @@
namespace aria2 {
const std::string NO_DESCRIPTION("");
const char NO_DESCRIPTION[] = "";
const std::string NO_DEFAULT_VALUE("");
const std::string PATH_TO_FILE("/path/to/file");

View File

@ -46,7 +46,7 @@
namespace aria2 {
extern const std::string NO_DESCRIPTION;
extern const char NO_DESCRIPTION[];
extern const std::string NO_DEFAULT_VALUE;
extern const std::string PATH_TO_FILE;
@ -72,9 +72,9 @@ public:
virtual std::string toTagString() const = 0;
virtual const std::string& getName() const = 0;
virtual const char* getName() const = 0;
virtual const std::string& getDescription() const = 0;
virtual const char* getDescription() const = 0;
virtual const std::string& getDefaultValue() const = 0;

View File

@ -45,7 +45,7 @@ OptionHandlerException::OptionHandlerException
(const char* file, int line,
const Pref* pref)
: RecoverableException
(file, line, fmt(MESSAGE.c_str(), pref->k.c_str()),
(file, line, fmt(MESSAGE.c_str(), pref->k),
error_code::OPTION_ERROR),
pref_(pref)
{}
@ -55,7 +55,7 @@ OptionHandlerException::OptionHandlerException
const Pref* pref,
const Exception& cause)
: RecoverableException
(file, line, fmt(MESSAGE.c_str(), pref->k.c_str()),
(file, line, fmt(MESSAGE.c_str(), pref->k),
error_code::OPTION_ERROR,
cause),
pref_(pref)

View File

@ -36,6 +36,7 @@
#include <cassert>
#include <cstdio>
#include <cstring>
#include <utility>
#include <algorithm>
#include <numeric>
@ -67,7 +68,7 @@ namespace aria2 {
BooleanOptionHandler::BooleanOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
OptionHandler::ARG_TYPE argType,
char shortName)
@ -100,7 +101,7 @@ std::string BooleanOptionHandler::createPossibleValuesString() const
IntegerRangeOptionHandler::IntegerRangeOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
int32_t min, int32_t max,
char shortName)
@ -138,7 +139,7 @@ std::string IntegerRangeOptionHandler::createPossibleValuesString() const
NumberOptionHandler::NumberOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
int64_t min,
int64_t max,
@ -200,7 +201,7 @@ std::string NumberOptionHandler::createPossibleValuesString() const
UnitNumberOptionHandler::UnitNumberOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
int64_t min,
int64_t max,
@ -220,7 +221,7 @@ void UnitNumberOptionHandler::parseArg
FloatNumberOptionHandler::FloatNumberOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
double min,
double max,
@ -278,7 +279,7 @@ std::string FloatNumberOptionHandler::createPossibleValuesString() const
DefaultOptionHandler::DefaultOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& possibleValuesString,
OptionHandler::ARG_TYPE argType,
@ -302,7 +303,7 @@ std::string DefaultOptionHandler::createPossibleValuesString() const
CumulativeOptionHandler::CumulativeOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& delim,
const std::string& possibleValuesString,
@ -331,7 +332,7 @@ std::string CumulativeOptionHandler::createPossibleValuesString() const
IndexOutOptionHandler::IndexOutOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
char shortName)
: AbstractOptionHandler(pref, description, NO_DEFAULT_VALUE,
OptionHandler::REQ_ARG, shortName)
@ -356,7 +357,7 @@ std::string IndexOutOptionHandler::createPossibleValuesString() const
#ifdef ENABLE_MESSAGE_DIGEST
ChecksumOptionHandler::ChecksumOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
char shortName)
: AbstractOptionHandler(pref, description, NO_DEFAULT_VALUE,
OptionHandler::REQ_ARG, shortName)
@ -386,7 +387,7 @@ std::string ChecksumOptionHandler::createPossibleValuesString() const
ParameterOptionHandler::ParameterOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::vector<std::string>& validParamValues,
char shortName)
@ -397,7 +398,7 @@ ParameterOptionHandler::ParameterOptionHandler
ParameterOptionHandler::ParameterOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& validParamValue,
char shortName)
@ -409,7 +410,7 @@ ParameterOptionHandler::ParameterOptionHandler
ParameterOptionHandler::ParameterOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& validParamValue1,
const std::string& validParamValue2,
@ -423,7 +424,7 @@ ParameterOptionHandler::ParameterOptionHandler
ParameterOptionHandler::ParameterOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& validParamValue1,
const std::string& validParamValue2,
@ -471,7 +472,7 @@ std::string ParameterOptionHandler::createPossibleValuesString() const
HostPortOptionHandler::HostPortOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const Pref* hostOptionName,
const Pref* portOptionName,
@ -510,7 +511,7 @@ std::string HostPortOptionHandler::createPossibleValuesString() const
HttpProxyUserOptionHandler::HttpProxyUserOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
char shortName)
: AbstractOptionHandler(pref, description, defaultValue,
@ -521,9 +522,9 @@ void HttpProxyUserOptionHandler::parseArg
(Option& option, const std::string& optarg)
{
const char A2_USER[] = "-user";
if(util::endsWith(pref_->k.begin(), pref_->k.end(),
A2_USER, vend(A2_USER)-1)) {
const Pref* proxyPref = option::k2p(pref_->k.substr(0, pref_->k.size()-5));
size_t kLen = strlen(pref_->k);
if(util::endsWith(pref_->k, pref_->k+kLen, A2_USER, vend(A2_USER)-1)) {
const Pref* proxyPref = option::k2p(std::string(pref_->k, kLen-5));
const std::string& olduri = option.get(proxyPref);
if(!olduri.empty()) {
Request req;
@ -554,7 +555,7 @@ std::string HttpProxyUserOptionHandler::createPossibleValuesString() const
HttpProxyPasswdOptionHandler::HttpProxyPasswdOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
char shortName)
: AbstractOptionHandler(pref, description, defaultValue,
@ -565,9 +566,9 @@ void HttpProxyPasswdOptionHandler::parseArg
(Option& option, const std::string& optarg)
{
const char A2_PASSWD[] = "-passwd";
if(util::endsWith(pref_->k.begin(), pref_->k.end(),
A2_PASSWD, vend(A2_PASSWD)-1)) {
const Pref* proxyPref = option::k2p(pref_->k.substr(0, pref_->k.size()-7));
size_t kLen = strlen(pref_->k);
if(util::endsWith(pref_->k, pref_->k+kLen, A2_PASSWD, vend(A2_PASSWD)-1)) {
const Pref* proxyPref = option::k2p(std::string(pref_->k, kLen-7));
const std::string& olduri = option.get(proxyPref);
if(!olduri.empty()) {
Request req;
@ -598,13 +599,13 @@ std::string HttpProxyPasswdOptionHandler::createPossibleValuesString() const
HttpProxyOptionHandler::HttpProxyOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
char shortName)
: AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName),
proxyUserPref_(option::k2p(pref->k+"-user")),
proxyPasswdPref_(option::k2p(pref->k+"-passwd"))
proxyUserPref_(option::k2p(std::string(pref->k)+"-user")),
proxyPasswdPref_(option::k2p(std::string(pref->k)+"-passwd"))
{}
HttpProxyOptionHandler::~HttpProxyOptionHandler() {}
@ -657,7 +658,7 @@ std::string HttpProxyOptionHandler::createPossibleValuesString() const
LocalFilePathOptionHandler::LocalFilePathOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
bool acceptStdin,
char shortName)
@ -691,7 +692,7 @@ std::string LocalFilePathOptionHandler::createPossibleValuesString() const
PrioritizePieceOptionHandler::PrioritizePieceOptionHandler
(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
char shortName)
: AbstractOptionHandler(pref, description, defaultValue,
@ -724,12 +725,12 @@ void DeprecatedOptionHandler::parse(Option& option, const std::string& arg)
{
if(repOptHandler_) {
A2_LOG_WARN(fmt(_("--%s option is deprecated. Use --%s option instead."),
depOptHandler_->getName().c_str(),
repOptHandler_->getName().c_str()));
depOptHandler_->getName(),
repOptHandler_->getName()));
repOptHandler_->parse(option, arg);
} else {
A2_LOG_WARN(fmt(_("--%s option is deprecated."),
depOptHandler_->getName().c_str()));
depOptHandler_->getName()));
}
}
@ -753,12 +754,12 @@ std::string DeprecatedOptionHandler::toTagString() const
return depOptHandler_->toTagString();
}
const std::string& DeprecatedOptionHandler::getName() const
const char* DeprecatedOptionHandler::getName() const
{
return depOptHandler_->getName();
}
const std::string& DeprecatedOptionHandler::getDescription() const
const char* DeprecatedOptionHandler::getDescription() const
{
return depOptHandler_->getDescription();
}

View File

@ -49,7 +49,7 @@ class Pref;
class BooleanOptionHandler : public AbstractOptionHandler {
public:
BooleanOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
OptionHandler::ARG_TYPE argType = OptionHandler::REQ_ARG,
char shortName = 0);
@ -64,7 +64,7 @@ private:
int32_t max_;
public:
IntegerRangeOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
int32_t min, int32_t max,
char shortName = 0);
@ -79,7 +79,7 @@ private:
int64_t max_;
public:
NumberOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
int64_t min = -1,
int64_t max = -1,
@ -94,7 +94,7 @@ public:
class UnitNumberOptionHandler : public NumberOptionHandler {
public:
UnitNumberOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
int64_t min = -1,
int64_t max = -1,
@ -109,7 +109,7 @@ private:
double max_;
public:
FloatNumberOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
double min = -1, double max = -1,
char shortName = 0);
@ -123,7 +123,7 @@ private:
std::string possibleValuesString_;
public:
DefaultOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
const std::string& possibleValuesString = A2STR::NIL,
OptionHandler::ARG_TYPE argType = OptionHandler::REQ_ARG,
@ -139,7 +139,7 @@ private:
std::string possibleValuesString_;
public:
CumulativeOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& delim,
const std::string& possibleValuesString = A2STR::NIL,
@ -154,7 +154,7 @@ public:
class IndexOutOptionHandler : public AbstractOptionHandler {
public:
IndexOutOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
char shortName = 0);
virtual ~IndexOutOptionHandler();
virtual void parseArg(Option& option, const std::string& optarg);
@ -165,7 +165,7 @@ public:
class ChecksumOptionHandler : public AbstractOptionHandler {
public:
ChecksumOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
char shortName = 0);
virtual ~ChecksumOptionHandler();
virtual void parseArg(Option& option, const std::string& optarg);
@ -178,23 +178,23 @@ private:
std::vector<std::string> validParamValues_;
public:
ParameterOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::vector<std::string>& validParamValues,
char shortName = 0);
ParameterOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& validParamValue,
char shortName = 0);
ParameterOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& validParamValue1,
const std::string& validParamValue2,
char shortName = 0);
ParameterOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const std::string& validParamValue1,
const std::string& validParamValue2,
@ -211,7 +211,7 @@ private:
const Pref* portOptionName_;
public:
HostPortOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
const Pref* hostOptionName,
const Pref* portOptionName,
@ -226,7 +226,7 @@ public:
class HttpProxyUserOptionHandler:public AbstractOptionHandler {
public:
HttpProxyUserOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
char shortName = 0);
virtual void parseArg(Option& option, const std::string& optarg);
@ -236,7 +236,7 @@ public:
class HttpProxyPasswdOptionHandler:public AbstractOptionHandler {
public:
HttpProxyPasswdOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
char shortName = 0);
virtual void parseArg(Option& option, const std::string& optarg);
@ -249,7 +249,7 @@ private:
const Pref* proxyPasswdPref_;
public:
HttpProxyOptionHandler(const Pref* pref,
const std::string& description,
const char* description,
const std::string& defaultValue,
char shortName = 0);
virtual ~HttpProxyOptionHandler();
@ -263,7 +263,7 @@ private:
public:
LocalFilePathOptionHandler
(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
bool acceptStdin = false,
char shortName = 0);
@ -275,7 +275,7 @@ class PrioritizePieceOptionHandler:public AbstractOptionHandler {
public:
PrioritizePieceOptionHandler
(const Pref* pref,
const std::string& description = NO_DESCRIPTION,
const char* description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE,
char shortName = 0);
virtual void parseArg(Option& option, const std::string& optarg);
@ -301,8 +301,8 @@ public:
virtual bool hasTag(const std::string& tag) const;
virtual void addTag(const std::string& tag);
virtual std::string toTagString() const;
virtual const std::string& getName() const;
virtual const std::string& getDescription() const;
virtual const char* getName() const;
virtual const char* getDescription() const;
virtual const std::string& getDefaultValue() const;
virtual bool isHidden() const;
virtual void hide();

View File

@ -83,9 +83,9 @@ void putOptions(struct option* longOpts, int* plopt,
for(; first != last; ++first) {
if(*first && !(*first)->isHidden()) {
#ifdef HAVE_OPTION_CONST_NAME
(*longOpts).name = (*first)->getName().c_str();
(*longOpts).name = (*first)->getName();
#else // !HAVE_OPTION_CONST_NAME
(*longOpts).name = strdup((*first)->getName().c_str());
(*longOpts).name = strdup((*first)->getName());
#endif // !HAVE_OPTION_CONST_NAME
switch((*first)->getArgType()) {
case OptionHandler::REQ_ARG:
@ -245,11 +245,15 @@ OptionParser::findByNameSubstring(const std::string& substring) const
std::vector<SharedHandle<OptionHandler> > result;
for(std::vector<SharedHandle<OptionHandler> >::const_iterator i =
handlers_.begin(), eoi = handlers_.end(); i != eoi; ++i) {
if(*i && !(*i)->isHidden() &&
(*i)->getName().find(substring) != std::string::npos) {
if(*i && !(*i)->isHidden()) {
size_t nameLen = strlen((*i)->getName());
if(std::search((*i)->getName(), (*i)->getName()+nameLen,
substring.begin(), substring.end()) !=
(*i)->getName()+nameLen) {
result.push_back(*i);
}
}
}
return result;
}

View File

@ -91,12 +91,12 @@ bool writeOption(BufferedFile& fp, const SharedHandle<Option>& op)
false, false);
for(std::vector<std::string>::const_iterator j = v.begin(),
eoj = v.end(); j != eoj; ++j) {
if(fp.printf(" %s=%s\n", pref->k.c_str(), (*j).c_str()) < 0) {
if(fp.printf(" %s=%s\n", pref->k, (*j).c_str()) < 0) {
return false;
}
}
} else {
if(fp.printf(" %s=%s\n", pref->k.c_str(), op->get(pref).c_str()) < 0) {
if(fp.printf(" %s=%s\n", pref->k, op->get(pref).c_str()) < 0) {
return false;
}
}
@ -186,7 +186,7 @@ bool SessionSerializer::save(BufferedFile& fp) const
// PREF_PAUSE was removed from option, so save it here looking
// property separately.
if((*itr)->isPauseRequested()) {
if(fp.printf(" %s=true\n", PREF_PAUSE->k.c_str()) < 0) {
if(fp.printf(" %s=true\n", PREF_PAUSE->k) < 0) {
return false;
}
}

View File

@ -153,7 +153,7 @@ void option_processing(Option& op, std::vector<std::string>& uris,
e.stackTrace().c_str());
const SharedHandle<OptionHandler>& h = oparser->find(e.getPref());
if(h) {
global::cerr()->printf("Usage:\n%s\n", h->getDescription().c_str());
global::cerr()->printf("Usage:\n%s\n", h->getDescription());
}
exit(e.getErrorCode());
} catch(Exception& e) {

View File

@ -40,7 +40,7 @@
namespace aria2 {
Pref::Pref(const std::string& k, size_t i):k(k), i(i) {}
Pref::Pref(const char* k, size_t i):k(k), i(i) {}
namespace {
@ -55,7 +55,7 @@ public:
{
return count_++;
}
Pref* makePref(const std::string& key)
Pref* makePref(const char* key)
{
size_t id = nextId();
Pref* pref = new Pref(key, id);
@ -93,7 +93,7 @@ PrefFactory* getPrefFactory()
return pf;
}
Pref* makePref(const std::string& key)
Pref* makePref(const char* key)
{
return getPrefFactory()->makePref(key);
}

View File

@ -41,9 +41,9 @@
namespace aria2 {
struct Pref {
Pref(const std::string& k, size_t i);
Pref(const char* k, size_t i);
// Keyword, aka Option Name
std::string k;
const char* k;
// Option ID
size_t i;
};

View File

@ -81,9 +81,9 @@ void OptionParserTest::testFindAll()
{
std::vector<SharedHandle<OptionHandler> > res = oparser_->findAll();
CPPUNIT_ASSERT_EQUAL((size_t)3, res.size());
CPPUNIT_ASSERT_EQUAL(std::string("timeout"), res[0]->getName());
CPPUNIT_ASSERT_EQUAL(std::string("dir"), res[1]->getName());
CPPUNIT_ASSERT_EQUAL(std::string("out"), res[2]->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"timeout", res[0]->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"dir", res[1]->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"out", res[2]->getName());
}
void OptionParserTest::testFindByNameSubstring()
@ -91,8 +91,8 @@ void OptionParserTest::testFindByNameSubstring()
std::vector<SharedHandle<OptionHandler> > res =
oparser_->findByNameSubstring("i");
CPPUNIT_ASSERT_EQUAL((size_t)2, res.size());
CPPUNIT_ASSERT_EQUAL(std::string("timeout"), res[0]->getName());
CPPUNIT_ASSERT_EQUAL(std::string("dir"), res[1]->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"timeout", res[0]->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"dir", res[1]->getName());
}
void OptionParserTest::testFindByTag()
@ -100,15 +100,15 @@ void OptionParserTest::testFindByTag()
std::vector<SharedHandle<OptionHandler> > res =
oparser_->findByTag("pineapple");
CPPUNIT_ASSERT_EQUAL((size_t)2, res.size());
CPPUNIT_ASSERT_EQUAL(std::string("dir"), res[0]->getName());
CPPUNIT_ASSERT_EQUAL(std::string("out"), res[1]->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"dir", res[0]->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"out", res[1]->getName());
}
void OptionParserTest::testFind()
{
const SharedHandle<OptionHandler>& dir = oparser_->find(PREF_DIR);
CPPUNIT_ASSERT(dir);
CPPUNIT_ASSERT_EQUAL(std::string("dir"), dir->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"dir", dir->getName());
const SharedHandle<OptionHandler>& daemon = oparser_->find(PREF_DAEMON);
CPPUNIT_ASSERT(!daemon);
@ -121,7 +121,7 @@ void OptionParserTest::testFindByShortName()
{
const SharedHandle<OptionHandler>& timeout = oparser_->findByShortName('A');
CPPUNIT_ASSERT(timeout);
CPPUNIT_ASSERT_EQUAL(std::string("timeout"), timeout->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"timeout", timeout->getName());
CPPUNIT_ASSERT(!oparser_->findByShortName('C'));
}
@ -131,7 +131,7 @@ void OptionParserTest::testFindById()
const SharedHandle<OptionHandler>& timeout =
oparser_->findById(PREF_TIMEOUT->i);
CPPUNIT_ASSERT(timeout);
CPPUNIT_ASSERT_EQUAL(std::string("timeout"), timeout->getName());
CPPUNIT_ASSERT_EQUAL((const char*)"timeout", timeout->getName());
CPPUNIT_ASSERT(!oparser_->findById(9999));
}