IWriteFile.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #ifndef IRR_I_WRITE_FILE_H_INCLUDED
  5. #define IRR_I_WRITE_FILE_H_INCLUDED
  6. #include "IReferenceCounted.h"
  7. #include "path.h"
  8. namespace irr
  9. {
  10. namespace io
  11. {
  12. //! Interface providing write access to a file.
  13. class IWriteFile : public virtual IReferenceCounted
  14. {
  15. public:
  16. //! Writes an amount of bytes to the file.
  17. /** \param buffer Pointer to buffer of bytes to write.
  18. \param sizeToWrite Amount of bytes to write to the file.
  19. \return How much bytes were written. */
  20. virtual size_t write(const void* buffer, size_t sizeToWrite) = 0;
  21. //! Changes position in file
  22. /** \param finalPos Destination position in the file.
  23. \param relativeMovement If set to true, the position in the file is
  24. changed relative to current position. Otherwise the position is changed
  25. from begin of file.
  26. \return True if successful, otherwise false. */
  27. virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
  28. //! Get the current position in the file.
  29. /** \return Current position in the file in bytes on success or -1L on failure */
  30. virtual long getPos() const = 0;
  31. //! Get name of file.
  32. /** \return File name as zero terminated character string. */
  33. virtual const path& getFileName() const = 0;
  34. //! Flush the content of the buffer in the file
  35. /** \return True if successful, otherwise false. */
  36. virtual bool flush() = 0;
  37. };
  38. } // end namespace io
  39. } // end namespace irr
  40. #endif