xmlServiceParser.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef NULLSOFT_WINAMP_XML_SERVICE_PARSER_HEADER
  2. #define NULLSOFT_WINAMP_XML_SERVICE_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 "./stringBuilder.h"
  9. #include <vector>
  10. class obj_xml;
  11. class OmService;
  12. class ifc_omservice;
  13. class ifc_omservicehost;
  14. class ifc_omstoragehandler;
  15. class ifc_omstoragehandlerenum;
  16. class XmlServiceParser : public ifc_xmlreadercallback
  17. {
  18. public:
  19. XmlServiceParser();
  20. ~XmlServiceParser();
  21. public:
  22. HRESULT Initialize(obj_xml *reader, LPCWSTR match, ifc_omservicehost *host);
  23. HRESULT Finish(HRESULT *parserResult, ifc_omservice **ppService);
  24. HRESULT GetActive();
  25. HRESULT RegisterHandlers(ifc_omstoragehandlerenum *handlerEnum);
  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::vector<ifc_omstoragehandler*> HandlerList;
  33. protected:
  34. StringBuilder buffer;
  35. HandlerList handlerList;
  36. BYTE *checkList;
  37. size_t checkSize;
  38. obj_xml *parser;
  39. OmService *service;
  40. HRESULT result;
  41. protected:
  42. RECVS_DISPATCH;
  43. };
  44. #endif// NULLSOFT_WINAMP_XML_SERVICE_PARSER_HEADER