XmlRpcRequestParserStateImpl.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2009 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_XML_RPC_REQUEST_PARSER_STATE_IMPL_H_
  36. #define _D_XML_RPC_REQUEST_PARSER_STATE_IMPL_H_
  37. #include "XmlRpcRequestParserState.h"
  38. namespace aria2 {
  39. namespace xmlrpc {
  40. class InitialXmlRpcRequestParserState:public XmlRpcRequestParserState {
  41. public:
  42. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  43. const std::string& name,
  44. const std::map<std::string, std::string>& attrs);
  45. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  46. const std::string& name,
  47. const std::string& characters);
  48. virtual bool needsCharactersBuffering() const { return false; }
  49. };
  50. class UnknownElementXmlRpcRequestParserState:public XmlRpcRequestParserState {
  51. public:
  52. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  53. const std::string& name,
  54. const std::map<std::string, std::string>& attrs);
  55. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  56. const std::string& name,
  57. const std::string& characters) {}
  58. virtual bool needsCharactersBuffering() const { return false; }
  59. };
  60. class MethodCallXmlRpcRequestParserState:public XmlRpcRequestParserState {
  61. public:
  62. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  63. const std::string& name,
  64. const std::map<std::string, std::string>& attrs);
  65. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  66. const std::string& name,
  67. const std::string& characters) {}
  68. virtual bool needsCharactersBuffering() const { return false; }
  69. };
  70. class MethodNameXmlRpcRequestParserState:public XmlRpcRequestParserState {
  71. public:
  72. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  73. const std::string& name,
  74. const std::map<std::string, std::string>& attrs);
  75. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  76. const std::string& name,
  77. const std::string& characters);
  78. virtual bool needsCharactersBuffering() const { return true; }
  79. };
  80. class ParamsXmlRpcRequestParserState:public XmlRpcRequestParserState {
  81. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  82. const std::string& name,
  83. const std::map<std::string, std::string>& attrs);
  84. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  85. const std::string& name,
  86. const std::string& characters) {}
  87. virtual bool needsCharactersBuffering() const { return false; }
  88. };
  89. class ParamXmlRpcRequestParserState:public XmlRpcRequestParserState {
  90. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  91. const std::string& name,
  92. const std::map<std::string, std::string>& attrs);
  93. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  94. const std::string& name,
  95. const std::string& characters);
  96. virtual bool needsCharactersBuffering() const { return false; }
  97. };
  98. class ValueXmlRpcRequestParserState:public XmlRpcRequestParserState {
  99. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  100. const std::string& name,
  101. const std::map<std::string, std::string>& attrs);
  102. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  103. const std::string& name,
  104. const std::string& characters) {}
  105. virtual bool needsCharactersBuffering() const { return false; }
  106. };
  107. class IntXmlRpcRequestParserState:public XmlRpcRequestParserState {
  108. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  109. const std::string& name,
  110. const std::map<std::string, std::string>& attrs);
  111. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  112. const std::string& name,
  113. const std::string& characters);
  114. virtual bool needsCharactersBuffering() const { return true; }
  115. };
  116. class StringXmlRpcRequestParserState:public XmlRpcRequestParserState {
  117. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  118. const std::string& name,
  119. const std::map<std::string, std::string>& attrs);
  120. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  121. const std::string& name,
  122. const std::string& characters);
  123. virtual bool needsCharactersBuffering() const { return true; }
  124. };
  125. class Base64XmlRpcRequestParserState:public XmlRpcRequestParserState {
  126. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  127. const std::string& name,
  128. const std::map<std::string, std::string>& attrs);
  129. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  130. const std::string& name,
  131. const std::string& characters);
  132. virtual bool needsCharactersBuffering() const { return true; }
  133. };
  134. class StructXmlRpcRequestParserState:public XmlRpcRequestParserState {
  135. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  136. const std::string& name,
  137. const std::map<std::string, std::string>& attrs);
  138. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  139. const std::string& name,
  140. const std::string& characters) {}
  141. virtual bool needsCharactersBuffering() const { return false; }
  142. };
  143. class MemberXmlRpcRequestParserState:public XmlRpcRequestParserState {
  144. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  145. const std::string& name,
  146. const std::map<std::string, std::string>& attrs);
  147. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  148. const std::string& name,
  149. const std::string& characters);
  150. virtual bool needsCharactersBuffering() const { return false; }
  151. };
  152. class NameXmlRpcRequestParserState:public XmlRpcRequestParserState {
  153. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  154. const std::string& name,
  155. const std::map<std::string, std::string>& attrs);
  156. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  157. const std::string& name,
  158. const std::string& characters);
  159. virtual bool needsCharactersBuffering() const { return true; }
  160. };
  161. class ArrayXmlRpcRequestParserState:public XmlRpcRequestParserState {
  162. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  163. const std::string& name,
  164. const std::map<std::string, std::string>& attrs);
  165. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  166. const std::string& name,
  167. const std::string& characters) {}
  168. virtual bool needsCharactersBuffering() const { return false; }
  169. };
  170. class DataXmlRpcRequestParserState:public XmlRpcRequestParserState {
  171. virtual void beginElement(XmlRpcRequestParserStateMachine* stm,
  172. const std::string& name,
  173. const std::map<std::string, std::string>& attrs);
  174. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  175. const std::string& name,
  176. const std::string& characters) {}
  177. virtual bool needsCharactersBuffering() const { return false; }
  178. };
  179. class ArrayValueXmlRpcRequestParserState:public ValueXmlRpcRequestParserState {
  180. virtual void endElement(XmlRpcRequestParserStateMachine* stm,
  181. const std::string& name,
  182. const std::string& characters);
  183. };
  184. } // namespace xmlrpc
  185. } // namespace aria2
  186. #endif // _D_XML_RPC_REQUEST_PARSER_STATE_IMPL_H_