OptionHandlerFactory.cc 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2006 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 "OptionHandlerFactory.h"
  36. #include "prefs.h"
  37. #include "OptionHandlerImpl.h"
  38. OptionHandlers OptionHandlerFactory::createOptionHandlers()
  39. {
  40. OptionHandlers handlers;
  41. handlers.push_back(new HttpProxyOptionHandler(PREF_HTTP_PROXY));
  42. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_USER));
  43. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_PASSWD));
  44. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_PROXY_USER));
  45. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_PROXY_PASSWD));
  46. handlers.push_back(new ParameterOptionHandler(PREF_HTTP_AUTH_SCHEME, V_BASIC));
  47. handlers.push_back(new DefaultOptionHandler(PREF_REFERER));
  48. handlers.push_back(new NumberOptionHandler(PREF_RETRY_WAIT, 0, 60));
  49. handlers.push_back(new DefaultOptionHandler(PREF_FTP_USER));
  50. handlers.push_back(new DefaultOptionHandler(PREF_FTP_PASSWD));
  51. handlers.push_back(new ParameterOptionHandler(PREF_FTP_TYPE, V_BINARY, V_ASCII));
  52. handlers.push_back(new ParameterOptionHandler(PREF_FTP_VIA_HTTP_PROXY,
  53. V_GET, V_TUNNEL));
  54. handlers.push_back(new UnitNumberOptionHandler(PREF_MIN_SEGMENT_SIZE, 1024));
  55. handlers.push_back(new ParameterOptionHandler(PREF_HTTP_PROXY_METHOD,
  56. V_GET, V_TUNNEL));
  57. handlers.push_back(new NumberOptionHandler(PREF_LISTEN_PORT, 1024, UINT16_MAX));
  58. handlers.push_back(new BooleanOptionHandler(PREF_FOLLOW_TORRENT));
  59. handlers.push_back(new BooleanOptionHandler(PREF_NO_PREALLOCATION));
  60. handlers.push_back(new BooleanOptionHandler(PREF_DIRECT_FILE_MAPPING));
  61. handlers.push_back(new DefaultOptionHandler(PREF_SELECT_FILE));
  62. handlers.push_back(new NumberOptionHandler(PREF_SEED_TIME, 0));
  63. handlers.push_back(new FloatNumberOptionHandler(PREF_SEED_RATIO, 0.0));
  64. handlers.push_back(new UnitNumberOptionHandler(PREF_MAX_UPLOAD_LIMIT, 0));
  65. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_VERSION));
  66. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_LANGUAGE));
  67. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_OS));
  68. handlers.push_back(new BooleanOptionHandler(PREF_FOLLOW_METALINK));
  69. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_LOCATION));
  70. handlers.push_back(new UnitNumberOptionHandler(PREF_LOWEST_SPEED_LIMIT, 0));
  71. handlers.push_back(new UnitNumberOptionHandler(PREF_MAX_DOWNLOAD_LIMIT, 0));
  72. handlers.push_back(new BooleanOptionHandler(PREF_ALLOW_OVERWRITE));
  73. handlers.push_back(new BooleanOptionHandler(PREF_CHECK_INTEGRITY));
  74. handlers.push_back(new BooleanOptionHandler(PREF_REALTIME_CHUNK_CHECKSUM));
  75. handlers.push_back(new BooleanOptionHandler(PREF_DAEMON));
  76. handlers.push_back(new DefaultOptionHandler(PREF_DIR));
  77. handlers.push_back(new DefaultOptionHandler(PREF_OUT));
  78. handlers.push_back(new LogOptionHandler(PREF_LOG));
  79. handlers.push_back(new NumberOptionHandler(PREF_SPLIT, 1, 5));
  80. handlers.push_back(new NumberOptionHandler(PREF_TIMEOUT, 1, 600));
  81. handlers.push_back(new NumberOptionHandler(PREF_MAX_TRIES, 0));
  82. handlers.push_back(new BooleanOptionHandler(PREF_FTP_PASV));
  83. handlers.push_back(new BooleanOptionHandler(PREF_SHOW_FILES));
  84. handlers.push_back(new DefaultOptionHandler(PREF_TORRENT_FILE));
  85. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_FILE));
  86. handlers.push_back(new NumberOptionHandler(PREF_METALINK_SERVERS, 1));
  87. handlers.push_back(new ParameterOptionHandler(PREF_FILE_ALLOCATION,
  88. V_NONE, V_PREALLOC));
  89. handlers.push_back(new BooleanOptionHandler(PREF_CONTINUE));
  90. handlers.push_back(new DefaultOptionHandler(PREF_USER_AGENT));
  91. handlers.push_back(new BooleanOptionHandler(PREF_NO_NETRC));
  92. handlers.push_back(new DefaultOptionHandler(PREF_INPUT_FILE));
  93. handlers.push_back(new NumberOptionHandler(PREF_MAX_CONCURRENT_DOWNLOADS, 1, 15));
  94. return handlers;
  95. }