2
0

ApkFile.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. Copyright (c) 2013 Daniele Bartolini, Michele Rossi
  3. Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
  4. Permission is hereby granted, free of charge, to any person
  5. obtaining a copy of this software and associated documentation
  6. files (the "Software"), to deal in the Software without
  7. restriction, including without limitation the rights to use,
  8. copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the
  10. Software is furnished to do so, subject to the following
  11. conditions:
  12. The above copyright notice and this permission notice shall be
  13. included in all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  16. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  19. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  21. OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #pragma once
  24. #include "File.h"
  25. namespace crown
  26. {
  27. class ApkFile : public File
  28. {
  29. public:
  30. /// Opens the given @a filename.
  31. ApkFile(const char* filename);
  32. ~ApkFile();
  33. /// @copydoc File::seek()
  34. void seek(size_t position);
  35. /// @copydoc File::seek_to_end()
  36. void seek_to_end();
  37. /// @copydoc File::skip()
  38. void skip(size_t bytes);
  39. /// @copydoc File::read()
  40. void read(void* buffer, size_t size);
  41. /// @copydoc File::write()
  42. void write(const void* buffer, size_t size);
  43. /// @copydoc File::copy_to()
  44. bool copy_to(File& file, size_t size = 0);
  45. /// @copydoc File::flush()
  46. void flush();
  47. /// @copydoc File::is_valid()
  48. bool is_valid();
  49. /// @copydoc File::end_of_file()
  50. bool end_of_file();
  51. /// @copydoc File::size()
  52. size_t size();
  53. /// @copydoc File::position()
  54. size_t position();
  55. /// @copydoc File::can_read()
  56. bool can_read() const;
  57. /// @copydoc File::can_write()
  58. bool can_write() const;
  59. /// @copydoc File::can_seek()
  60. bool can_seek() const;
  61. private:
  62. AAsset* m_asset;
  63. };
  64. } // namespace crown