MD::BlockPlugin Class

template <typename Trait> class MD::BlockPlugin

Base class for block plugins. More...

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

MD::YAMLBlockPlugin

Public Functions

virtual ~BlockPlugin()
virtual MD::BlockType id() const = 0
virtual bool isItYou(typename Trait::InternalString &startLine, MD::StringListStream<Trait> &stream, long long emptyLinesBefore) = 0
virtual long long linesCountOfLastBlock() const = 0
virtual void process(MD::MdBlock<Trait> &fr, std::shared_ptr<MD::Block<Trait>> parent, std::shared_ptr<MD::Document<Trait>> doc, bool collectRefLinks) = 0

Protected Functions

Detailed Description

Member Function Documentation

[protected] BlockPlugin::BlockPlugin()

Default constructor.

[virtual] BlockPlugin::~BlockPlugin()

Destructor.

[pure virtual] MD::BlockType BlockPlugin::id() const

Returns ID of a block.

[pure virtual] bool BlockPlugin::isItYou(typename Trait::InternalString &startLine, MD::StringListStream<Trait> &stream, long long emptyLinesBefore)

Returns whether the given line is a start of a block that this plugin handles.

Note: position of stream is on next line after startLine.

Note: After checking in stream next lines on return from this method stream should be in state what it was before.

startLine Start line.

stream Stream.

emptyLinesBefore Count of empty lines before. May be 0 even if there are empty lines before, but in this case you will get access to full stream. In case when not full stream is passed to this method you will get correct amount of empty lines before.

[pure virtual] long long BlockPlugin::linesCountOfLastBlock() const

Returns count of lines in the last detected block of this type.

[pure virtual] void BlockPlugin::process(MD::MdBlock<Trait> &fr, std::shared_ptr<MD::Block<Trait>> parent, std::shared_ptr<MD::Document<Trait>> doc, bool collectRefLinks)

Process a block.

fr Fragment of a document.

parent Parent where new block should be added.

doc Document.

collectRefLinks Indicates that this is first go through the document and we just collecting reference links. Most of block plugins may just do nothing when this flag is true.