39#ifndef BLOCXX_FILE_HPP_INCLUDE_GUARD_
40#define BLOCXX_FILE_HPP_INCLUDE_GUARD_
41#include "blocxx/BLOCXX_config.h"
54class BLOCXX_COMMON_API
File
100 std::swap(m_hdl, x.
m_hdl);
113 size_t read(
void* bfr,
size_t numberOfBytes, Int64 offset=-1L)
const
115 return FileSystem::read(m_hdl, bfr, numberOfBytes, offset);
127 size_t write(
const void* bfr,
size_t numberOfBytes, Int64 offset=-1L)
129 return FileSystem::write(m_hdl, bfr, numberOfBytes, offset);
141 Int64
seek(Int64 offset,
int whence)
const
143 return FileSystem::seek(m_hdl, offset, whence);
151 return FileSystem::tell(m_hdl);
158 FileSystem::rewind(m_hdl);
165 return FileSystem::fileSize(m_hdl);
175 int rv = FileSystem::close(m_hdl);
187 return FileSystem::flush(m_hdl);
204 int getLock(ELockType type = E_WRITE_LOCK);
220 int tryLock(ELockType type = E_WRITE_LOCK);
239 bool operator==(const
File& rhs)
241 return m_hdl == rhs.m_hdl;
#define BLOCXX_SAFE_BOOL_IMPL(classname, type, variable, test)
#define BLOCXX_INVALID_FILEHANDLE
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
int close()
Close the underlying file object.
Int64 seek(Int64 offset, int whence) const
Seek to a given offset within the file.
int flush()
Flush any buffered data to the file.
size_t read(void *bfr, size_t numberOfBytes, Int64 offset=-1L) const
Read from the underlying file.
size_t write(const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Write to the underlying file.
@ E_READ_LOCK
Flag to place a read / shared lock.
File()
Create a NULL File object.
void rewind() const
Position the file pointer to the beginning of the file.
UInt64 size() const
Current size of file.