haiku/headers/private/storage/FileIO.h
Ingo Weinhold 89dc7e4875 Added private BPositionIO derived classes BFileIO and BFileDescriptorIO which
wrap a FILE* respectively a file descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36324 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-15 22:19:27 +00:00

47 lines
1.0 KiB
C++

/*
* Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _FILE_IO_H
#define _FILE_IO_H
#include <stdio.h>
#include <DataIO.h>
class BFileIO : public BPositionIO {
public:
BFileIO(FILE* file,
bool takeOverOwnership = false);
virtual ~BFileIO();
virtual ssize_t Read(void *buffer, size_t size);
virtual ssize_t Write(const void *buffer, size_t size);
virtual ssize_t ReadAt(off_t position, void *buffer,
size_t size);
virtual ssize_t WriteAt(off_t position, const void *buffer,
size_t size);
virtual off_t Seek(off_t position, uint32 seekMode);
virtual off_t Position() const;
virtual status_t SetSize(off_t size);
virtual status_t GetSize(off_t* size) const;
private:
BFileIO(const BFileIO& other);
BFileIO& operator=(const BFileIO& other);
off_t _Seek(off_t position, uint32 seekMode) const;
private:
FILE* fFile;
bool fOwnsFile;
};
#endif // _FILE_IO_H