testSuiteLoader.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _NULLSOFT_WINAMP_GEN_DEVICE_PROVIDER_TEST_SUITE_LOADER_HEADER
  2. #define _NULLSOFT_WINAMP_GEN_DEVICE_PROVIDER_TEST_SUITE_LOADER_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 <vector>
  9. #include "./DeviceNodeParser.h"
  10. #include "./DeviceTypeNodeParser.h"
  11. #include "./DeviceConnectionNodeParser.h"
  12. #include "./DeviceCommandNodeParser.h"
  13. class obj_xml;
  14. #define LOADER_TAG_MAX 2
  15. class TestSuiteLoader : public ifc_xmlreadercallback
  16. {
  17. public:
  18. TestSuiteLoader();
  19. ~TestSuiteLoader();
  20. public:
  21. BOOL Load(const wchar_t *path, TestSuite *testSuite);
  22. private:
  23. BOOL FeedFile(obj_xml *reader, HANDLE hFile, DWORD bufferSize);
  24. void Event_XmlStartElement(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params);
  25. void Event_XmlEndElement(const wchar_t *xmlpath, const wchar_t *xmltag);
  26. void Event_XmlCharData(const wchar_t *xmlpath, const wchar_t *xmltag, const wchar_t *value);
  27. void Event_XmlError(int linenum, int errcode, const wchar_t *errstr);
  28. protected:
  29. friend static void CALLBACK LoaderTag_ImageBase(TestSuiteLoader *loader, const wchar_t *value);
  30. friend static void CALLBACK LoaderTag_Connect(TestSuiteLoader *loader, const wchar_t *value);
  31. protected:
  32. typedef std::vector<char*> NameList;
  33. protected:
  34. StringBuilder elementString;
  35. DeviceNodeParser deviceParser;
  36. DeviceTypeNodeParser typeParser;
  37. DeviceConnectionNodeParser connectionParser;
  38. DeviceCommandNodeParser commandParser;
  39. BOOL hitList[LOADER_TAG_MAX];
  40. wchar_t *imageBase;
  41. NameList connectList;
  42. protected:
  43. RECVS_DISPATCH;
  44. };
  45. #endif // _NULLSOFT_WINAMP_GEN_DEVICE_PROVIDER_TEST_SUITE_LOADER_HEADER