MetalinkParserStateV4Impl.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. #ifndef _D_METALINK_PARSER_STATE_V4_IMPL_H_
  36. #define _D_METALINK_PARSER_STATE_V4_IMPL_H_
  37. #include "MetalinkParserState.h"
  38. #include "MetalinkParserStateImpl.h"
  39. namespace aria2 {
  40. extern const std::string METALINK4_NAMESPACE_URI;
  41. class MetalinkMetalinkParserStateV4:public MetalinkParserState
  42. {
  43. public:
  44. virtual void beginElement(MetalinkParserStateMachine* stm,
  45. const std::string& localname,
  46. const std::string& prefix,
  47. const std::string& nsUri,
  48. const std::vector<XmlAttr>& attrs);
  49. };
  50. class FileMetalinkParserStateV4:public MetalinkParserState
  51. {
  52. public:
  53. virtual void beginElement(MetalinkParserStateMachine* stm,
  54. const std::string& localname,
  55. const std::string& prefix,
  56. const std::string& nsUri,
  57. const std::vector<XmlAttr>& attrs);
  58. virtual void endElement(MetalinkParserStateMachine* stm,
  59. const std::string& localname,
  60. const std::string& prefix,
  61. const std::string& nsUri,
  62. const std::string& characters);
  63. virtual bool needsCharactersBuffering() const
  64. {
  65. return true;
  66. }
  67. };
  68. class SizeMetalinkParserStateV4:public SkipTagMetalinkParserState
  69. {
  70. public:
  71. virtual void endElement(MetalinkParserStateMachine* stm,
  72. const std::string& localname,
  73. const std::string& prefix,
  74. const std::string& nsUri,
  75. const std::string& characters);
  76. virtual bool needsCharactersBuffering() const
  77. {
  78. return true;
  79. }
  80. };
  81. class VersionMetalinkParserStateV4:public SkipTagMetalinkParserState
  82. {
  83. public:
  84. virtual void endElement(MetalinkParserStateMachine* stm,
  85. const std::string& localname,
  86. const std::string& prefix,
  87. const std::string& nsUri,
  88. const std::string& characters);
  89. virtual bool needsCharactersBuffering() const
  90. {
  91. return true;
  92. }
  93. };
  94. class LanguageMetalinkParserStateV4:public SkipTagMetalinkParserState
  95. {
  96. public:
  97. virtual void endElement(MetalinkParserStateMachine* stm,
  98. const std::string& localname,
  99. const std::string& prefix,
  100. const std::string& nsUri,
  101. const std::string& characters);
  102. virtual bool needsCharactersBuffering() const
  103. {
  104. return true;
  105. }
  106. };
  107. class OSMetalinkParserStateV4:public SkipTagMetalinkParserState
  108. {
  109. public:
  110. virtual void endElement(MetalinkParserStateMachine* stm,
  111. const std::string& localname,
  112. const std::string& prefix,
  113. const std::string& nsUri,
  114. const std::string& characters);
  115. virtual bool needsCharactersBuffering() const
  116. {
  117. return true;
  118. }
  119. };
  120. class HashMetalinkParserStateV4:public SkipTagMetalinkParserState
  121. {
  122. public:
  123. virtual void endElement(MetalinkParserStateMachine* stm,
  124. const std::string& localname,
  125. const std::string& prefix,
  126. const std::string& nsUri,
  127. const std::string& characters);
  128. virtual bool needsCharactersBuffering() const
  129. {
  130. return true;
  131. }
  132. };
  133. class PiecesMetalinkParserStateV4:public MetalinkParserState
  134. {
  135. public:
  136. virtual void beginElement(MetalinkParserStateMachine* stm,
  137. const std::string& localname,
  138. const std::string& prefix,
  139. const std::string& nsUri,
  140. const std::vector<XmlAttr>& attrs);
  141. virtual void endElement(MetalinkParserStateMachine* stm,
  142. const std::string& localname,
  143. const std::string& prefix,
  144. const std::string& nsUri,
  145. const std::string& characters);
  146. virtual bool needsCharactersBuffering() const
  147. {
  148. return true;
  149. }
  150. };
  151. class PieceHashMetalinkParserStateV4:public SkipTagMetalinkParserState
  152. {
  153. public:
  154. virtual void endElement(MetalinkParserStateMachine* stm,
  155. const std::string& localname,
  156. const std::string& prefix,
  157. const std::string& nsUri,
  158. const std::string& characters);
  159. virtual bool needsCharactersBuffering() const
  160. {
  161. return true;
  162. }
  163. };
  164. class SignatureMetalinkParserStateV4:public SkipTagMetalinkParserState
  165. {
  166. public:
  167. virtual void endElement(MetalinkParserStateMachine* stm,
  168. const std::string& localname,
  169. const std::string& prefix,
  170. const std::string& nsUri,
  171. const std::string& characters);
  172. virtual bool needsCharactersBuffering() const
  173. {
  174. return true;
  175. }
  176. };
  177. class URLMetalinkParserStateV4:public SkipTagMetalinkParserState
  178. {
  179. public:
  180. virtual void endElement(MetalinkParserStateMachine* stm,
  181. const std::string& localname,
  182. const std::string& prefix,
  183. const std::string& nsUri,
  184. const std::string& characters);
  185. virtual bool needsCharactersBuffering() const
  186. {
  187. return true;
  188. }
  189. };
  190. class MetaurlMetalinkParserStateV4:public SkipTagMetalinkParserState
  191. {
  192. public:
  193. virtual void endElement(MetalinkParserStateMachine* stm,
  194. const std::string& localname,
  195. const std::string& prefix,
  196. const std::string& nsUri,
  197. const std::string& characters);
  198. virtual bool needsCharactersBuffering() const
  199. {
  200. return true;
  201. }
  202. };
  203. } // namespace aria2
  204. #endif // _D_METALINK_PARSER_STATE_IMPL_H_