Public Member Functions | Private Member Functions | Private Attributes | List of all members
qi::FileImpl Class Reference
Inheritance diagram for qi::FileImpl:
Inheritance graph
[legend]

Public Member Functions

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
 
- Public Member Functions inherited from qi::File
virtual ~File ()=default
 

Private Member Functions

void requireOpenFile ()
 

Private Attributes

boost::filesystem::ifstream _fileStream
 
ProgressNotifierPtr _progressNotifier
 
std::vector< char > _readBuffer
 
std::streamsize _size
 

Additional Inherited Members

- Static Public Attributes inherited from qi::File
static const std::streamsize MAX_READ_SIZE = 1000000
 Maximum count of bytes that you can read by reading functions call. More...
 
- Protected Member Functions inherited from qi::File
 File ()=default
 

Detailed Description

Definition at line 17 of file fileimpl.cpp.

Constructor & Destructor Documentation

◆ FileImpl()

qi::FileImpl::FileImpl ( const Path &  localFilePath)
inlineexplicit

Definition at line 20 of file fileimpl.cpp.

◆ ~FileImpl()

qi::FileImpl::~FileImpl ( )
default

Member Function Documentation

◆ _close()

void qi::FileImpl::_close ( )
inlineoverride

Definition at line 128 of file fileimpl.cpp.

◆ _read() [1/2]

Buffer qi::FileImpl::_read ( std::streamoff  beginOffset,
std::streamsize  countBytesToRead 
)
inlineoverride

Definition at line 113 of file fileimpl.cpp.

◆ _read() [2/2]

Buffer qi::FileImpl::_read ( std::streamsize  countBytesToRead)
inlineoverride

Definition at line 118 of file fileimpl.cpp.

◆ _seek()

bool qi::FileImpl::_seek ( std::streamoff  offsetFromBegin)
inlineoverride

Definition at line 123 of file fileimpl.cpp.

◆ 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()

ProgressNotifierPtr qi::FileImpl::operationProgress ( ) const
inlineoverridevirtual

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
beginOffsetPosition in the file to start reading from.
countBytesToReadCount 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
countBytesToReadCount 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

Definition at line 139 of file fileimpl.cpp.

◆ seek()

bool qi::FileImpl::seek ( std::streamoff  offsetFromBegin)
inlineoverridevirtual

Move the read cursor to the specified position in the file.

Parameters
offsetFromBeginNew 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.

Member Data Documentation

◆ _fileStream

boost::filesystem::ifstream qi::FileImpl::_fileStream
private

Definition at line 134 of file fileimpl.cpp.

◆ _progressNotifier

ProgressNotifierPtr qi::FileImpl::_progressNotifier
private

Definition at line 137 of file fileimpl.cpp.

◆ _readBuffer

std::vector<char> qi::FileImpl::_readBuffer
private

Definition at line 135 of file fileimpl.cpp.

◆ _size

std::streamsize qi::FileImpl::_size
private

Definition at line 136 of file fileimpl.cpp.


The documentation for this class was generated from the following file:


naoqi_libqicore
Author(s): Aldebaran
autogenerated on Wed Sep 14 2022 02:22:41