MD::Visitor

Search for usage in LXR

MD::Visitor< Trait > Class Template Referenceabstract

#include <visitor.h>

Inheritance diagram for MD::Visitor< Trait >:

Public Member Functions

 Visitor ()=default
 
virtual ~Visitor ()=default
 
void process (std::shared_ptr< Document< Trait > > d)
 

Protected Member Functions

virtual void onAddLineEnding ()=0
 
virtual void onAnchor (Anchor< Trait > *a)=0
 
virtual void onBlockquote (Blockquote< Trait > *b)
 
virtual void onCode (Code< Trait > *c)=0
 
virtual void onFootnote (Footnote< Trait > *f)
 
virtual void onFootnoteRef (FootnoteRef< Trait > *ref)=0
 
virtual void onHeading (Heading< Trait > *h)=0
 
virtual void onHorizontalLine (HorizontalLine< Trait > *l)=0
 
virtual void onImage (Image< Trait > *i)=0
 
virtual void onInlineCode (Code< Trait > *c)=0
 
virtual void onLineBreak (LineBreak< Trait > *b)=0
 
virtual void onLink (Link< Trait > *l)=0
 
virtual void onList (List< Trait > *l)=0
 
virtual void onListItem (ListItem< Trait > *i, bool first)
 
virtual void onMath (Math< Trait > *m)=0
 
virtual void onParagraph (Paragraph< Trait > *p, bool wrap)
 
virtual void onRawHtml (RawHtml< Trait > *h)=0
 
virtual void onTable (Table< Trait > *t)=0
 
virtual void onTableCell (TableCell< Trait > *c)
 
virtual void onText (Text< Trait > *t)=0
 
virtual void onUserDefined (Item< Trait > *item)
 

Protected Attributes

Trait::template Vector< typename Trait::String > m_anchors
 
std::shared_ptr< Document< Trait > > m_doc
 

Detailed Description

template<class Trait>
class MD::Visitor< Trait >

Visitor interface to walk through Document.

Definition at line 26 of file visitor.h.

Constructor & Destructor Documentation

◆ Visitor()

template<class Trait >
MD::Visitor< Trait >::Visitor ( )
default

◆ ~Visitor()

template<class Trait >
virtual MD::Visitor< Trait >::~Visitor ( )
virtualdefault

Member Function Documentation

◆ onAddLineEnding()

template<class Trait >
virtual void MD::Visitor< Trait >::onAddLineEnding ( )
protectedpure virtual

For some generator it's important to keep line endings like they were in Markdown.

So onParagraph() method invokes this method when necessary to add line ending.

Implemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

◆ onAnchor()

template<class Trait >
virtual void MD::Visitor< Trait >::onAnchor ( Anchor< Trait > * a)
protectedpure virtual

◆ onBlockquote()

template<class Trait >
virtual void MD::Visitor< Trait >::onBlockquote ( Blockquote< Trait > * b)
inlineprotectedvirtual

Handle blockquote.

Parameters
bBlockquote.

Reimplemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

Definition at line 203 of file visitor.h.

◆ onCode()

template<class Trait >
virtual void MD::Visitor< Trait >::onCode ( Code< Trait > * c)
protectedpure virtual

◆ onFootnote()

template<class Trait >
virtual void MD::Visitor< Trait >::onFootnote ( Footnote< Trait > * f)
inlineprotectedvirtual

Handle footnote.

Parameters
fFootnote.

Reimplemented in MD::details::AlgoVisitor< Trait >, and MD::PosCache< Trait >.

Definition at line 389 of file visitor.h.

◆ onFootnoteRef()

template<class Trait >
virtual void MD::Visitor< Trait >::onFootnoteRef ( FootnoteRef< Trait > * ref)
protectedpure virtual

Handle footnote reference.

Parameters
refFootnote reference.

Implemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

◆ onHeading()

template<class Trait >
virtual void MD::Visitor< Trait >::onHeading ( Heading< Trait > * h)
protectedpure virtual

◆ onHorizontalLine()

