core_api.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef __CORE_API_H
  2. #define __CORE_API_H
  3. //ancient tempura header. yay.
  4. #ifndef ASSERT
  5. #ifdef _DEBUG
  6. #define ASSERT(x) if (!(x)) MessageBox(NULL,"ASSERT FAILED: " #x,"ASSERT FAILED in " __FILE__ ,MB_OK|MB_ICONSTOP);
  7. #else
  8. #define ASSERT(x)
  9. #endif
  10. #endif
  11. class WReader;
  12. class WPlayer_callback
  13. {
  14. public:
  15. virtual WReader *GetReader(char *url)=0;
  16. virtual void Error(char *reason)=0;
  17. virtual void Warning(char *warning)=0;
  18. virtual void Status(char *status)=0;
  19. virtual void TitleChange(char *new_title)=0;
  20. virtual void InfoChange(char *new_info_str, int new_length)=0;
  21. virtual void UrlChange(char *new_url)=0;
  22. };
  23. class WInfo_callback
  24. {
  25. public:
  26. virtual WReader *GetReader(char *url)=0;
  27. };
  28. class WReader
  29. {
  30. protected:
  31. WReader() : m_player(0) { }
  32. public:
  33. WPlayer_callback *m_player;
  34. virtual char *GetDescription() { return 0; };
  35. virtual int Open(char *url, char *killswitch)=0;
  36. virtual int Read(char *buffer, int length, char *killswitch)=0;
  37. virtual int GetLength(void)=0;
  38. virtual int CanSeek(void)=0;
  39. virtual int Seek(int position, char *killswitch)=0;
  40. virtual char *GetHeader(char *name) { return 0; }
  41. virtual ~WReader() { }
  42. };
  43. #define READ_VER 0x100
  44. #define OF_VER 0x100
  45. typedef struct
  46. {
  47. int version;
  48. char *description;
  49. WReader *(*create)();
  50. int (*ismine)(char *url);
  51. } reader_source;
  52. #endif