Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/tools/config.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
#pragma once
20
21
#include <tools/toolsdllapi.h>
22
#include <rtl/ustring.hxx>
23
#include <memory>
24
25
struct ImplConfigData;
26
struct ImplGroupData;
27
28
class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Config
29
{
30
private:
31
    OUString            maFileName;
32
    OString             maGroupName;
33
    std::unique_ptr<ImplConfigData> mpData;
34
    ImplGroupData*      mpActGroup;
35
    sal_uInt32          mnDataUpdateId;
36
37
    TOOLS_DLLPRIVATE bool           ImplUpdateConfig() const;
38
    TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const;
39
40
public:
41
                        Config( const OUString& rFileName );
42
                        ~Config();
43
44
    void                SetGroup(const OString& rGroup);
45
0
    const OString&      GetGroup() const { return maGroupName; }
46
    void                DeleteGroup(std::string_view rGroup);
47
    OString             GetGroupName(sal_uInt16 nGroup) const;
48
    sal_uInt16          GetGroupCount() const;
49
    bool                HasGroup(std::string_view rGroup) const;
50
51
    OString             ReadKey(const OString& rKey) const;
52
    OString             ReadKey(const OString& rKey, const OString& rDefault) const;
53
    void                WriteKey(const OString& rKey, const OString& rValue);
54
    void                DeleteKey(std::string_view rKey);
55
    OString             GetKeyName(sal_uInt16 nKey) const;
56
    OString             ReadKey(sal_uInt16 nKey) const;
57
    sal_uInt16          GetKeyCount() const;
58
59
    void                Flush();
60
61
private:
62
                        Config( const Config& rConfig ) = delete;
63
    Config&             operator = ( const Config& rConfig ) = delete;
64
};
65
66
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */