MD::Block Class

class MD::Block

Abstract block (storage of child items). More...

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

MD::Blockquote, MD::Document, MD::Footnote, MD::List, MD::ListItem, MD::Paragraph, and MD::TableCell

Public Types

Public Functions

void appendItem(MD::Block::ItemSharedPointer i)
void applyBlock(const MD::Block &other, MD::Document *doc = nullptr)
MD::Block::ItemSharedPointer getItemAt(qsizetype idx) const
void insertItem(qsizetype idx, MD::Block::ItemSharedPointer i)
bool isEmpty() const
const MD::Block::Items &items() const
void removeItemAt(qsizetype idx)

Protected Functions

Block()

Detailed Description

Base class for any item in MD::Document that may has children items.

See also MD::Paragraph, MD::Blockquote, MD::List, MD::ListItem, MD::TableCell, and MD::Footnote.

Member Type Documentation

[alias] Block::ItemSharedPointer

Type of pointer to child item.

[alias] Block::Items

Type of list of children.

Member Function Documentation

[constexpr noexcept protected] Block::Block()

Default constructor.

void Block::appendItem(MD::Block::ItemSharedPointer i)

Append child item.

i Item to append.

void Block::applyBlock(const MD::Block &other, MD::Document *doc = nullptr)

Apply other block to this.

other Value to apply.

doc Parent of new item.

MD::Block::ItemSharedPointer Block::getItemAt(qsizetype idx) const

Returns child item at the given position.

idx Index.

void Block::insertItem(qsizetype idx, MD::Block::ItemSharedPointer i)

Insert child item at given position.

idx Index where insert.

i Item to insert.

bool Block::isEmpty() const

Returns whether there are no children.

const MD::Block::Items &Block::items() const

Returns list of child items.

void Block::removeItemAt(qsizetype idx)

Remove child item at the given position.

idx Index where to remove.