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
113 size_t read(
void* bfr,
size_t numberOfBytes, Int64 offset=-1L)
const
127 size_t write(
const void* bfr,
size_t numberOfBytes, Int64 offset=-1L)
141 Int64
seek(Int64 offset,
int whence)
const
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_WRITE_LOCK
Flag to place an write / exclusive lock.
@ 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.
BLOCXX_COMMON_API void rewind(const FileHandle &hdl)
Position the file pointer associated with the given file handle to the beginning of the file.
BLOCXX_COMMON_API size_t read(const FileHandle &hdl, void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Read data from file.
BLOCXX_COMMON_API Int64 seek(const FileHandle &hdl, Int64 offset, int whence)
Seek to a given offset within the file.
BLOCXX_COMMON_API int close(const FileHandle &hdl)
Close file handle.
BLOCXX_COMMON_API size_t write(FileHandle hdl, const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Write data to a file.
BLOCXX_COMMON_API Int64 tell(const FileHandle &hdl)
BLOCXX_COMMON_API UInt64 fileSize(FileHandle fh)
Get the size of a file from the file handle.
BLOCXX_COMMON_API int flush(FileHandle &hdl)
Flush any buffered data to the file if buffering supported.