deviceParser.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _NULLSOFT_WINAMP_GEN_DEVICE_PROVIDER_DEVICE_PARSER_HEADER
  2. #define _NULLSOFT_WINAMP_GEN_DEVICE_PROVIDER_DEVICE_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 "./device.h"
  9. class obj_xml;
  10. #define DEVICE_TAG_MAX 9
  11. class DeviceParser : public ifc_xmlreadercallback
  12. {
  13. public:
  14. DeviceParser();
  15. ~DeviceParser();
  16. public:
  17. BOOL Begin(obj_xml *reader, ifc_xmlreaderparams *params);
  18. BOOL End(obj_xml *reader, Device **result);
  19. protected:
  20. void Event_XmlStartElement(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params);
  21. void Event_XmlEndElement(const wchar_t *xmlpath, const wchar_t *xmltag);
  22. void Event_XmlCharData(const wchar_t *xmlpath, const wchar_t *xmltag, const wchar_t *value);
  23. void Event_XmlError(int linenum, int errcode, const wchar_t *errstr);
  24. protected:
  25. friend static void DeviceParser_IconCb(DeviceParser *self, Device *device, const wchar_t *value);
  26. friend static void DeviceParser_ConnectionCb(DeviceParser *self, Device *device, const wchar_t *value);
  27. friend static void DeviceParser_DisplayNameCb(DeviceParser *self, Device *device, const wchar_t *value);
  28. friend static void DeviceParser_TotalSpaceCb(DeviceParser *self, Device *device, const wchar_t *value);
  29. friend static void DeviceParser_UsedSpaceCb(DeviceParser *self, Device *device, const wchar_t *value);
  30. friend static void DeviceParser_HiddenCb(DeviceParser *self, Device *device, const wchar_t *value);
  31. friend static void DeviceParser_CommandCb(DeviceParser *self, Device *device, const wchar_t *value);
  32. friend static void DeviceParser_ModelCb(DeviceParser *self, Device *device, const wchar_t *value);
  33. friend static void DeviceParser_StatusCb(DeviceParser *self, Device *device, const wchar_t *value);
  34. protected:
  35. StringBuilder elementString;
  36. Device *device;
  37. BOOL hitList[DEVICE_TAG_MAX];
  38. SIZE iconSize;
  39. DeviceCommandFlags commandFlags;
  40. protected:
  41. RECVS_DISPATCH;
  42. };
  43. #endif // _NULLSOFT_WINAMP_GEN_DEVICE_PROVIDER_DEVICE_PARSER_HEADER