MD::details::AlgoVisitor Class
template <typename Trait> class MD::details::AlgoVisitorVisitor for algorithms. More...
Header: | #include <md4qt/algo.h> |
CMake: | find_package(md4qt REQUIRED COMPONENTS md4qt) target_link_libraries(mytarget PRIVATE md4qt::md4qt) |
Inherits: | MD::Visitor |
Public Functions
AlgoVisitor(unsigned int mnl, const typename Trait::template Vector<ItemType> &t, MD::ItemFunctor<Trait> f) | |
virtual void | walk(std::shared_ptr<MD::Document<Trait>> doc) |
Protected Types
struct | IncrementNestingLevel |
Protected Functions
void | onAnchor(MD::Anchor<Trait> *a) override |
void | onBlockquote(MD::Blockquote<Trait> *b) override |
void | onCode(MD::Code<Trait> *c) override |
void | onFootnote(MD::Footnote<Trait> *f) override |
void | onFootnoteRef(MD::FootnoteRef<Trait> *ref) override |
virtual void | onFootnotes(std::shared_ptr<MD::Document<Trait>> doc) |
void | onHeading(MD::Heading<Trait> *h) override |
void | onHorizontalLine(MD::HorizontalLine<Trait> *l) override |
void | onImage(MD::Image<Trait> *i) override |
void | onInlineCode(MD::Code<Trait> *c) override |
void | onLineBreak(MD::LineBreak<Trait> *l) override |
void | onLink(MD::Link<Trait> *l) override |
void | onList(MD::List<Trait> *l) override |
void | onListItem(MD::ListItem<Trait> *i, bool) override |
void | onMath(MD::Math<Trait> *m) override |
void | onParagraph(MD::Paragraph<Trait> *p, bool) override |
void | onRawHtml(MD::RawHtml<Trait> *h) override |
void | onTable(MD::Table<Trait> *t) override |
void | onTableCell(MD::TableCell<Trait> *c) override |
void | onText(MD::Text<Trait> *t) override |
void | onUserDefined(MD::Item<Trait> *i) override |
Protected Variables
unsigned int | m_currentNestingLevel |
MD::ItemFunctor<Trait> | m_func |
unsigned int | m_maxNestingLevel |
const typename Trait::template Vector<ItemType> & | m_types |
Detailed Description
The main difference from MD::Visitor is that this class during walking through the document takes into account nesting level of the item. If nesting level reached defined value it won't process anything further. And if type of the item is in set types walking through the document will invoke a given function object for that item.
See also MD::Visitor.
Member Function Documentation
AlgoVisitor::AlgoVisitor(unsigned int mnl, const typename Trait::template Vector<ItemType> &t, MD::ItemFunctor<Trait> f)
Constructor
mnl Maximum nesting level
t List of items' types.
f Functor.
[protected]
void AlgoVisitor::onAnchor(MD::Anchor<Trait> *a)
Process anchor.
a Anchor.
[protected]
void AlgoVisitor::onBlockquote(MD::Blockquote<Trait> *b)
Process blockquote.
b Blockquote.
[protected]
void AlgoVisitor::onCode(MD::Code<Trait> *c)
Process code block.
c Code.
[protected]
void AlgoVisitor::onFootnote(MD::Footnote<Trait> *f)
Process footnote.
f Footnote.
[protected]
void AlgoVisitor::onFootnoteRef(MD::FootnoteRef<Trait> *ref)
Process footnote reference.
ref Footnote reference.
[virtual protected]
void AlgoVisitor::onFootnotes(std::shared_ptr<MD::Document<Trait>> doc)
Process all footnotes.
doc Document.
[protected]
void AlgoVisitor::onHeading(MD::Heading<Trait> *h)
Process heading.
h Heading.
[protected]
void AlgoVisitor::onHorizontalLine(MD::HorizontalLine<Trait> *l)
Process horizontal line.
l Horizontal line.
[protected]
void AlgoVisitor::onImage(MD::Image<Trait> *i)
Process Image.
i Image.
[protected]
void AlgoVisitor::onInlineCode(MD::Code<Trait> *c)
Process inline code.
c Code.
[protected]
void AlgoVisitor::onLineBreak(MD::LineBreak<Trait> *l)
Process line break.
l Line break.
[protected]
void AlgoVisitor::onLink(MD::Link<Trait> *l)
Process link.
l Link.
[protected]
void AlgoVisitor::onList(MD::List<Trait> *l)
Process list.
l List.
[protected]
void AlgoVisitor::onListItem(MD::ListItem<Trait> *i, bool)
Process list item.
i List item.
[protected]
void AlgoVisitor::onMath(MD::Math<Trait> *m)
Process LaTeX math item.
m Math.
[protected]
void AlgoVisitor::onParagraph(MD::Paragraph<Trait> *p, bool)
Process paragraph.
p Paragraph.
[protected]
void AlgoVisitor::onRawHtml(MD::RawHtml<Trait> *h)
Process raw HTML block.
h Raw HTML.
[protected]
void AlgoVisitor::onTable(MD::Table<Trait> *t)
Process table.
t Table.
[protected]
void AlgoVisitor::onTableCell(MD::TableCell<Trait> *c)
Process table cell.
c Table cell.
[protected]
void AlgoVisitor::onText(MD::Text<Trait> *t)
Process text item.
t Text.
[protected]
void AlgoVisitor::onUserDefined(MD::Item<Trait> *i)
Process user defined item type.
i Item.
[virtual]
void AlgoVisitor::walk(std::shared_ptr<MD::Document<Trait>> doc)
Walk through the document.
doc Document.
Member Variable Documentation
unsigned int AlgoVisitor::m_currentNestingLevel
Current nesting level, increments/decrements during walking through te document.
MD::ItemFunctor<Trait> AlgoVisitor::m_func
Functor that will be invoked if all circumstances will be observed.
unsigned int AlgoVisitor::m_maxNestingLevel
Maximum allowed nesting level.
const typename Trait::template Vector<ItemType> &AlgoVisitor::m_types
List of types that should be processed.