Coverage Report

Created: 2026-07-25 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibXML/DOM/Document.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <AK/HashMap.h>
10
#include <AK/NonnullOwnPtr.h>
11
#include <LibXML/DOM/DocumentTypeDeclaration.h>
12
#include <LibXML/DOM/Node.h>
13
#include <LibXML/Forward.h>
14
15
namespace XML {
16
17
enum class Version {
18
    Version10,
19
    Version11,
20
};
21
22
struct Doctype {
23
    ByteString type;
24
    Vector<MarkupDeclaration> markup_declarations;
25
    Optional<ExternalID> external_id;
26
};
27
28
class Document {
29
public:
30
    explicit Document(NonnullOwnPtr<Node> root, Optional<Doctype> doctype, HashMap<Name, ByteString> processing_instructions, Version version)
31
141
        : m_root(move(root))
32
141
        , m_processing_instructions(move(processing_instructions))
33
141
        , m_version(version)
34
141
        , m_explicit_doctype(move(doctype))
35
141
    {
36
141
    }
37
38
0
    Node& root() { return *m_root; }
39
0
    Node const& root() const { return *m_root; }
40
41
0
    HashMap<Name, ByteString> const& processing_instructions() const { return m_processing_instructions; }
42
43
0
    Version version() const { return m_version; }
44
45
0
    Optional<Doctype> const& doctype() const { return m_explicit_doctype; }
46
47
private:
48
    NonnullOwnPtr<Node> m_root;
49
    HashMap<Name, ByteString> m_processing_instructions;
50
    Version m_version;
51
    Optional<Doctype> m_explicit_doctype;
52
};
53
}