Renamed NameMatchOptionHandler as AbstractOptionHandler.

pull/2/head
Tatsuhiro Tsujikawa 2011-10-22 22:57:44 +09:00
parent 3d767543e6
commit 23a83deb4f
5 changed files with 67 additions and 67 deletions

View File

@ -32,7 +32,7 @@
* files in the program, then also delete it here. * files in the program, then also delete it here.
*/ */
/* copyright --> */ /* copyright --> */
#include "NameMatchOptionHandler.h" #include "AbstractOptionHandler.h"
#include <algorithm> #include <algorithm>
@ -43,7 +43,7 @@
namespace aria2 { namespace aria2 {
NameMatchOptionHandler::NameMatchOptionHandler AbstractOptionHandler::AbstractOptionHandler
(const Pref* pref, (const Pref* pref,
const std::string& description, const std::string& description,
const std::string& defaultValue, const std::string& defaultValue,
@ -62,9 +62,9 @@ NameMatchOptionHandler::NameMatchOptionHandler
cumulative_(false) cumulative_(false)
{} {}
NameMatchOptionHandler::~NameMatchOptionHandler() {} AbstractOptionHandler::~AbstractOptionHandler() {}
void NameMatchOptionHandler::parse(Option& option, const std::string& arg) void AbstractOptionHandler::parse(Option& option, const std::string& arg)
{ {
try { try {
parseArg(option, arg); parseArg(option, arg);
@ -73,22 +73,22 @@ void NameMatchOptionHandler::parse(Option& option, const std::string& arg)
} }
} }
bool NameMatchOptionHandler::hasTag(const std::string& tag) const bool AbstractOptionHandler::hasTag(const std::string& tag) const
{ {
return std::find(tags_.begin(), tags_.end(), tag) != tags_.end(); return std::find(tags_.begin(), tags_.end(), tag) != tags_.end();
} }
void NameMatchOptionHandler::addTag(const std::string& tag) void AbstractOptionHandler::addTag(const std::string& tag)
{ {
tags_.push_back(tag); tags_.push_back(tag);
} }
std::string NameMatchOptionHandler::toTagString() const std::string AbstractOptionHandler::toTagString() const
{ {
return strjoin(tags_.begin(), tags_.end(), ", "); return strjoin(tags_.begin(), tags_.end(), ", ");
} }
const std::string& NameMatchOptionHandler::getName() const const std::string& AbstractOptionHandler::getName() const
{ {
return pref_->k; return pref_->k;
} }

View File

@ -32,8 +32,8 @@
* files in the program, then also delete it here. * files in the program, then also delete it here.
*/ */
/* copyright --> */ /* copyright --> */
#ifndef D_NAME_MATCH_OPTION_HANDLER_H #ifndef D_ABSTRACT_OPTION_HANDLER_H
#define D_NAME_MATCH_OPTION_HANDLER_H #define D_ABSTRACT_OPTION_HANDLER_H
#include "OptionHandler.h" #include "OptionHandler.h"
@ -46,7 +46,7 @@ namespace aria2 {
class Option; class Option;
class Pref; class Pref;
class NameMatchOptionHandler : public OptionHandler { class AbstractOptionHandler : public OptionHandler {
protected: protected:
const Pref* pref_; const Pref* pref_;
@ -71,13 +71,13 @@ protected:
virtual void parseArg(Option& option, const std::string& arg) = 0; virtual void parseArg(Option& option, const std::string& arg) = 0;
public: public:
NameMatchOptionHandler(const Pref* pref, AbstractOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION, const std::string& description = NO_DESCRIPTION,
const std::string& defaultValue = NO_DEFAULT_VALUE, const std::string& defaultValue = NO_DEFAULT_VALUE,
ARG_TYPE argType = REQ_ARG, ARG_TYPE argType = REQ_ARG,
char shortName = 0); char shortName = 0);
virtual ~NameMatchOptionHandler(); virtual ~AbstractOptionHandler();
virtual void parse(Option& option, const std::string& arg); virtual void parse(Option& option, const std::string& arg);
@ -177,4 +177,4 @@ public:
} // namespace aria2 } // namespace aria2
#endif // D_NAME_MATCH_OPTION_HANDLER_H #endif // D_ABSTRACT_OPTION_HANDLER_H

View File

@ -77,7 +77,7 @@ SRCS = Socket.h\
OptionHandlerFactory.cc OptionHandlerFactory.h\ OptionHandlerFactory.cc OptionHandlerFactory.h\
OptionHandler.cc OptionHandler.h\ OptionHandler.cc OptionHandler.h\
OptionHandlerImpl.cc OptionHandlerImpl.h\ OptionHandlerImpl.cc OptionHandlerImpl.h\
NameMatchOptionHandler.cc NameMatchOptionHandler.h\ AbstractOptionHandler.cc AbstractOptionHandler.h\
NameResolver.cc NameResolver.h\ NameResolver.cc NameResolver.h\
RequestGroup.cc RequestGroup.h\ RequestGroup.cc RequestGroup.h\
RequestGroupMan.cc RequestGroupMan.h\ RequestGroupMan.cc RequestGroupMan.h\

View File

@ -69,7 +69,7 @@ BooleanOptionHandler::BooleanOptionHandler
const std::string& defaultValue, const std::string& defaultValue,
OptionHandler::ARG_TYPE argType, OptionHandler::ARG_TYPE argType,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
argType, shortName) argType, shortName)
{} {}
@ -102,7 +102,7 @@ IntegerRangeOptionHandler::IntegerRangeOptionHandler
const std::string& defaultValue, const std::string& defaultValue,
int32_t min, int32_t max, int32_t min, int32_t max,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName), OptionHandler::REQ_ARG, shortName),
min_(min), min_(min),
max_(max) max_(max)
@ -139,7 +139,7 @@ NumberOptionHandler::NumberOptionHandler
int64_t min, int64_t min,
int64_t max, int64_t max,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName), OptionHandler::REQ_ARG, shortName),
min_(min), min_(min),
max_(max) max_(max)
@ -221,7 +221,7 @@ FloatNumberOptionHandler::FloatNumberOptionHandler
double min, double min,
double max, double max,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName), OptionHandler::REQ_ARG, shortName),
min_(min), min_(min),
max_(max) max_(max)
@ -279,7 +279,7 @@ DefaultOptionHandler::DefaultOptionHandler
const std::string& possibleValuesString, const std::string& possibleValuesString,
OptionHandler::ARG_TYPE argType, OptionHandler::ARG_TYPE argType,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, argType, : AbstractOptionHandler(pref, description, defaultValue, argType,
shortName), shortName),
possibleValuesString_(possibleValuesString) possibleValuesString_(possibleValuesString)
{} {}
@ -304,7 +304,7 @@ CumulativeOptionHandler::CumulativeOptionHandler
const std::string& possibleValuesString, const std::string& possibleValuesString,
OptionHandler::ARG_TYPE argType, OptionHandler::ARG_TYPE argType,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, argType, : AbstractOptionHandler(pref, description, defaultValue, argType,
shortName), shortName),
delim_(delim), delim_(delim),
possibleValuesString_(possibleValuesString) possibleValuesString_(possibleValuesString)
@ -329,7 +329,7 @@ IndexOutOptionHandler::IndexOutOptionHandler
(const Pref* pref, (const Pref* pref,
const std::string& description, const std::string& description,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, NO_DEFAULT_VALUE, : AbstractOptionHandler(pref, description, NO_DEFAULT_VALUE,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{} {}
@ -353,7 +353,7 @@ ChecksumOptionHandler::ChecksumOptionHandler
(const Pref* pref, (const Pref* pref,
const std::string& description, const std::string& description,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, NO_DEFAULT_VALUE, : AbstractOptionHandler(pref, description, NO_DEFAULT_VALUE,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{} {}
@ -382,7 +382,7 @@ ParameterOptionHandler::ParameterOptionHandler
const std::string& defaultValue, const std::string& defaultValue,
const std::vector<std::string>& validParamValues, const std::vector<std::string>& validParamValues,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName), OptionHandler::REQ_ARG, shortName),
validParamValues_(validParamValues) validParamValues_(validParamValues)
{} {}
@ -393,7 +393,7 @@ ParameterOptionHandler::ParameterOptionHandler
const std::string& defaultValue, const std::string& defaultValue,
const std::string& validParamValue, const std::string& validParamValue,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{ {
validParamValues_.push_back(validParamValue); validParamValues_.push_back(validParamValue);
@ -406,7 +406,7 @@ ParameterOptionHandler::ParameterOptionHandler
const std::string& validParamValue1, const std::string& validParamValue1,
const std::string& validParamValue2, const std::string& validParamValue2,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{ {
validParamValues_.push_back(validParamValue1); validParamValues_.push_back(validParamValue1);
@ -421,7 +421,7 @@ ParameterOptionHandler::ParameterOptionHandler
const std::string& validParamValue2, const std::string& validParamValue2,
const std::string& validParamValue3, const std::string& validParamValue3,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{ {
validParamValues_.push_back(validParamValue1); validParamValues_.push_back(validParamValue1);
@ -468,7 +468,7 @@ HostPortOptionHandler::HostPortOptionHandler
const Pref* hostOptionName, const Pref* hostOptionName,
const Pref* portOptionName, const Pref* portOptionName,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName), OptionHandler::REQ_ARG, shortName),
hostOptionName_(hostOptionName), hostOptionName_(hostOptionName),
portOptionName_(portOptionName) portOptionName_(portOptionName)
@ -505,7 +505,7 @@ HttpProxyUserOptionHandler::HttpProxyUserOptionHandler
const std::string& description, const std::string& description,
const std::string& defaultValue, const std::string& defaultValue,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{} {}
@ -547,7 +547,7 @@ HttpProxyPasswdOptionHandler::HttpProxyPasswdOptionHandler
const std::string& description, const std::string& description,
const std::string& defaultValue, const std::string& defaultValue,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{} {}
@ -589,7 +589,7 @@ HttpProxyOptionHandler::HttpProxyOptionHandler
const std::string& description, const std::string& description,
const std::string& defaultValue, const std::string& defaultValue,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName), OptionHandler::REQ_ARG, shortName),
proxyUserPref_(option::k2p(pref->k+"-user")), proxyUserPref_(option::k2p(pref->k+"-user")),
proxyPasswdPref_(option::k2p(pref->k+"-passwd")) proxyPasswdPref_(option::k2p(pref->k+"-passwd"))
@ -643,7 +643,7 @@ LocalFilePathOptionHandler::LocalFilePathOptionHandler
const std::string& defaultValue, const std::string& defaultValue,
bool acceptStdin, bool acceptStdin,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName), OptionHandler::REQ_ARG, shortName),
acceptStdin_(acceptStdin) acceptStdin_(acceptStdin)
{} {}
@ -676,7 +676,7 @@ PrioritizePieceOptionHandler::PrioritizePieceOptionHandler
const std::string& description, const std::string& description,
const std::string& defaultValue, const std::string& defaultValue,
char shortName) char shortName)
: NameMatchOptionHandler(pref, description, defaultValue, : AbstractOptionHandler(pref, description, defaultValue,
OptionHandler::REQ_ARG, shortName) OptionHandler::REQ_ARG, shortName)
{} {}

View File

@ -39,14 +39,14 @@
#include <vector> #include <vector>
#include "NameMatchOptionHandler.h" #include "AbstractOptionHandler.h"
namespace aria2 { namespace aria2 {
class Option; class Option;
class Pref; class Pref;
class BooleanOptionHandler : public NameMatchOptionHandler { class BooleanOptionHandler : public AbstractOptionHandler {
public: public:
BooleanOptionHandler(const Pref* pref, BooleanOptionHandler(const Pref* pref,
const std::string& description = NO_DESCRIPTION, const std::string& description = NO_DESCRIPTION,
@ -58,7 +58,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class IntegerRangeOptionHandler : public NameMatchOptionHandler { class IntegerRangeOptionHandler : public AbstractOptionHandler {
private: private:
int32_t min_; int32_t min_;
int32_t max_; int32_t max_;
@ -73,7 +73,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class NumberOptionHandler : public NameMatchOptionHandler { class NumberOptionHandler : public AbstractOptionHandler {
private: private:
int64_t min_; int64_t min_;
int64_t max_; int64_t max_;
@ -103,7 +103,7 @@ public:
virtual void parseArg(Option& option, const std::string& optarg); virtual void parseArg(Option& option, const std::string& optarg);
}; };
class FloatNumberOptionHandler : public NameMatchOptionHandler { class FloatNumberOptionHandler : public AbstractOptionHandler {
private: private:
double min_; double min_;
double max_; double max_;
@ -118,7 +118,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class DefaultOptionHandler : public NameMatchOptionHandler { class DefaultOptionHandler : public AbstractOptionHandler {
private: private:
std::string possibleValuesString_; std::string possibleValuesString_;
public: public:
@ -133,7 +133,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class CumulativeOptionHandler : public NameMatchOptionHandler { class CumulativeOptionHandler : public AbstractOptionHandler {
private: private:
std::string delim_; std::string delim_;
std::string possibleValuesString_; std::string possibleValuesString_;
@ -151,7 +151,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class IndexOutOptionHandler : public NameMatchOptionHandler { class IndexOutOptionHandler : public AbstractOptionHandler {
public: public:
IndexOutOptionHandler(const Pref* pref, IndexOutOptionHandler(const Pref* pref,
const std::string& description, const std::string& description,
@ -161,7 +161,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class ChecksumOptionHandler : public NameMatchOptionHandler { class ChecksumOptionHandler : public AbstractOptionHandler {
public: public:
ChecksumOptionHandler(const Pref* pref, ChecksumOptionHandler(const Pref* pref,
const std::string& description, const std::string& description,
@ -171,7 +171,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class ParameterOptionHandler : public NameMatchOptionHandler { class ParameterOptionHandler : public AbstractOptionHandler {
private: private:
std::vector<std::string> validParamValues_; std::vector<std::string> validParamValues_;
public: public:
@ -203,7 +203,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class HostPortOptionHandler : public NameMatchOptionHandler { class HostPortOptionHandler : public AbstractOptionHandler {
private: private:
const Pref* hostOptionName_; const Pref* hostOptionName_;
const Pref* portOptionName_; const Pref* portOptionName_;
@ -221,7 +221,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class HttpProxyUserOptionHandler:public NameMatchOptionHandler { class HttpProxyUserOptionHandler:public AbstractOptionHandler {
public: public:
HttpProxyUserOptionHandler(const Pref* pref, HttpProxyUserOptionHandler(const Pref* pref,
const std::string& description, const std::string& description,
@ -231,7 +231,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class HttpProxyPasswdOptionHandler:public NameMatchOptionHandler { class HttpProxyPasswdOptionHandler:public AbstractOptionHandler {
public: public:
HttpProxyPasswdOptionHandler(const Pref* pref, HttpProxyPasswdOptionHandler(const Pref* pref,
const std::string& description, const std::string& description,
@ -241,7 +241,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class HttpProxyOptionHandler : public NameMatchOptionHandler { class HttpProxyOptionHandler : public AbstractOptionHandler {
private: private:
const Pref* proxyUserPref_; const Pref* proxyUserPref_;
const Pref* proxyPasswdPref_; const Pref* proxyPasswdPref_;
@ -255,7 +255,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class LocalFilePathOptionHandler : public NameMatchOptionHandler { class LocalFilePathOptionHandler : public AbstractOptionHandler {
private: private:
bool acceptStdin_; bool acceptStdin_;
public: public:
@ -269,7 +269,7 @@ public:
virtual std::string createPossibleValuesString() const; virtual std::string createPossibleValuesString() const;
}; };
class PrioritizePieceOptionHandler:public NameMatchOptionHandler { class PrioritizePieceOptionHandler:public AbstractOptionHandler {
public: public:
PrioritizePieceOptionHandler PrioritizePieceOptionHandler
(const Pref* pref, (const Pref* pref,