|
void | _close () override |
|
Buffer | _read (std::streamoff beginOffset, std::streamsize countBytesToRead) override |
|
Buffer | _read (std::streamsize countBytesToRead) override |
|
bool | _seek (std::streamoff offsetFromBegin) override |
|
void | close () override |
|
| FileImpl (const Path &localFilePath) |
|
bool | isOpen () const override |
|
bool | isRemote () const override |
|
ProgressNotifierPtr | operationProgress () const override |
|
Buffer | read (std::streamoff beginOffset, std::streamsize countBytesToRead) override |
|
Buffer | read (std::streamsize countBytesToRead) override |
|
bool | seek (std::streamoff offsetFromBegin) override |
|
std::streamsize | size () const override |
|
| ~FileImpl ()=default |
|
virtual | ~File ()=default |
|
|
static const std::streamsize | MAX_READ_SIZE = 1000000 |
| Maximum count of bytes that you can read by reading functions call. More...
|
|
| File ()=default |
|
Definition at line 17 of file fileimpl.cpp.
◆ FileImpl()
qi::FileImpl::FileImpl |
( |
const Path & |
localFilePath | ) |
|
|
inlineexplicit |
◆ ~FileImpl()
qi::FileImpl::~FileImpl |
( |
| ) |
|
|
default |
◆ _close()
void qi::FileImpl::_close |
( |
| ) |
|
|
inlineoverride |
◆ _read() [1/2]
Buffer qi::FileImpl::_read |
( |
std::streamoff |
beginOffset, |
|
|
std::streamsize |
countBytesToRead |
|
) |
| |
|
inlineoverride |
◆ _read() [2/2]
Buffer qi::FileImpl::_read |
( |
std::streamsize |
countBytesToRead | ) |
|
|
inlineoverride |
◆ _seek()
bool qi::FileImpl::_seek |
( |
std::streamoff |
offsetFromBegin | ) |
|
|
inlineoverride |
◆ close()
void qi::FileImpl::close |
( |
| ) |
|
|
inlineoverridevirtual |
Close the file. Once this function is called, calling most other operation will throw a std::runtime_error. The size(), isOpen() and isRemote() calls will return work as expected.
Implements qi::File.
Definition at line 86 of file fileimpl.cpp.
◆ isOpen()
bool qi::FileImpl::isOpen |
( |
| ) |
const |
|
inlineoverridevirtual |
- Returns
- true if the file is currently open for reading, false otherwise.
Implements qi::File.
Definition at line 97 of file fileimpl.cpp.
◆ isRemote()
bool qi::FileImpl::isRemote |
( |
| ) |
const |
|
inlineoverridevirtual |
- Returns
- true if the file is located on a remote filesystem, false otherwise.
Implements qi::File.
Definition at line 102 of file fileimpl.cpp.
◆ operationProgress()
Provide the progress notifier used by the operations manipulating this file. The notifier is associated with this file. Therefore, no concurrent operation should be used by this notifier object, as it is not safe to have concurrent operations running on the same file.
Implements qi::File.
Definition at line 107 of file fileimpl.cpp.
◆ read() [1/2]
Buffer qi::FileImpl::read |
( |
std::streamoff |
beginOffset, |
|
|
std::streamsize |
countBytesToRead |
|
) |
| |
|
inlineoverridevirtual |
Read a specified count of bytes starting from a specified byte position in the file.
- Warning
- If you try to read more than _MAX_READ_SIZE bytes, this call will throw a std::runtime_error.
- Parameters
-
beginOffset | Position in the file to start reading from. |
countBytesToRead | Count of bytes to read from the file starting at the current position of the file cursor. |
- Returns
- A buffer of data read from the file, empty if:
- there is no data in the specified byte range to read
- if the file have been closed;
- if the start position is outside the available range of data in the file. If there is less data to read in the file than the required count, if we try reading past the end of the file for example, then the buffer will only contain the available data, nothing more
Implements qi::File.
Definition at line 43 of file fileimpl.cpp.
◆ read() [2/2]
Buffer qi::FileImpl::read |
( |
std::streamsize |
countBytesToRead | ) |
|
|
inlineoverridevirtual |
Read a specified count of bytes starting from the current cursor position.
- Warning
- If you try to read more than _MAX_READ_SIZE bytes, this call will throw a std::runtime_error.
- Parameters
-
countBytesToRead | Count of bytes to read from the file, starting from the current position of the file cursor. |
- Returns
- A buffer of data read from the file, empty if there is no data in the specified byte range to read or if the file have been closed. If there is less data to read in the file than the required count, if we try reading past the end of the file for example, then the buffer will only contain the available data, nothing more.
Implements qi::File.
Definition at line 51 of file fileimpl.cpp.
◆ requireOpenFile()
void qi::FileImpl::requireOpenFile |
( |
| ) |
|
|
inlineprivate |
◆ seek()
bool qi::FileImpl::seek |
( |
std::streamoff |
offsetFromBegin | ) |
|
|
inlineoverridevirtual |
Move the read cursor to the specified position in the file.
- Parameters
-
offsetFromBegin | New position of the read cursor in the file. If it is out of the range of data in the file, the cursor will not be changed at all. |
- Returns
- true if the position is in the range of data available in the file, false otherwise, in which case the cursor have not been changed.
Implements qi::File.
Definition at line 75 of file fileimpl.cpp.
◆ size()
std::streamsize qi::FileImpl::size |
( |
| ) |
const |
|
inlineoverridevirtual |
- Returns
- Total count of bytes contained in the file or 0 if the file is closed.
Implements qi::File.
Definition at line 92 of file fileimpl.cpp.
◆ _fileStream
boost::filesystem::ifstream qi::FileImpl::_fileStream |
|
private |
◆ _progressNotifier
◆ _readBuffer
std::vector<char> qi::FileImpl::_readBuffer |
|
private |
◆ _size
std::streamsize qi::FileImpl::_size |
|
private |
The documentation for this class was generated from the following file: