1
0

xmlResponseParser.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef NULLSOFT_WINAMP_XML_RESPONSE_PARSER_HEADER
  2. #define NULLSOFT_WINAMP_XML_RESPONSE_PARSER_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include "../xml/ifc_xmlreadercallback.h"
  8. #include "./xmlServiceParser.h"
  9. #include "./stringBuilder.h"
  10. #include <deque>
  11. class obj_xml;
  12. class ifc_omservicehost;
  13. class ifc_omstorage;
  14. class XmlResponseParser : public ifc_xmlreadercallback
  15. {
  16. public:
  17. XmlResponseParser();
  18. ~XmlResponseParser();
  19. public:
  20. HRESULT Initialize(obj_xml *xml, ifc_omservicehost *serviceHost);
  21. HRESULT Finish();
  22. HRESULT Reset();
  23. HRESULT GetCode(UINT *value);
  24. HRESULT GetText(LPWSTR pszBuffer, UINT cchBufferMax);
  25. HRESULT PeekService(ifc_omservice **service);
  26. protected:
  27. void OnStartElement(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params);
  28. void OnEndElement(const wchar_t *xmlpath, const wchar_t *xmltag);
  29. void OnCharData(const wchar_t *xmlpath, const wchar_t *xmltag, const wchar_t *str);
  30. void OnError(int linenum, int errcode, const wchar_t *errstr);
  31. protected:
  32. typedef std::deque<ifc_omservice*> ServiceDeque;
  33. protected:
  34. obj_xml *reader;
  35. UINT code;
  36. LPWSTR text;
  37. XmlServiceParser parser;
  38. ifc_omservicehost *host;
  39. ServiceDeque deque;
  40. StringBuilder string;
  41. protected:
  42. RECVS_DISPATCH;
  43. };
  44. #endif// NULLSOFT_WINAMP_XML_RESPONSE_PARSER_HEADER