MD::TextStreamBase Class

class MD::TextStreamBase

Base class for text stream. More...

Header: #include <md4qt/text_stream.h>
CMake: find_package(md4qt REQUIRED COMPONENTS md4qt)
target_link_libraries(mytarget PRIVATE md4qt::md4qt)
Inherited By:

MD::TextStream

Public Types

struct State

Public Functions

virtual bool atEnd() const = 0
MD::Line currentLine()
MD::TextStreamBase::State currentState() const
MD::Line moveTo(qsizetype ln)
MD::Line readLine()
void restoreState(const MD::TextStreamBase::State *state = nullptr)
void saveState()

Protected Functions

virtual const QChar *data() const = 0
virtual QChar getChar() = 0
virtual bool isEmpty() const = 0

Protected Variables

MD::TextStreamBase::State m_current
MD::TextStreamBase::State m_saved

Detailed Description

This is common things for text streams used for splitting string into lines.

Member Function Documentation

[pure virtual] bool TextStreamBase::atEnd() const

Returns whether stream at end.

MD::Line TextStreamBase::currentLine()

Returns current line from stream without any modifications of state.

MD::TextStreamBase::State TextStreamBase::currentState() const

Returns current state.

[pure virtual protected] const QChar *TextStreamBase::data() const

Returns data.

[pure virtual protected] QChar TextStreamBase::getChar()

Returns current character from stream and moves to next character.

[pure virtual protected] bool TextStreamBase::isEmpty() const

Returns whether this stream is empty.

MD::Line TextStreamBase::moveTo(qsizetype ln)

Moves stream position to the beginning of the given line number.

Returns line with the given line number.

Note: This method does not take effect on not already read line.

ln Line number.

MD::Line TextStreamBase::readLine()

Returns current line from stream and moves to next line.

void TextStreamBase::restoreState(const MD::TextStreamBase::State *state = nullptr)

Restore state.

state State.

void TextStreamBase::saveState()

Save state (position) of stream to be able to restore it.

Member Variable Documentation

MD::TextStreamBase::State TextStreamBase::m_current

Current state of the stream.

MD::TextStreamBase::State TextStreamBase::m_saved

Saved state.