SimpleHandler.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "SimpleHandler.h"
  2. #include "SimpleLoader.h"
  3. const wchar_t *Cef_Handler::EnumerateExtensions(size_t n)
  4. {
  5. if (n == 0)
  6. return L"simple";
  7. else
  8. return 0;
  9. }
  10. const wchar_t *Cef_Handler::GetName()
  11. {
  12. return L"Simple Playlist Loader";
  13. }
  14. int Cef_Handler::SupportedFilename(const wchar_t *filename)
  15. {
  16. size_t filenameLength = wcslen(filename);
  17. size_t extensionLength = wcslen(L".simple");
  18. if (filenameLength < extensionLength) return SVC_PLAYLISTHANDLER_FAILED; // too short
  19. if (!wcsicmp(filename + filenameLength - extensionLength, L".simple"))
  20. return SVC_PLAYLISTHANDLER_SUCCESS;
  21. else
  22. return SVC_PLAYLISTHANDLER_FAILED;
  23. }
  24. ifc_playlistloader *Cef_Handler::CreateLoader(const wchar_t *filename)
  25. {
  26. return new SimpleLoader();
  27. }
  28. void Cef_Handler::ReleaseLoader(ifc_playlistloader *loader)
  29. {
  30. delete (SimpleLoader *)loader;
  31. }
  32. // Define the dispatch table
  33. #define CBCLASS Cef_Handler
  34. START_DISPATCH;
  35. CB(SVC_PLAYLISTHANDLER_ENUMEXTENSIONS, EnumerateExtensions)
  36. CB(SVC_PLAYLISTHANDLER_SUPPORTFILENAME, SupportedFilename)
  37. CB(SVC_PLAYLISTHANDLER_CREATELOADER, CreateLoader)
  38. VCB(SVC_PLAYLISTHANDLER_RELEASELOADER, ReleaseLoader)
  39. CB(SVC_PLAYLISTHANDLER_GETNAME, GetName)
  40. END_DISPATCH;