2
0

IWriteFile.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #pragma once
  5. #include "IReferenceCounted.h"
  6. #include "path.h"
  7. namespace irr
  8. {
  9. namespace io
  10. {
  11. //! Interface providing write access to a file.
  12. class IWriteFile : public virtual IReferenceCounted
  13. {
  14. public:
  15. //! Writes an amount of bytes to the file.
  16. /** \param buffer Pointer to buffer of bytes to write.
  17. \param sizeToWrite Amount of bytes to write to the file.
  18. \return How much bytes were written. */
  19. virtual size_t write(const void *buffer, size_t sizeToWrite) = 0;
  20. //! Changes position in file
  21. /** \param finalPos Destination position in the file.
  22. \param relativeMovement If set to true, the position in the file is
  23. changed relative to current position. Otherwise the position is changed
  24. from begin of file.
  25. \return True if successful, otherwise false. */
  26. virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
  27. //! Get the current position in the file.
  28. /** \return Current position in the file in bytes on success or -1L on failure */
  29. virtual long getPos() const = 0;
  30. //! Get name of file.
  31. /** \return File name as zero terminated character string. */
  32. virtual const path &getFileName() const = 0;
  33. //! Flush the content of the buffer in the file
  34. /** \return True if successful, otherwise false. */
  35. virtual bool flush() = 0;
  36. };
  37. } // end namespace io
  38. } // end namespace irr