18#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_MARKDOWN_MARKDOWN_H
19#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_MARKDOWN_MARKDOWN_H
21#include "llvm/ADT/StringRef.h"
22#include "llvm/ADT/simple_ilist.h"
23#include "llvm/Support/Casting.h"
24#include "llvm/Support/Compiler.h"
25#include "llvm/Support/raw_ostream.h"
56 virtual void print(llvm::raw_ostream &OS)
const = 0;
58#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
60 LLVM_DUMP_METHOD
void dump()
const;
74 llvm::StringRef
getText()
const {
return Text; }
75 void print(llvm::raw_ostream &OS)
const override;
89 llvm::StringRef
getCode()
const {
return Code; }
90 void print(llvm::raw_ostream &OS)
const override;
107 void print(llvm::raw_ostream &OS)
const override;
124 void print(llvm::raw_ostream &OS)
const override;
142 virtual void print(llvm::raw_ostream &OS)
const = 0;
144#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
146 LLVM_DUMP_METHOD
void dump()
const;
163 void print(llvm::raw_ostream &OS)
const override;
182 void print(llvm::raw_ostream &OS)
const override;
197 llvm::StringRef
getLang()
const {
return Lang; }
198 llvm::StringRef
getCode()
const {
return Code; }
199 void print(llvm::raw_ostream &OS)
const override;
205 llvm::StringRef Lang;
206 llvm::StringRef Code;
218 void print(llvm::raw_ostream &OS)
const;
220#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
223 LLVM_DUMP_METHOD
void dump()
const;
240 void print(llvm::raw_ostream &OS)
const override;
259 void print(llvm::raw_ostream &OS)
const override;
277 void print(llvm::raw_ostream &OS)
const override;
290 void print(llvm::raw_ostream &OS)
const override;
304 void print(llvm::raw_ostream &OS)
const override;
LLVM_DUMP_METHOD void dump() const
Prints to llvm::errs(). Only available in assert builds.
virtual void print(llvm::raw_ostream &OS) const =0
Recursively prints the node and its children to OS.
virtual ~BlockNode()=default
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
void addChild(BlockNode &N)
static bool classof(const BlockNode *N)
void removeChild(BlockNode &N)
const BlockList & children() const
void addChild(BlockNode &N)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
const BlockList & children() const
void removeChild(BlockNode &N)
static bool classof(const BlockNode *N)
void removeChild(InlineNode &N)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
static bool classof(const InlineNode *N)
void addChild(InlineNode &N)
const InlineList & children() const
llvm::StringRef getCode() const
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
static bool classof(const BlockNode *N)
FencedCodeNode(llvm::StringRef L, llvm::StringRef C)
llvm::StringRef getLang() const
static bool classof(const BlockNode *N)
void addChild(InlineNode &N)
void removeChild(InlineNode &N)
const InlineList & children() const
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
unsigned getLevel() const
InlineCodeNode(llvm::StringRef C)
llvm::StringRef getCode() const
static bool classof(const InlineNode *N)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
Base class for all inline nodes.
LLVM_DUMP_METHOD void dump() const
Prints to llvm::errs(). Only available in assert builds.
virtual ~InlineNode()=default
virtual void print(llvm::raw_ostream &OS) const =0
Recursively prints the node and its children to OS.
A single item in an unordered or ordered list.
const InlineList & children() const
void addChild(InlineNode &N)
void removeChild(InlineNode &N)
void print(llvm::raw_ostream &OS) const
LLVM_DUMP_METHOD void dump() const
Prints to llvm::errs().
void addItem(ListItemNode &N)
OrderedListNode(unsigned S=1)
void removeItem(ListItemNode &N)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
unsigned getStart() const
const ItemList & items() const
static bool classof(const BlockNode *N)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
static bool classof(const BlockNode *N)
void addChild(InlineNode &N)
void removeChild(InlineNode &N)
const InlineList & children() const
void removeChild(InlineNode &N)
void addChild(InlineNode &N)
const InlineList & children() const
static bool classof(const InlineNode *N)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
static bool classof(const InlineNode *N)
llvm::StringRef getText() const
TextNode(llvm::StringRef T)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
static bool classof(const BlockNode *N)
const ItemList & items() const
void addItem(ListItemNode &N)
static bool classof(const BlockNode *N)
void print(llvm::raw_ostream &OS) const override
Recursively prints the node and its children to OS.
void removeItem(ListItemNode &N)
llvm::simple_ilist< ListItemNode > ItemList
llvm::simple_ilist< InlineNode > InlineList
llvm::simple_ilist< BlockNode > BlockList