#include <File.hpp>
Public Types | |
| enum | ELockType { E_READ_LOCK, E_WRITE_LOCK } |
| typedef FileHandle File::* | safe_bool |
Public Member Functions | |
| File () | |
| Create a NULL File object. | |
| File (const File &x) | |
| Copy constructor. | |
| ~File () | |
| File & | operator= (const File &x) |
| Assignment operator. | |
| void | swap (File &x) |
| size_t | read (void *bfr, size_t numberOfBytes, off_t offset=-1L) const |
| Read from the underlying file. | |
| size_t | write (const void *bfr, size_t numberOfBytes, off_t offset=-1L) |
| Write to the underlying file. | |
| int | seek (off_t offset, int whence) const |
| Seek to a given offset within the file. | |
| off_t | tell () const |
| |
| void | rewind () const |
| Position the file pointer to the beginning of the file. | |
| int | close () |
| Close the underlying file object. | |
| int | flush () |
| Flush any buffered data to the file. | |
| int | getLock (ELockType type=E_WRITE_LOCK) |
| Acquire a kernel lock on the file. | |
| int | tryLock (ELockType type=E_WRITE_LOCK) |
| Acquire a kernel lock on the file. | |
| int | unlock () |
| Release a lock on the file. | |
| operator safe_bool () const | |
| |
| bool | operator! () const |
| bool | operator== (const File &rhs) |
| Equality operator. | |
| File (FileHandle hdl) | |
Private Attributes | |
| FileHandle | m_hdl |
Definition at line 52 of file File.hpp.
| typedef FileHandle File::* BLOCXX_NAMESPACE::File::safe_bool |
| BLOCXX_NAMESPACE::File::File | ( | ) | [inline] |
| BLOCXX_NAMESPACE::File::File | ( | const File & | x | ) |
Copy constructor.
| x | The File object to copy. |
Definition at line 133 of file PosixFile.cpp.
| BLOCXX_NAMESPACE::File::~File | ( | ) | [inline] |
| BLOCXX_NAMESPACE::File::File | ( | FileHandle | hdl | ) | [inline] |
| void BLOCXX_NAMESPACE::File::swap | ( | File & | x | ) | [inline] |
| size_t BLOCXX_NAMESPACE::File::read | ( | void * | bfr, | |
| size_t | numberOfBytes, | |||
| off_t | offset = -1L | |||
| ) | const [inline] |
Read from the underlying file.
| bfr | The location where the read operation will place what is read. | |
| numberOfBytes | The number of bytes to read. | |
| offset | The offset to seek to in the file before the read operation is done. -1 will use the current offset. |
Definition at line 100 of file File.hpp.
References BLOCXX_NAMESPACE::FileSystem::read().
Referenced by BLOCXX_NAMESPACE::dlSharedLibrary::isFakeLibrary(), and BLOCXX_NAMESPACE::TempFileEnumerationImplBase::readSize().
| size_t BLOCXX_NAMESPACE::File::write | ( | const void * | bfr, | |
| size_t | numberOfBytes, | |||
| off_t | offset = -1L | |||
| ) | [inline] |
Write to the underlying file.
| bfr | The locaction to get the contents to write. | |
| numberOfBytes | The number of bytes to write. | |
| offset | The offset to seek to in the file before the write operation is done. -1 will use the current offset. |
Definition at line 113 of file File.hpp.
References BLOCXX_NAMESPACE::FileSystem::write().
| int BLOCXX_NAMESPACE::File::seek | ( | off_t | offset, | |
| int | whence | |||
| ) | const [inline] |
Seek to a given offset within the file.
| offset | The offset to seek to relative to the whence parm. | |
| whence | Can be one of the follwing values: SEEK_SET - Seek relative to the beginning of the file. SEEK_CUR - Seek relative to the current position. SEEK_END - Seek relative to the end of the file (bwd). |
Definition at line 127 of file File.hpp.
References BLOCXX_NAMESPACE::FileSystem::seek().
Referenced by BLOCXX_NAMESPACE::TempFileEnumerationImplBase::readSize().
| off_t BLOCXX_NAMESPACE::File::tell | ( | ) | const [inline] |
Otherwise -1.
Definition at line 135 of file File.hpp.
References BLOCXX_NAMESPACE::FileSystem::tell().
| void BLOCXX_NAMESPACE::File::rewind | ( | ) | const [inline] |
Position the file pointer to the beginning of the file.
Definition at line 142 of file File.hpp.
References BLOCXX_NAMESPACE::FileSystem::rewind().
| int BLOCXX_NAMESPACE::File::close | ( | ) | [inline] |
Close the underlying file object.
Definition at line 150 of file File.hpp.
References BLOCXX_INVALID_FILEHANDLE, and BLOCXX_NAMESPACE::FileSystem::close().
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::close(), and BLOCXX_NAMESPACE::TempFileEnumerationImplBase::readSize().
| int BLOCXX_NAMESPACE::File::flush | ( | ) | [inline] |
Flush any buffered data to the file.
Definition at line 164 of file File.hpp.
References BLOCXX_NAMESPACE::FileSystem::flush().
| int BLOCXX_NAMESPACE::File::getLock | ( | ELockType | type = E_WRITE_LOCK |
) |
Acquire a kernel lock on the file.
This call may block. The lock may be released by calling unlock(). The lock will also be released when the the file is closed or when locking application exits. This is only an advisory lock and will not prevent non-coordinated access to the file.
| type | Whether to acquire a read (shared) or a write (exclusive) lock. Default is a write lock. |
Definition at line 154 of file PosixFile.cpp.
References BLOCXX_NAMESPACE::doLock(), E_WRITE_LOCK, and m_hdl.
| int BLOCXX_NAMESPACE::File::tryLock | ( | ELockType | type = E_WRITE_LOCK |
) |
Acquire a kernel lock on the file.
This call won't block. The lock may be released by calling unlock() The lock will also be released when the locking application exits. This is only an advisory lock and will not prevent non-coordinated access to the file. lt is a exclusive lock.
| type | Whether to acquire a read (shared) or a write (exclusive) lock. Default is a write lock. |
Definition at line 161 of file PosixFile.cpp.
References BLOCXX_NAMESPACE::doLock(), E_WRITE_LOCK, and m_hdl.
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen().
| int BLOCXX_NAMESPACE::File::unlock | ( | ) |
Release a lock on the file.
This call will not block.
Definition at line 168 of file PosixFile.cpp.
References BLOCXX_NAMESPACE::doLock(), and m_hdl.
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::close().
| BLOCXX_NAMESPACE::File::operator safe_bool | ( | ) | const [inline] |
Definition at line 205 of file File.hpp.
References BLOCXX_INVALID_FILEHANDLE, and m_hdl.
| bool BLOCXX_NAMESPACE::File::operator! | ( | ) | const [inline] |
| bool BLOCXX_NAMESPACE::File::operator== | ( | const File & | rhs | ) | [inline] |
FileHandle BLOCXX_NAMESPACE::File::m_hdl [private] |
Definition at line 225 of file File.hpp.
Referenced by getLock(), operator safe_bool(), operator==(), swap(), tryLock(), and unlock().
1.5.3