MD::Context Class
class MD::ContextParsing 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, bool updateNestingLevel = true) |
| MD::BlockParser * | block() const |
| MD::Context & | bottomChild() |
| MD::Context & | childAt(qsizetype pos) |
| MD::Context::ChildIndents & | childIndents() |
| const MD::Context::ChildIndents & | childIndents() const |
| const MD::Context::Children & | children() const |
| void | clearChildIndents(qsizetype sc, bool removeAdditional) |
| void | clearChildren() |
| 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) const |
| bool | isLazyLine(qsizetype lineNumber) const |
| bool | isNotFinished() const |
| MD::Item * | item() 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) |
| MD::Context & | mostNestedChild() |
| int | nestingLevel() const |
| MD::Context * | parent() const |
| void | popBottomChild() |
| void | popChild() |
| void | pushChild(const MD::Context &ctx) |
| int | serialNumber() 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 | setItem(MD::Item *i) |
| void | setLastLineNumber(qsizetype number) |
| void | setNestingLevel(int l, bool updateSerialNumber = false) |
| void | setNotFinished(bool on = true) |
| void | setSerialNumber(int n) |
| void | setTopListDelim(QChar d) |
| MD::Line::State | startPos(qsizetype lineNumber) const |
| MD::Context & | topChild() |
| MD::Context & | topContext() |
| void | updateParentContextForAllChildren() |
| void | updateStartPos(qsizetype lineNumber, qsizetype pos) |
| bool | wasNotProcessedEver() const |
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, bool updateNestingLevel = true)
Apply settings for child context.
ctx Context.
updateNestingLevel Should nesting level be updated?
MD::BlockParser *Context::block() const
Returns block parser of this context.
See also setBlock().
MD::Context &Context::bottomChild()
Returns bottom context.
MD::Context &Context::childAt(qsizetype pos)
Returns context at the given position.
pos Position in queue.
MD::Context::ChildIndents &Context::childIndents()
Returns child indents.
const MD::Context::ChildIndents &Context::childIndents() const
Returns child indents.
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.
void Context::clearChildren()
Remove all children.
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
Returns 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) const
Returns whether the given column is in range.
column Column.
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.
MD::Item *Context::item() const
Returns item in the document for this context.
See also setItem().
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.
MD::Context &Context::mostNestedChild()
Returns most nested child context.
int Context::nestingLevel() const
Returns nesting level of the context (used in lists parsing).
See also setNestingLevel().
MD::Context *Context::parent() const
Returns parent contex.
void Context::popBottomChild()
Pop bottom context.
void Context::popChild()
Pop context.
void Context::pushChild(const MD::Context &ctx)
Push context.
ctx Context.
int Context::serialNumber() const
Returns serial number of dummy parent context (used in lists).
In lists children are all have one parent - context of the list, and to determine different list items this number is used.
Every list item has its own unique serial number, and any context that belongs to the list item has serial number of that list item.
See also setSerialNumber().
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::setItem(MD::Item *i)
Set item in the document for this context.
i Item.
See also item().
void Context::setLastLineNumber(qsizetype number)
Set the number of the last line of the block.
number Line number.
See also lastLineNumber().
void Context::setNestingLevel(int l, bool updateSerialNumber = false)
Set nesting level of the context (used in lists parsing).
l Level.
updateSerialNumber Should the serial number be updated?
See also nestingLevel().
void Context::setNotFinished(bool on = true)
Set not yet finished flag.
on State flag.
See also isNotFinished().
void Context::setSerialNumber(int n)
Set serial number of dummy parent context (used in lists).
n Serial number.
See also serialNumber().
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::topChild()
Returns top context.
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.
bool Context::wasNotProcessedEver() const
Return whether this context did not process one child ever.