summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibMarkdown/Visitor.h
blob: 7341b404f37ce72cacc8716ce64c03b42b811c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (c) 2021, Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/RecursionDecision.h>
#include <LibMarkdown/BlockQuote.h>
#include <LibMarkdown/CodeBlock.h>
#include <LibMarkdown/CommentBlock.h>
#include <LibMarkdown/Document.h>
#include <LibMarkdown/Heading.h>
#include <LibMarkdown/HorizontalRule.h>
#include <LibMarkdown/List.h>
#include <LibMarkdown/Paragraph.h>
#include <LibMarkdown/Table.h>

namespace Markdown {

class Visitor {
public:
    Visitor() = default;
    virtual ~Visitor() = default;

    virtual RecursionDecision visit(Document const&) { return RecursionDecision::Recurse; }

    virtual RecursionDecision visit(BlockQuote const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(CodeBlock const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(CommentBlock const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(ContainerBlock const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Heading const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(HorizontalRule const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(List const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Paragraph const&) { return RecursionDecision::Recurse; }

    virtual RecursionDecision visit(Table const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Table::Column const&) { return RecursionDecision::Recurse; }

    virtual RecursionDecision visit(Text const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Text::BreakNode const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Text::CodeNode const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Text::EmphasisNode const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Text::LinkNode const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Text::MultiNode const&) { return RecursionDecision::Recurse; }
    virtual RecursionDecision visit(Text::TextNode const&) { return RecursionDecision::Recurse; }

    virtual RecursionDecision visit(String const&) { return RecursionDecision::Recurse; }
};

}