CStream.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * CStream.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. VCMI_LIB_NAMESPACE_BEGIN
  12. class DLL_LINKAGE CStream : private boost::noncopyable
  13. {
  14. public:
  15. /**
  16. * D-tor.
  17. */
  18. virtual ~CStream() = default;
  19. /**
  20. * Seeks to the specified position.
  21. *
  22. * @param position The position from the beginning.
  23. * @return the position actually moved to, -1 on error.
  24. */
  25. virtual si64 seek(si64 position) = 0;
  26. /**
  27. * Gets the current position in the stream.
  28. *
  29. * @return the position.
  30. */
  31. virtual si64 tell() = 0;
  32. /**
  33. * Relative seeks to the specified position.
  34. *
  35. * @param delta The count of bytes to seek from current position.
  36. * @return the count of bytes skipped actually.
  37. */
  38. virtual si64 skip(si64 delta) = 0;
  39. /**
  40. * Gets the length of the stream.
  41. *
  42. * @return the length in bytes
  43. */
  44. virtual si64 getSize() = 0;
  45. };
  46. VCMI_LIB_NAMESPACE_END