MD::Line Class

class MD::Line

Text line in the Markdown input document. More...

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

Public Types

struct RollbackLine
struct State

Public Functions

Line(QStringView v, qsizetype ln)
bool atEnd() const
qsizetype column() const
QChar currentChar() const
MD::Line::State currentState() const
bool isEmpty() const
qsizetype length() const
qsizetype lineNumber() const
MD::Line::RollbackLine makeRollbackObject()
QChar nextChar()
qsizetype position() const
QChar prevChar() const
void restoreState(const MD::Line::State *state = nullptr)
void saveState()
void skip()
MD::Line sliced(qsizetype pos, qsizetype len = -1)
QString slicedCopy(qsizetype pos, qsizetype len = -1) const
const QStringView &view() const

Detailed Description

Auxiliary string view like class to handle Markdown stuff. It handles tabulations and null characters transparently for a developer. Current column in this class takes into account a tabulation as needed.

Member Function Documentation

Line::Line(QStringView v, qsizetype ln)

Constructor.

v String view.

ln Line number.

bool Line::atEnd() const

Returns whether line at end.

qsizetype Line::column() const

Returns column of the current character (taking into account variable length of tabulations).

QChar Line::currentChar() const

Return current character.

MD::Line::State Line::currentState() const

Returns current state.

bool Line::isEmpty() const

Returns whether this string is empty.

qsizetype Line::length() const

Returns length of the string.

qsizetype Line::lineNumber() const

Returns line number.

MD::Line::RollbackLine Line::makeRollbackObject()

Make a rollback point.

QChar Line::nextChar()

Returns next character.

qsizetype Line::position() const

Returns position of the current charcter in the string (where tabulation is one character).

QChar Line::prevChar() const

Returns previous character.

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

Restore state.

state State.

void Line::saveState()

Save state.

void Line::skip()

Move current character to the end of string.

MD::Line Line::sliced(qsizetype pos, qsizetype len = -1)

Returns sliced line.

pos Start position

len Length.

QString Line::slicedCopy(qsizetype pos, qsizetype len = -1) const

Returns sliced copy of string.

pos Start position

len Length.

const QStringView &Line::view() const

Returns view.