MD::Context Class

class MD::Context

Parsing context. More...

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

Public Types

Public Functions

void appendChildIndent(qsizetype i, const QChar &d = QChar())
void appendLazyInfo(qsizetype lineNumber)
void appendLineInfo(qsizetype lineNumber, const MD::Line::State &state)
void applyParentContext(MD::Context &ctx)
MD::BlockParser *block() const
MD::Context::ChildIndents &childIndents()
const MD::Context::ChildIndents &childIndents() const
MD::Context::Children &children()
const MD::Context::Children &children() const
void clearChildIndents(qsizetype sc, bool removeAdditional)
qsizetype firstChildIndent() const
qsizetype firstLineNumber() const
bool hasChildIndents() const
qsizetype indentColumn() const
qsizetype indentColumnForCheck(bool skipChildren) const
qsizetype indentsNestingLevel() const
bool isDiscardForced() const
bool isInIndent(qsizetype column, bool skipChildren) const
bool isLazyLine(qsizetype lineNumber) const
bool isNotFinished() const
qsizetype lastChildIndent() const
qsizetype lastLineNumber() const
const MD::Context::LineInfo &lineInfo() const
QChar listDelim(qsizetype indent) const
MD::Context::ChildLists &lists()
const MD::Context::ChildLists &lists() const
qsizetype maxAvailableIndent() const
void mergeLineInfo(const MD::Context::LineInfo &other)
qsizetype minimumIndentColumnForCheck(bool skipChildren) const
MD::Context &mostNestedChild()
MD::Context *parent() const
void setBlock(MD::BlockParser *b)
void setDiscardForced(bool on = true)
void setDontConsiderIndents(bool on = true)
void setFirstLineNumber(qsizetype number)
void setIndentColumn(qsizetype i)
void setLastLineNumber(qsizetype number)
void setNotFinished(bool on = true)
void setTopListDelim(QChar d)
MD::Line::State startPos(qsizetype lineNumber) const
MD::Context &topContext()
void updateParentContextForAllChildren()
void updateStartPos(qsizetype lineNumber, qsizetype pos)

Detailed Description

Auxiliary class for parsing process.

Member Type Documentation

[alias] Context::ChildIndents

Type of list of child indents.

[alias] Context::ChildLists

Type of list of child lists.

[alias] Context::Children

Type of queue of children.

[alias] Context::LineInfo

Type hash of line informations.

Member Function Documentation

void Context::appendChildIndent(qsizetype i, const QChar &d = QChar())

Append indentColumn to child indents.

i Indent.

d Delimiter.

void Context::appendLazyInfo(qsizetype lineNumber)

Mark line with the given line number as lazy.

lineNumber Line number.

void Context::appendLineInfo(qsizetype lineNumber, const MD::Line::State &state)

Add information about line of this block.

lineNumber Line number.

state State.

void Context::applyParentContext(MD::Context &ctx)

Apply settings for child context.

ctx Context.

MD::BlockParser *Context::block() const

Returns block parser of this context.

See also setBlock().

MD::Context::ChildIndents &Context::childIndents()

Returns child indents.

const MD::Context::ChildIndents &Context::childIndents() const

Returns child indents.

MD::Context::Children &Context::children()

Returns child contexts.

const MD::Context::Children &Context::children() const

Returns child contexts.

void Context::clearChildIndents(qsizetype sc, bool removeAdditional)

Remove all indents greater then given.

sc Count of spaces before.

removeAdditional Means that list with first deletable indent should be deleted too.

qsizetype Context::firstChildIndent() const

Returns indent column for the first children.

qsizetype Context::firstLineNumber() const

Returns the number of the first line of the block.

See also setFirstLineNumber().

bool Context::hasChildIndents() const

Returns whether any child indent is set.

qsizetype Context::indentColumn() const

Returns current indent column. Has a sense in lists, for example.

See also setIndentColumn().

qsizetype Context::indentColumnForCheck(bool skipChildren) const

Actual at this time indent for MD::BlockParser::check() method.

skipChildren Should child indents be considered?

qsizetype Context::indentsNestingLevel() const

Returns indents nesting level.

bool Context::isDiscardForced() const

Returns whether this context should be discarded.

See also MD::BlockState::Discard, MD::BlockquoteParser, and MD::TableParser.

bool Context::isInIndent(qsizetype column, bool skipChildren) const

Returns whether the given column is in range.

column Column.

skipChildren Should child indents be considered?

bool Context::isLazyLine(qsizetype lineNumber) const

Returns whether most nested front child is lazy.

lineNumber Line number.

bool Context::isNotFinished() const

Returns whether this context is not determined as finished.

See also MD::BlockState::Discard, MD::BlockquoteParser, and MD::TableParser.

qsizetype Context::lastChildIndent() const

Returns indent column for the last children.

qsizetype Context::lastLineNumber() const

Returns the number of the last line of the block.

See also setLastLineNumber().

const MD::Context::LineInfo &Context::lineInfo() const

Return information about all lines.

QChar Context::listDelim(qsizetype indent) const

Returns list delimiter for the given indent.

indent Indent.

MD::Context::ChildLists &Context::lists()

Returns lists.

const MD::Context::ChildLists &Context::lists() const

Returns lists.

qsizetype Context::maxAvailableIndent() const

Returns max available indent, checking in children and all parents.

void Context::mergeLineInfo(const MD::Context::LineInfo &other)

Merge information about lines.

other Line info.

qsizetype Context::minimumIndentColumnForCheck(bool skipChildren) const

Actual at this time minimum indent for MD::BlockParser::check() method.

skipChildren Should child indents be considered?

MD::Context &Context::mostNestedChild()

Returns most nested child context.

MD::Context *Context::parent() const

Returns parent contex.

void Context::setBlock(MD::BlockParser *b)

Set block parser.

b Pointer to block.

See also block().

void Context::setDiscardForced(bool on = true)

Set this context to be discarded.

on State flag.

See also isDiscardForced().

void Context::setDontConsiderIndents(bool on = true)

Set to not consider indents in MD::Context::indentForCheck() method.

on State flag.

void Context::setFirstLineNumber(qsizetype number)

Set the number of the first line of the block.

number Line number.

See also firstLineNumber().

void Context::setIndentColumn(qsizetype i)

Set current indent column.

i Indent.

See also indentColumn().

void Context::setLastLineNumber(qsizetype number)

Set the number of the last line of the block.

number Line number.

See also lastLineNumber().

void Context::setNotFinished(bool on = true)

Set not yet finished flag.

on State flag.

See also isNotFinished().

void Context::setTopListDelim(QChar d)

Set top list delimiter.

d Delimiter.

MD::Line::State Context::startPos(qsizetype lineNumber) const

Returns start position of this block on line.

lineNumber Line number.

MD::Context &Context::topContext()

Returns top parent context.

void Context::updateParentContextForAllChildren()

Update parent context for all children.

void Context::updateStartPos(qsizetype lineNumber, qsizetype pos)

Update start position of the line.

lineNumber Line number.

pos Position.