#include <file.hpp>
|
virtual void | close ()=0 |
|
virtual bool | isOpen () const =0 |
|
virtual bool | isRemote () const =0 |
|
virtual ProgressNotifierPtr | operationProgress () const =0 |
|
virtual Buffer | read (std::streamoff beginOffset, std::streamsize countBytesToRead)=0 |
|
virtual Buffer | read (std::streamsize countBytesToRead)=0 |
|
virtual bool | seek (std::streamoff offsetFromBegin)=0 |
|
virtual std::streamsize | size () const =0 |
|
virtual | ~File ()=default |
|
|
static const std::streamsize | MAX_READ_SIZE = 1000000 |
| Maximum count of bytes that you can read by reading functions call. More...
|
|
Provide access to the content of a local or remote file. @includename{qicore/file.hpp}
Definition at line 127 of file file.hpp.
◆ File()
◆ ~File()
virtual qi::File::~File |
( |
| ) |
|
|
virtualdefault |
◆ close()
virtual void qi::File::close |
( |
| ) |
|
|
pure virtual |
◆ isOpen()
virtual bool qi::File::isOpen |
( |
| ) |
const |
|
pure virtual |
◆ isRemote()
virtual bool qi::File::isRemote |
( |
| ) |
const |
|
pure virtual |
◆ 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.
Implemented in qi::FileImpl, and qi::FileProxy.
◆ read() [1/2]
virtual Buffer qi::File::read |
( |
std::streamoff |
beginOffset, |
|
|
std::streamsize |
countBytesToRead |
|
) |
| |
|
pure virtual |
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
Implemented in qi::FileImpl, and qi::FileProxy.
◆ read() [2/2]
virtual Buffer qi::File::read |
( |
std::streamsize |
countBytesToRead | ) |
|
|
pure virtual |
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.
Implemented in qi::FileImpl, and qi::FileProxy.
◆ seek()
virtual bool qi::File::seek |
( |
std::streamoff |
offsetFromBegin | ) |
|
|
pure virtual |
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.
Implemented in qi::FileImpl, and qi::FileProxy.
◆ size()
virtual std::streamsize qi::File::size |
( |
| ) |
const |
|
pure virtual |
- Returns
- Total count of bytes contained in the file or 0 if the file is closed.
Implemented in qi::FileImpl, and qi::FileProxy.
◆ MAX_READ_SIZE
const std::streamsize qi::File::MAX_READ_SIZE = 1000000 |
|
static |
Maximum count of bytes that you can read by reading functions call.
Definition at line 156 of file file.hpp.
The documentation for this class was generated from the following file: