File.pkg 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. $#include "File.h"
  2. enum FileMode
  3. {
  4. FILE_READ = 0,
  5. FILE_WRITE,
  6. FILE_READWRITE
  7. };
  8. class File : public Deserializer
  9. {
  10. File(Context* context);
  11. File(Context* context, const String& fileName, FileMode mode = FILE_READ);
  12. File(Context* context, const char* fileName, FileMode mode = FILE_READ);
  13. File(Context* context, PackageFile* package, const String& fileName);
  14. virtual ~File();
  15. virtual unsigned Read(void* dest, unsigned size);
  16. virtual unsigned Seek(unsigned position);
  17. virtual unsigned Write(const void* data, unsigned size);
  18. virtual const String& GetName() const;
  19. virtual unsigned GetChecksum();
  20. bool Open(const String& fileName, FileMode mode = FILE_READ);
  21. bool Open(PackageFile* package, const String& fileName);
  22. void Close();
  23. void Flush();
  24. void SetName(const String& name);
  25. FileMode GetMode() const;
  26. bool IsOpen() const;
  27. void* GetHandle() const;
  28. bool IsPackaged() const;
  29. tolua_readonly tolua_property__get_set String& name;
  30. tolua_readonly tolua_property__get_set unsigned checksum;
  31. tolua_readonly tolua_property__get_set FileMode mode;
  32. tolua_readonly tolua_property__is_set bool open;
  33. tolua_readonly tolua_property__is_set bool packaged;
  34. };