OptionHandlerImpl.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2010 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "OptionHandlerImpl.h"
  36. #include <cassert>
  37. #include <cstdio>
  38. #include <cstring>
  39. #include <utility>
  40. #include <algorithm>
  41. #include <numeric>
  42. #include <sstream>
  43. #include <iterator>
  44. #include <vector>
  45. #include "util.h"
  46. #include "DlAbortEx.h"
  47. #include "prefs.h"
  48. #include "Option.h"
  49. #include "fmt.h"
  50. #include "A2STR.h"
  51. #include "Request.h"
  52. #include "a2functional.h"
  53. #include "message.h"
  54. #include "File.h"
  55. #include "FileEntry.h"
  56. #include "a2io.h"
  57. #include "LogFactory.h"
  58. #include "uri.h"
  59. #include "SegList.h"
  60. #include "array_fun.h"
  61. #ifdef ENABLE_MESSAGE_DIGEST
  62. # include "MessageDigest.h"
  63. #endif // ENABLE_MESSAGE_DIGEST
  64. namespace aria2 {
  65. BooleanOptionHandler::BooleanOptionHandler
  66. (const Pref* pref,
  67. const char* description,
  68. const std::string& defaultValue,
  69. OptionHandler::ARG_TYPE argType,
  70. char shortName)
  71. : AbstractOptionHandler(pref, description, defaultValue,
  72. argType, shortName)
  73. {}
  74. BooleanOptionHandler::~BooleanOptionHandler() {}
  75. void BooleanOptionHandler::parseArg(Option& option, const std::string& optarg)
  76. {
  77. if(optarg == "true" ||
  78. ((argType_ == OptionHandler::OPT_ARG ||
  79. argType_ == OptionHandler::NO_ARG)
  80. && optarg.empty())) {
  81. option.put(pref_, A2_V_TRUE);
  82. } else if(optarg == "false") {
  83. option.put(pref_, A2_V_FALSE);
  84. } else {
  85. std::string msg = pref_->k;
  86. msg += " ";
  87. msg += _("must be either 'true' or 'false'.");
  88. throw DL_ABORT_EX(msg);
  89. }
  90. }
  91. std::string BooleanOptionHandler::createPossibleValuesString() const
  92. {
  93. return "true, false";
  94. }
  95. IntegerRangeOptionHandler::IntegerRangeOptionHandler
  96. (const Pref* pref,
  97. const char* description,
  98. const std::string& defaultValue,
  99. int32_t min, int32_t max,
  100. char shortName)
  101. : AbstractOptionHandler(pref, description, defaultValue,
  102. OptionHandler::REQ_ARG, shortName),
  103. min_(min),
  104. max_(max)
  105. {}
  106. IntegerRangeOptionHandler::~IntegerRangeOptionHandler() {}
  107. void IntegerRangeOptionHandler::parseArg
  108. (Option& option, const std::string& optarg)
  109. {
  110. SegList<int> sgl;
  111. util::parseIntSegments(sgl, optarg);
  112. sgl.normalize();
  113. while(sgl.hasNext()) {
  114. int v = sgl.next();
  115. if(v < min_ || max_ < v) {
  116. std::string msg = pref_->k;
  117. msg += " ";
  118. msg += _("must be between %d and %d.");
  119. throw DL_ABORT_EX(fmt(msg.c_str(), min_, max_));
  120. }
  121. option.put(pref_, optarg);
  122. }
  123. }
  124. std::string IntegerRangeOptionHandler::createPossibleValuesString() const
  125. {
  126. return fmt("%d-%d", min_, max_);
  127. }
  128. NumberOptionHandler::NumberOptionHandler
  129. (const Pref* pref,
  130. const char* description,
  131. const std::string& defaultValue,
  132. int64_t min,
  133. int64_t max,
  134. char shortName)
  135. : AbstractOptionHandler(pref, description, defaultValue,
  136. OptionHandler::REQ_ARG, shortName),
  137. min_(min),
  138. max_(max)
  139. {}
  140. NumberOptionHandler::~NumberOptionHandler() {}
  141. void NumberOptionHandler::parseArg(Option& option, const std::string& optarg)
  142. {
  143. parseArg(option, util::parseLLInt(optarg));
  144. }
  145. void NumberOptionHandler::parseArg(Option& option, int64_t number)
  146. {
  147. if((min_ == -1 || min_ <= number) && (max_ == -1 || number <= max_)) {
  148. option.put(pref_, util::itos(number));
  149. } else {
  150. std::string msg = pref_->k;
  151. msg += " ";
  152. if(min_ == -1 && max_ != -1) {
  153. msg += fmt(_("must be smaller than or equal to %" PRId64 "."), max_);
  154. } else if(min_ != -1 && max_ != -1) {
  155. msg += fmt(_("must be between %" PRId64 " and %" PRId64 "."),
  156. min_, max_);
  157. } else if(min_ != -1 && max_ == -1) {
  158. msg += fmt(_("must be greater than or equal to %" PRId64 "."), min_);
  159. } else {
  160. msg += _("must be a number.");
  161. }
  162. throw DL_ABORT_EX(msg);
  163. }
  164. }
  165. std::string NumberOptionHandler::createPossibleValuesString() const
  166. {
  167. std::string values;
  168. if(min_ == -1) {
  169. values += "*";
  170. } else {
  171. values += util::itos(min_);
  172. }
  173. values += "-";
  174. if(max_ == -1) {
  175. values += "*";
  176. } else {
  177. values += util::itos(max_);
  178. }
  179. return values;
  180. }
  181. UnitNumberOptionHandler::UnitNumberOptionHandler
  182. (const Pref* pref,
  183. const char* description,
  184. const std::string& defaultValue,
  185. int64_t min,
  186. int64_t max,
  187. char shortName)
  188. : NumberOptionHandler(pref, description, defaultValue, min, max,
  189. shortName)
  190. {}
  191. UnitNumberOptionHandler::~UnitNumberOptionHandler() {}
  192. void UnitNumberOptionHandler::parseArg
  193. (Option& option, const std::string& optarg)
  194. {
  195. int64_t num = util::getRealSize(optarg);
  196. NumberOptionHandler::parseArg(option, num);
  197. }
  198. FloatNumberOptionHandler::FloatNumberOptionHandler
  199. (const Pref* pref,
  200. const char* description,
  201. const std::string& defaultValue,
  202. double min,
  203. double max,
  204. char shortName)
  205. : AbstractOptionHandler(pref, description, defaultValue,
  206. OptionHandler::REQ_ARG, shortName),
  207. min_(min),
  208. max_(max)
  209. {}
  210. FloatNumberOptionHandler::~FloatNumberOptionHandler() {}
  211. void FloatNumberOptionHandler::parseArg
  212. (Option& option, const std::string& optarg)
  213. {
  214. double number = strtod(optarg.c_str(), 0);
  215. if((min_ < 0 || min_ <= number) && (max_ < 0 || number <= max_)) {
  216. option.put(pref_, optarg);
  217. } else {
  218. std::string msg = pref_->k;
  219. msg += " ";
  220. if(min_ < 0 && max_ >= 0) {
  221. msg += fmt(_("must be smaller than or equal to %.1f."), max_);
  222. } else if(min_ >= 0 && max_ >= 0) {
  223. msg += fmt(_("must be between %.1f and %.1f."), min_, max_);
  224. } else if(min_ >= 0 && max_ < 0) {
  225. msg += fmt(_("must be greater than or equal to %.1f."), min_);
  226. } else {
  227. msg += _("must be a number.");
  228. }
  229. throw DL_ABORT_EX(msg);
  230. }
  231. }
  232. std::string FloatNumberOptionHandler::createPossibleValuesString() const
  233. {
  234. std::string valuesString;
  235. if(min_ < 0) {
  236. valuesString += "*";
  237. } else {
  238. valuesString += fmt("%.1f", min_);
  239. }
  240. valuesString += "-";
  241. if(max_ < 0) {
  242. valuesString += "*";
  243. } else {
  244. valuesString += fmt("%.1f", max_);
  245. }
  246. return valuesString;
  247. }
  248. DefaultOptionHandler::DefaultOptionHandler
  249. (const Pref* pref,
  250. const char* description,
  251. const std::string& defaultValue,
  252. const std::string& possibleValuesString,
  253. OptionHandler::ARG_TYPE argType,
  254. char shortName)
  255. : AbstractOptionHandler(pref, description, defaultValue, argType,
  256. shortName),
  257. possibleValuesString_(possibleValuesString)
  258. {}
  259. DefaultOptionHandler::~DefaultOptionHandler() {}
  260. void DefaultOptionHandler::parseArg(Option& option, const std::string& optarg)
  261. {
  262. option.put(pref_, optarg);
  263. }
  264. std::string DefaultOptionHandler::createPossibleValuesString() const
  265. {
  266. return possibleValuesString_;
  267. }
  268. CumulativeOptionHandler::CumulativeOptionHandler
  269. (const Pref* pref,
  270. const char* description,
  271. const std::string& defaultValue,
  272. const std::string& delim,
  273. const std::string& possibleValuesString,
  274. OptionHandler::ARG_TYPE argType,
  275. char shortName)
  276. : AbstractOptionHandler(pref, description, defaultValue, argType,
  277. shortName),
  278. delim_(delim),
  279. possibleValuesString_(possibleValuesString)
  280. {}
  281. CumulativeOptionHandler::~CumulativeOptionHandler() {}
  282. void CumulativeOptionHandler::parseArg
  283. (Option& option, const std::string& optarg)
  284. {
  285. std::string value = option.get(pref_);
  286. value += optarg;
  287. value += delim_;
  288. option.put(pref_, value);
  289. }
  290. std::string CumulativeOptionHandler::createPossibleValuesString() const
  291. {
  292. return possibleValuesString_;
  293. }
  294. IndexOutOptionHandler::IndexOutOptionHandler
  295. (const Pref* pref,
  296. const char* description,
  297. char shortName)
  298. : AbstractOptionHandler(pref, description, NO_DEFAULT_VALUE,
  299. OptionHandler::REQ_ARG, shortName)
  300. {}
  301. IndexOutOptionHandler::~IndexOutOptionHandler() {}
  302. void IndexOutOptionHandler::parseArg(Option& option, const std::string& optarg)
  303. {
  304. // See optarg is in the fomrat of "INDEX=PATH"
  305. util::parseIndexPath(optarg);
  306. std::string value = option.get(pref_);
  307. value += optarg;
  308. value += "\n";
  309. option.put(pref_, value);
  310. }
  311. std::string IndexOutOptionHandler::createPossibleValuesString() const
  312. {
  313. return "INDEX=PATH";
  314. }
  315. #ifdef ENABLE_MESSAGE_DIGEST
  316. ChecksumOptionHandler::ChecksumOptionHandler
  317. (const Pref* pref,
  318. const char* description,
  319. char shortName)
  320. : AbstractOptionHandler(pref, description, NO_DEFAULT_VALUE,
  321. OptionHandler::REQ_ARG, shortName)
  322. {}
  323. ChecksumOptionHandler::~ChecksumOptionHandler() {}
  324. void ChecksumOptionHandler::parseArg(Option& option, const std::string& optarg)
  325. {
  326. std::pair<Scip, Scip> p;
  327. util::divide(p, optarg.begin(), optarg.end(), '=');
  328. std::string hashType(p.first.first, p.first.second);
  329. std::string hexDigest(p.second.first, p.second.second);
  330. util::lowercase(hashType);
  331. util::lowercase(hexDigest);
  332. if(!MessageDigest::isValidHash(hashType, hexDigest)) {
  333. throw DL_ABORT_EX(_("Unrecognized checksum"));
  334. }
  335. option.put(pref_, optarg);
  336. }
  337. std::string ChecksumOptionHandler::createPossibleValuesString() const
  338. {
  339. return "HASH_TYPE=HEX_DIGEST";
  340. }
  341. #endif // ENABLE_MESSAGE_DIGEST
  342. ParameterOptionHandler::ParameterOptionHandler
  343. (const Pref* pref,
  344. const char* description,
  345. const std::string& defaultValue,
  346. const std::vector<std::string>& validParamValues,
  347. char shortName)
  348. : AbstractOptionHandler(pref, description, defaultValue,
  349. OptionHandler::REQ_ARG, shortName),
  350. validParamValues_(validParamValues)
  351. {}
  352. ParameterOptionHandler::ParameterOptionHandler
  353. (const Pref* pref,
  354. const char* description,
  355. const std::string& defaultValue,
  356. const std::string& validParamValue,
  357. char shortName)
  358. : AbstractOptionHandler(pref, description, defaultValue,
  359. OptionHandler::REQ_ARG, shortName)
  360. {
  361. validParamValues_.push_back(validParamValue);
  362. }
  363. ParameterOptionHandler::ParameterOptionHandler
  364. (const Pref* pref,
  365. const char* description,
  366. const std::string& defaultValue,
  367. const std::string& validParamValue1,
  368. const std::string& validParamValue2,
  369. char shortName)
  370. : AbstractOptionHandler(pref, description, defaultValue,
  371. OptionHandler::REQ_ARG, shortName)
  372. {
  373. validParamValues_.push_back(validParamValue1);
  374. validParamValues_.push_back(validParamValue2);
  375. }
  376. ParameterOptionHandler::ParameterOptionHandler
  377. (const Pref* pref,
  378. const char* description,
  379. const std::string& defaultValue,
  380. const std::string& validParamValue1,
  381. const std::string& validParamValue2,
  382. const std::string& validParamValue3,
  383. char shortName)
  384. : AbstractOptionHandler(pref, description, defaultValue,
  385. OptionHandler::REQ_ARG, shortName)
  386. {
  387. validParamValues_.push_back(validParamValue1);
  388. validParamValues_.push_back(validParamValue2);
  389. validParamValues_.push_back(validParamValue3);
  390. }
  391. ParameterOptionHandler::~ParameterOptionHandler() {}
  392. void ParameterOptionHandler::parseArg(Option& option, const std::string& optarg)
  393. {
  394. std::vector<std::string>::const_iterator itr =
  395. std::find(validParamValues_.begin(), validParamValues_.end(), optarg);
  396. if(itr == validParamValues_.end()) {
  397. std::string msg = pref_->k;
  398. msg += " ";
  399. msg += _("must be one of the following:");
  400. if(validParamValues_.size() == 0) {
  401. msg += "''";
  402. } else {
  403. for(std::vector<std::string>::const_iterator itr =
  404. validParamValues_.begin(), eoi = validParamValues_.end();
  405. itr != eoi; ++itr) {
  406. msg += "'";
  407. msg += *itr;
  408. msg += "' ";
  409. }
  410. }
  411. throw DL_ABORT_EX(msg);
  412. } else {
  413. option.put(pref_, optarg);
  414. }
  415. }
  416. std::string ParameterOptionHandler::createPossibleValuesString() const
  417. {
  418. std::stringstream s;
  419. std::copy(validParamValues_.begin(), validParamValues_.end(),
  420. std::ostream_iterator<std::string>(s, ", "));
  421. return util::strip(s.str(), ", ");
  422. }
  423. HostPortOptionHandler::HostPortOptionHandler
  424. (const Pref* pref,
  425. const char* description,
  426. const std::string& defaultValue,
  427. const Pref* hostOptionName,
  428. const Pref* portOptionName,
  429. char shortName)
  430. : AbstractOptionHandler(pref, description, defaultValue,
  431. OptionHandler::REQ_ARG, shortName),
  432. hostOptionName_(hostOptionName),
  433. portOptionName_(portOptionName)
  434. {}
  435. HostPortOptionHandler::~HostPortOptionHandler() {}
  436. void HostPortOptionHandler::parseArg(Option& option, const std::string& optarg)
  437. {
  438. std::string uri = "http://";
  439. uri += optarg;
  440. Request req;
  441. if(!req.setUri(uri)) {
  442. throw DL_ABORT_EX(_("Unrecognized format"));
  443. }
  444. option.put(pref_, optarg);
  445. setHostAndPort(option, req.getHost(), req.getPort());
  446. }
  447. void HostPortOptionHandler::setHostAndPort
  448. (Option& option, const std::string& hostname, uint16_t port)
  449. {
  450. option.put(hostOptionName_, hostname);
  451. option.put(portOptionName_, util::uitos(port));
  452. }
  453. std::string HostPortOptionHandler::createPossibleValuesString() const
  454. {
  455. return "HOST:PORT";
  456. }
  457. HttpProxyOptionHandler::HttpProxyOptionHandler
  458. (const Pref* pref,
  459. const char* description,
  460. const std::string& defaultValue,
  461. char shortName)
  462. : AbstractOptionHandler(pref, description, defaultValue,
  463. OptionHandler::REQ_ARG, shortName),
  464. proxyUserPref_(option::k2p(std::string(pref->k)+"-user")),
  465. proxyPasswdPref_(option::k2p(std::string(pref->k)+"-passwd"))
  466. {}
  467. HttpProxyOptionHandler::~HttpProxyOptionHandler() {}
  468. void HttpProxyOptionHandler::parseArg(Option& option, const std::string& optarg)
  469. {
  470. if(optarg.empty()) {
  471. option.put(pref_, optarg);
  472. } else {
  473. std::string uri;
  474. if(util::startsWith(optarg, "http://") ||
  475. util::startsWith(optarg, "https://") ||
  476. util::startsWith(optarg, "ftp://")) {
  477. uri = optarg;
  478. } else {
  479. uri = "http://";
  480. uri += optarg;
  481. }
  482. uri::UriStruct us;
  483. if(!uri::parse(us, uri)) {
  484. throw DL_ABORT_EX(_("unrecognized proxy format"));
  485. }
  486. us.protocol = "http";
  487. option.put(pref_, uri::construct(us));
  488. }
  489. }
  490. std::string HttpProxyOptionHandler::createPossibleValuesString() const
  491. {
  492. return "[http://][USER:PASSWORD@]HOST[:PORT]";
  493. }
  494. LocalFilePathOptionHandler::LocalFilePathOptionHandler
  495. (const Pref* pref,
  496. const char* description,
  497. const std::string& defaultValue,
  498. bool acceptStdin,
  499. char shortName)
  500. : AbstractOptionHandler(pref, description, defaultValue,
  501. OptionHandler::REQ_ARG, shortName),
  502. acceptStdin_(acceptStdin)
  503. {}
  504. void LocalFilePathOptionHandler::parseArg
  505. (Option& option, const std::string& optarg)
  506. {
  507. if(acceptStdin_ && optarg == "-") {
  508. option.put(pref_, DEV_STDIN);
  509. } else {
  510. File f(optarg);
  511. if(!f.exists() || f.isDir()) {
  512. throw DL_ABORT_EX(fmt(MSG_NOT_FILE, optarg.c_str()));
  513. }
  514. option.put(pref_, optarg);
  515. }
  516. }
  517. std::string LocalFilePathOptionHandler::createPossibleValuesString() const
  518. {
  519. if(acceptStdin_) {
  520. return PATH_TO_FILE_STDIN;
  521. } else {
  522. return PATH_TO_FILE;
  523. }
  524. }
  525. PrioritizePieceOptionHandler::PrioritizePieceOptionHandler
  526. (const Pref* pref,
  527. const char* description,
  528. const std::string& defaultValue,
  529. char shortName)
  530. : AbstractOptionHandler(pref, description, defaultValue,
  531. OptionHandler::REQ_ARG, shortName)
  532. {}
  533. void PrioritizePieceOptionHandler::parseArg
  534. (Option& option, const std::string& optarg)
  535. {
  536. // Parse optarg against empty FileEntry list to detect syntax
  537. // error.
  538. std::vector<size_t> result;
  539. util::parsePrioritizePieceRange
  540. (result, optarg, std::vector<SharedHandle<FileEntry> >(), 1024);
  541. option.put(pref_, optarg);
  542. }
  543. std::string PrioritizePieceOptionHandler::createPossibleValuesString() const
  544. {
  545. return "head[=SIZE], tail[=SIZE]";
  546. }
  547. DeprecatedOptionHandler::DeprecatedOptionHandler
  548. (const SharedHandle<OptionHandler>& depOptHandler,
  549. const SharedHandle<OptionHandler>& repOptHandler)
  550. : depOptHandler_(depOptHandler), repOptHandler_(repOptHandler)
  551. {}
  552. void DeprecatedOptionHandler::parse(Option& option, const std::string& arg)
  553. {
  554. if(repOptHandler_) {
  555. A2_LOG_WARN(fmt(_("--%s option is deprecated. Use --%s option instead."),
  556. depOptHandler_->getName(),
  557. repOptHandler_->getName()));
  558. repOptHandler_->parse(option, arg);
  559. } else {
  560. A2_LOG_WARN(fmt(_("--%s option is deprecated."),
  561. depOptHandler_->getName()));
  562. }
  563. }
  564. std::string DeprecatedOptionHandler::createPossibleValuesString() const
  565. {
  566. return depOptHandler_->createPossibleValuesString();
  567. }
  568. bool DeprecatedOptionHandler::hasTag(const std::string& tag) const
  569. {
  570. return depOptHandler_->hasTag(tag);
  571. }
  572. void DeprecatedOptionHandler::addTag(const std::string& tag)
  573. {
  574. depOptHandler_->addTag(tag);
  575. }
  576. std::string DeprecatedOptionHandler::toTagString() const
  577. {
  578. return depOptHandler_->toTagString();
  579. }
  580. const char* DeprecatedOptionHandler::getName() const
  581. {
  582. return depOptHandler_->getName();
  583. }
  584. const char* DeprecatedOptionHandler::getDescription() const
  585. {
  586. return depOptHandler_->getDescription();
  587. }
  588. const std::string& DeprecatedOptionHandler::getDefaultValue() const
  589. {
  590. return depOptHandler_->getDefaultValue();
  591. }
  592. bool DeprecatedOptionHandler::isHidden() const
  593. {
  594. return depOptHandler_->isHidden();
  595. }
  596. void DeprecatedOptionHandler::hide()
  597. {
  598. depOptHandler_->hide();
  599. }
  600. const Pref* DeprecatedOptionHandler::getPref() const
  601. {
  602. return depOptHandler_->getPref();
  603. }
  604. OptionHandler::ARG_TYPE DeprecatedOptionHandler::getArgType() const
  605. {
  606. return depOptHandler_->getArgType();
  607. }
  608. char DeprecatedOptionHandler::getShortName() const
  609. {
  610. return depOptHandler_->getShortName();
  611. }
  612. bool DeprecatedOptionHandler::getEraseAfterParse() const
  613. {
  614. return depOptHandler_->getEraseAfterParse();
  615. }
  616. void DeprecatedOptionHandler::setEraseAfterParse(bool eraseAfterParse)
  617. {
  618. depOptHandler_->setEraseAfterParse(eraseAfterParse);
  619. }
  620. bool DeprecatedOptionHandler::getInitialOption() const
  621. {
  622. return depOptHandler_->getInitialOption();
  623. }
  624. void DeprecatedOptionHandler::setInitialOption(bool f)
  625. {
  626. depOptHandler_->setInitialOption(f);
  627. }
  628. bool DeprecatedOptionHandler::getChangeOption() const
  629. {
  630. return depOptHandler_->getChangeOption();
  631. }
  632. void DeprecatedOptionHandler::setChangeOption(bool f)
  633. {
  634. depOptHandler_->setChangeOption(f);
  635. }
  636. bool DeprecatedOptionHandler::getChangeOptionForReserved() const
  637. {
  638. return depOptHandler_->getChangeOptionForReserved();
  639. }
  640. void DeprecatedOptionHandler::setChangeOptionForReserved(bool f)
  641. {
  642. depOptHandler_->setChangeOptionForReserved(f);
  643. }
  644. bool DeprecatedOptionHandler::getChangeGlobalOption() const
  645. {
  646. return depOptHandler_->getChangeGlobalOption();
  647. }
  648. void DeprecatedOptionHandler::setChangeGlobalOption(bool f)
  649. {
  650. depOptHandler_->setChangeGlobalOption(f);
  651. }
  652. bool DeprecatedOptionHandler::getCumulative() const
  653. {
  654. return depOptHandler_->getCumulative();
  655. }
  656. void DeprecatedOptionHandler::setCumulative(bool f)
  657. {
  658. depOptHandler_->setCumulative(f);
  659. }
  660. } // namespace aria2