39 #ifndef BLOCXX_FILE_HPP_INCLUDE_GUARD_
40 #define BLOCXX_FILE_HPP_INCLUDE_GUARD_
41 #include "blocxx/BLOCXX_config.h"
54 class 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;
void rewind() const
Position the file pointer to the beginning of the file.
#define BLOCXX_INVALID_FILEHANDLE
BLOCXX_COMMON_API Int64 tell(const FileHandle &hdl)
BLOCXX_COMMON_API int close(const FileHandle &hdl)
Close file handle.
BLOCXX_COMMON_API int flush(FileHandle &hdl)
Flush any buffered data to the file if buffering supported.
void swap(Array< T > &x, Array< T > &y)
#define BLOCXX_SAFE_BOOL_IMPL(classname, type, variable, test)
BLOCXX_COMMON_API UInt64 fileSize(FileHandle fh)
Get the size of a file from the file handle.
Int64 seek(Int64 offset, int whence) const
Seek to a given offset within the file.
File()
Create a NULL File object.
UInt64 size() const
Current size of file.
BLOCXX_COMMON_API size_t read(const FileHandle &hdl, void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Read data from file.
int close()
Close the underlying file object.
BLOCXX_COMMON_API size_t write(FileHandle hdl, const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Write data to a file.
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
BLOCXX_COMMON_API Int64 seek(const FileHandle &hdl, Int64 offset, int whence)
Seek to a given offset within the file.
Flag to place a read / shared lock.
size_t read(void *bfr, size_t numberOfBytes, Int64 offset=-1L) const
Read from the underlying 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...
size_t write(const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Write to the underlying file.
int flush()
Flush any buffered data to the file.