File.pkg 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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, PackageFile* package, const String& fileName);
  13. virtual ~File();
  14. virtual unsigned Read(void* dest, unsigned size);
  15. virtual unsigned Seek(unsigned position);
  16. virtual unsigned Write(const void* data, unsigned size);
  17. virtual const String& GetName() const;
  18. virtual unsigned GetChecksum();
  19. bool Open(const String& fileName, FileMode mode = FILE_READ);
  20. bool Open(PackageFile* package, const String& fileName);
  21. void Close();
  22. void Flush();
  23. void SetName(const String& name);
  24. FileMode GetMode() const;
  25. bool IsOpen() const;
  26. void* GetHandle() const;
  27. bool IsPackaged() const;
  28. tolua_readonly tolua_property__get_set String& name;
  29. tolua_readonly tolua_property__get_set unsigned checksum;
  30. tolua_readonly tolua_property__get_set FileMode mode;
  31. tolua_readonly tolua_property__is_set bool open;
  32. tolua_readonly tolua_property__is_set bool packaged;
  33. };