summaryrefslogtreecommitdiff
path: root/src/OptionHandlerFactory.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-22 23:19:54 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-22 23:19:54 +0900
commit09c597fbb83fcd4fd958dae38ab0f2c7718da570 (patch)
treed5558b3498e671afa20022c6e7b32a6f93680fb3 /src/OptionHandlerFactory.cc
parentd1a17e5ef3408a53627dfc3007c8ffde1540d418 (diff)
ParameterOptionHandler: Use initializer lists for params
Diffstat (limited to 'src/OptionHandlerFactory.cc')
-rw-r--r--src/OptionHandlerFactory.cc75
1 files changed, 32 insertions, 43 deletions
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc
index 9e0e3cec..57b052d1 100644
--- a/src/OptionHandlerFactory.cc
+++ b/src/OptionHandlerFactory.cc
@@ -282,8 +282,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
(PREF_DOWNLOAD_RESULT,
TEXT_DOWNLOAD_RESULT,
A2_V_DEFAULT,
- A2_V_DEFAULT,
- A2_V_FULL));
+ { A2_V_DEFAULT, A2_V_FULL}));
op->addTag(TAG_ADVANCED);
op->setChangeGlobalOption(true);
handlers.push_back(op);
@@ -328,24 +327,6 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op);
}
{
- std::string params[] = {
-#ifdef HAVE_EPOLL
- V_EPOLL,
-#endif // HAVE_EPOLL
-#ifdef HAVE_KQUEUE
- V_KQUEUE,
-#endif // HAVE_KQUEUE
-#ifdef HAVE_PORT_ASSOCIATE
- V_PORT,
-#endif // HAVE_PORT_ASSOCIATE
-#ifdef HAVE_LIBUV
- V_LIBUV,
-#endif // HAVE_LIBUV
-#ifdef HAVE_POLL
- V_POLL,
-#endif // HAVE_POLL
- V_SELECT
- };
OptionHandler* op(new ParameterOptionHandler
(PREF_EVENT_POLL,
TEXT_EVENT_POLL,
@@ -362,23 +343,37 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
#else // defined(HAVE_EPOLL)
V_SELECT,
#endif // defined(HAVE_EPOLL)
- std::vector<std::string>
- (vbegin(params), vend(params))));
+ {
+#ifdef HAVE_EPOLL
+ V_EPOLL,
+#endif // HAVE_EPOLL
+#ifdef HAVE_KQUEUE
+ V_KQUEUE,
+#endif // HAVE_KQUEUE
+#ifdef HAVE_PORT_ASSOCIATE
+ V_PORT,
+#endif // HAVE_PORT_ASSOCIATE
+#ifdef HAVE_LIBUV
+ V_LIBUV,
+#endif // HAVE_LIBUV
+#ifdef HAVE_POLL
+ V_POLL,
+#endif // HAVE_POLL
+ V_SELECT
+ }));
op->addTag(TAG_ADVANCED);
handlers.push_back(op);
}
{
- const std::string params[] = { V_NONE, V_PREALLOC, V_TRUNC,
-#ifdef HAVE_SOME_FALLOCATE
- V_FALLOC
-#endif // HAVE_SOME_FALLOCATE
- };
OptionHandler* op(new ParameterOptionHandler
(PREF_FILE_ALLOCATION,
TEXT_FILE_ALLOCATION,
V_PREALLOC,
- std::vector<std::string>
- (vbegin(params), vend(params)),
+ { V_NONE, V_PREALLOC, V_TRUNC,
+#ifdef HAVE_SOME_FALLOCATE
+ V_FALLOC
+#endif // HAVE_SOME_FALLOCATE
+ },
'a'));
op->addTag(TAG_BASIC);
op->addTag(TAG_FILE);
@@ -1107,9 +1102,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
(PREF_STREAM_PIECE_SELECTOR,
TEXT_STREAM_PIECE_SELECTOR,
A2_V_DEFAULT,
- A2_V_DEFAULT,
- V_INORDER,
- A2_V_GEOM));
+ { A2_V_DEFAULT, V_INORDER, A2_V_GEOM }));
op->addTag(TAG_FTP);
op->addTag(TAG_HTTP);
op->setInitialOption(true);
@@ -1132,13 +1125,11 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op);
}
{
- const std::string params[] = { V_INORDER, V_FEEDBACK, V_ADAPTIVE };
OptionHandler* op(new ParameterOptionHandler
(PREF_URI_SELECTOR,
TEXT_URI_SELECTOR,
V_FEEDBACK,
- std::vector<std::string>
- (vbegin(params), vend(params))));
+ { V_INORDER, V_FEEDBACK, V_ADAPTIVE }));
op->addTag(TAG_FTP);
op->addTag(TAG_HTTP);
op->setInitialOption(true);
@@ -1404,7 +1395,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
(PREF_FTP_TYPE,
TEXT_FTP_TYPE,
V_BINARY,
- V_BINARY, V_ASCII));
+ { V_BINARY, V_ASCII }));
op->addTag(TAG_FTP);
op->setInitialOption(true);
op->setChangeGlobalOption(true);
@@ -1601,7 +1592,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
(PREF_PROXY_METHOD,
TEXT_PROXY_METHOD,
V_GET,
- V_GET, V_TUNNEL));
+ { V_GET, V_TUNNEL }));
op->addTag(TAG_FTP);
op->addTag(TAG_HTTP);
op->setInitialOption(true);
@@ -1750,7 +1741,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
(PREF_BT_MIN_CRYPTO_LEVEL,
TEXT_BT_MIN_CRYPTO_LEVEL,
V_PLAIN,
- V_PLAIN, V_ARC4));
+ { V_PLAIN, V_ARC4 }));
op->addTag(TAG_BITTORRENT);
op->setInitialOption(true);
op->setChangeGlobalOption(true);
@@ -2020,7 +2011,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
(PREF_FOLLOW_TORRENT,
TEXT_FOLLOW_TORRENT,
A2_V_TRUE,
- A2_V_TRUE, V_MEM, A2_V_FALSE));
+ { A2_V_TRUE, V_MEM, A2_V_FALSE }));
op->addTag(TAG_BITTORRENT);
op->setInitialOption(true);
op->setChangeGlobalOption(true);
@@ -2148,7 +2139,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
(PREF_FOLLOW_METALINK,
TEXT_FOLLOW_METALINK,
A2_V_TRUE,
- A2_V_TRUE, V_MEM, A2_V_FALSE));
+ { A2_V_TRUE, V_MEM, A2_V_FALSE }));
op->addTag(TAG_METALINK);
op->setInitialOption(true);
op->setChangeGlobalOption(true);
@@ -2209,13 +2200,11 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op);
}
{
- const std::string params[] = { V_HTTP, V_HTTPS, V_FTP, V_NONE };
OptionHandler* op(new ParameterOptionHandler
(PREF_METALINK_PREFERRED_PROTOCOL,
TEXT_METALINK_PREFERRED_PROTOCOL,
V_NONE,
- std::vector<std::string>
- (vbegin(params), vend(params))));
+ { V_HTTP, V_HTTPS, V_FTP, V_NONE }));
op->addTag(TAG_METALINK);
op->setInitialOption(true);
op->setChangeGlobalOption(true);