template<class Trait >
virtual void MD::Visitor< Trait >::onHorizontalLine ( HorizontalLine< Trait > * l)
protectedpure virtual

Handle horizontal line.

Parameters
lHorizontal line.

Implemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

◆ onImage()

template<class Trait >
virtual void MD::Visitor< Trait >::onImage ( Image< Trait > * i)
protectedpure virtual

◆ onInlineCode()

template<class Trait >
virtual void MD::Visitor< Trait >::onInlineCode ( Code< Trait > * c)
protectedpure virtual

◆ onLineBreak()

template<class Trait >
virtual void MD::Visitor< Trait >::onLineBreak ( LineBreak< Trait > * b)
protectedpure virtual

Handle line break.

Parameters
bLinebreak.

Implemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

◆ onLink()

template<class Trait >
virtual void MD::Visitor< Trait >::onLink ( Link< Trait > * l)
protectedpure virtual

◆ onList()

template<class Trait >
virtual void MD::Visitor< Trait >::onList ( List< Trait > * l)
protectedpure virtual

◆ onListItem()

template<class Trait >
virtual void MD::Visitor< Trait >::onListItem ( ListItem< Trait > * i,
bool first )
inlineprotectedvirtual

Handle list item.

Parameters
iList item.
firstIs this item first in the list?

Reimplemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

Definition at line 292 of file visitor.h.

◆ onMath()

template<class Trait >
virtual void MD::Visitor< Trait >::onMath ( Math< Trait > * m)
protectedpure virtual

Handle LaTeX math expression.

Parameters
mMath.

Implemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

◆ onParagraph()

template<class Trait >
virtual void MD::Visitor< Trait >::onParagraph ( Paragraph< Trait > * p,
bool wrap )
inlineprotectedvirtual

Handle paragraph.

Parameters
pParagraph.
wrapWrap this paragraph with something or no? It's useful to not wrap standalone paragraph in list item, for example.

Reimplemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

Definition at line 126 of file visitor.h.

◆ onRawHtml()

template<class Trait >
virtual void MD::Visitor< Trait >::onRawHtml ( RawHtml< Trait > * h)
protectedpure virtual

Handle raw HTML.

Parameters
hRaw HTML.

Implemented in MD::details::AlgoVisitor< Trait >, MD::details::HtmlVisitor< Trait >, and MD::PosCache< Trait >.

◆ onTable()

template<class Trait >
virtual void MD::Visitor< Trait >::onTable ( Table< Trait > * t)
protectedpure virtual

◆ onTableCell()

template<class Trait >
virtual void MD::Visitor< Trait >::onTableCell ( TableCell< Trait > * c)
inlineprotectedvirtual

Handle table cell.

Parameters
cTable cell.

Reimplemented in MD::details::AlgoVisitor< Trait >.

Definition at line 345 of file visitor.h.

◆ onText()

template<class Trait >
virtual void MD::Visitor< Trait >::onText ( Text< Trait > * t)
protectedpure virtual

◆ onUserDefined()

template<class Trait >
virtual void MD::Visitor< Trait >::onUserDefined ( Item< Trait > * item)
inlineprotectedvirtual

Handle user-defined item.

Parameters
itemItem.

Reimplemented in MD::details::AlgoVisitor< Trait >, and MD::PosCache< Trait >.

Definition at line 103 of file visitor.h.

◆ process()

template<class Trait >
void MD::Visitor< Trait >::process ( std::shared_ptr< Document< Trait > > d)
inline

Walk through the document.

Definition at line 33 of file visitor.h.

Member Data Documentation

◆ m_anchors

template<class Trait >
Trait::template Vector<typename Trait::String> MD::Visitor< Trait >::m_anchors
protected

All available m_anchors in the document.

Definition at line 439 of file visitor.h.

◆ m_doc

template<class Trait >
std::shared_ptr<Document<Trait> > MD::Visitor< Trait >::m_doc
protected

Document.

Definition at line 441 of file visitor.h.


The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.