|
Multi diag tools
|
Iterator that acts on a I/O device. More...
#include <FileInputIterator.h>
Public Member Functions | |
| FileInputIterator () | |
| Constructs a end-of-stream iterator. | |
| FileInputIterator (QIODevice *device, const QByteArray &encoding) | |
| Construct a iterator that acts on device. More... | |
| FileInputIterator (const FileInputIterator &other)=default | |
| Copy on base of other iterator. | |
| FileInputIterator (FileInputIterator &&other)=default | |
| Move constructor. | |
| FileInputIterator & | operator= (const FileInputIterator &other)=default |
| Assign other iterator. | |
| bool | setSource (QIODevice *device, const QByteArray &encoding) |
| Set source. More... | |
| void | clear () |
| Clear. More... | |
| FileInputIterator & | operator++ () |
| Increment iterator (pre-increment) More... | |
| FileInputIterator | operator++ (int) |
| Increment iterator (post-increment) More... | |
| reference | operator* () |
| Get last read value. More... | |
| bool | isEof () const |
| Check if this iterator is a end-of-stream iterator. More... | |
| bool | errorOccured () const |
| Check if a error occured. More... | |
| Mdt::Error | lastError () const |
| Get last error. More... | |
Friends | |
| bool | operator== (const FileInputIterator &a, const FileInputIterator &b) |
| Returns true if a and b are EOF iterators, or a and b are valid iterators. | |
| bool | operator!= (const FileInputIterator &a, const FileInputIterator &b) |
| See operator==() | |
Iterator that acts on a I/O device.
This iterator can be used by with Boost Spirit multipass_iterator.
FileInputIterator is a single-pass input iterator that reads data from a QIODevice. When the iterator is incremented, it will take a char from its internal buffer, witch is handled by FileInputIteratorSharedData. When no data is available anymore in the buffer, a chunck of data is read from QIODevice and decoded to unicode.
Definition at line 47 of file FileInputIterator.h.
| Mdt::PlainText::FileInputIterator::FileInputIterator | ( | QIODevice * | device, |
| const QByteArray & | encoding | ||
| ) |
Construct a iterator that acts on device.
Will use FileInputIteratorSharedData::setSource(). On success, a first char is read from device, decoded, then stored. On failure, this iterator falls back to a end-of-stream iterator, and error flag is set. On success, it can also happen that the device is allready at end. In this case, this iterator also falls back to a end-of-stream iterator.
Definition at line 26 of file FileInputIterator.cpp.
| void Mdt::PlainText::FileInputIterator::clear | ( | ) |
Clear.
After calling this function, this iterator becomes a end-of-stream iterator
Definition at line 44 of file FileInputIterator.cpp.
|
inline |
| bool Mdt::PlainText::FileInputIterator::isEof | ( | ) | const |
Check if this iterator is a end-of-stream iterator.
Returns true if this is a default constructed iterator (no device was set), or device and iternal buffer are both at end.
Definition at line 71 of file FileInputIterator.cpp.
| Mdt::Error Mdt::PlainText::FileInputIterator::lastError | ( | ) | const |
Get last error.
Definition at line 79 of file FileInputIterator.cpp.
| FileInputIterator::reference Mdt::PlainText::FileInputIterator::operator* | ( | ) |
Get last read value.
Note: if a error occured (typically while reading from device), the unicode uncertainty sign (0x2BD1) is returned.
Definition at line 60 of file FileInputIterator.cpp.
| FileInputIterator & Mdt::PlainText::FileInputIterator::operator++ | ( | ) |
Increment iterator (pre-increment)
Increment the internal unicode buffer by one. If buffer is empty, a chunck of data is also read from device and decoded into unicode buffer.
If a error occures (typically while reading from device), the error flag is set.
Definition at line 50 of file FileInputIterator.cpp.
|
inline |
Increment iterator (post-increment)
Definition at line 132 of file FileInputIterator.h.
| bool Mdt::PlainText::FileInputIterator::setSource | ( | QIODevice * | device, |
| const QByteArray & | encoding | ||
| ) |
Set source.
Will use FileInputIteratorSharedData::setSource(). On success, a first char is read from device, decoded, then stored. On failure, this iterator falls back to a end-of-stream iterator, and error flag is set. On success, it can also happen that the device is allready at end. In this case, this iterator also falls back to a end-of-stream iterator.
Definition at line 32 of file FileInputIterator.cpp.
1.8.11