Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/configmgr/source/xcsparser.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <sal/config.h>
23
24
#include <stack>
25
26
#include <rtl/ref.hxx>
27
#include <rtl/ustring.hxx>
28
#include <rtl/ustrbuf.hxx>
29
#include <utility>
30
#include <xmlreader/xmlreader.hxx>
31
32
#include "node.hxx"
33
#include "parser.hxx"
34
#include "valueparser.hxx"
35
36
namespace configmgr {
37
38
class SetNode;
39
struct Data;
40
41
class XcsParser: public Parser {
42
public:
43
    XcsParser(int layer, Data & data);
44
45
private:
46
    virtual ~XcsParser() override;
47
48
    virtual xmlreader::XmlReader::Text getTextMode() override;
49
50
    virtual bool startElement(
51
        xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
52
        std::set< OUString > const * existingDependencies) override;
53
54
    virtual void endElement(xmlreader::XmlReader const & reader) override;
55
56
    virtual void characters(xmlreader::Span const & text) override;
57
58
    void handleComponentSchema(xmlreader::XmlReader & reader);
59
60
    void handleNodeRef(xmlreader::XmlReader & reader);
61
62
    void handleProp(xmlreader::XmlReader & reader);
63
64
    void handlePropValue(
65
        xmlreader::XmlReader & reader, rtl::Reference< Node > const & property);
66
67
    void handleGroup(xmlreader::XmlReader & reader, bool isTemplate);
68
69
    void handleSet(xmlreader::XmlReader & reader, bool isTemplate);
70
71
    void handleSetItem(xmlreader::XmlReader & reader, SetNode * set);
72
73
    enum State {
74
        STATE_START, STATE_COMPONENT_SCHEMA, STATE_TEMPLATES,
75
        STATE_TEMPLATES_DONE, STATE_COMPONENT, STATE_COMPONENT_DONE };
76
77
    struct Element {
78
        rtl::Reference< Node > node;
79
        OUString name;
80
81
        Element(
82
            rtl::Reference< Node > theNode,
83
            OUString theName):
84
0
            node(std::move(theNode)), name(std::move(theName)) {}
85
    };
86
87
    typedef std::stack< Element > ElementStack;
88
89
    ValueParser valueParser_;
90
    Data & data_;
91
    OUString componentName_;
92
    State state_;
93
    long ignoring_;
94
    ElementStack elements_;
95
    bool bIsParsingInfo_;
96
    OUStringBuffer description_;
97
};
98
99
}
100
101
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */