Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

60 wiersze
1.0 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. //
  11. // File and buffer reading
  12. // -----------------------
  13. //
  14. #if !defined __LOL_SYS_FILE_H__
  15. #define __LOL_SYS_FILE_H__
  16. #include <stdint.h>
  17. namespace lol
  18. {
  19. struct FileAccess
  20. {
  21. enum Value
  22. {
  23. Read = 0,
  24. Write,
  25. }
  26. m_value;
  27. inline FileAccess(Value v) : m_value(v) {}
  28. inline operator Value() { return m_value; }
  29. };
  30. class File
  31. {
  32. public:
  33. File();
  34. File(File const &that);
  35. File &operator =(File const &that);
  36. ~File();
  37. void Open(String const &file, FileAccess mode);
  38. bool IsValid() const;
  39. void Close();
  40. int Read(uint8_t *buf, int count);
  41. String ReadString();
  42. private:
  43. class FileData *m_data;
  44. };
  45. } /* namespace lol */
  46. #endif // __LOL_SYS_FILE_H__