Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/IconThemeScanner.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
10
#pragma once
11
12
#include <vcl/dllapi.h>
13
14
#include <rtl/ustring.hxx>
15
#include <vcl/IconThemeInfo.hxx>
16
#include <vcl/UserResourceScanner.hxx>
17
18
#include <memory>
19
#include <vector>
20
21
// forward declaration of unit test class. Required for friend relationship.
22
class IconThemeScannerTest;
23
24
namespace vcl
25
{
26
/** This class scans a folder for icon themes and provides the results.
27
 */
28
class VCL_DLLPUBLIC IconThemeScanner : public UserResourceScanner
29
{
30
public:
31
    IconThemeScanner();
32
33
    /** This method will return the standard path where icon themes are located.
34
     */
35
    static OUString GetStandardIconThemePath();
36
37
266
    const std::vector<IconThemeInfo>& GetFoundIconThemes() const { return mFoundIconThemes; }
38
39
    /** Get the IconThemeInfo for a theme.
40
     * If the theme id is not among the found themes, a std::runtime_error will be thrown.
41
     * Use IconThemeIsInstalled() to check whether it is available.
42
     */
43
    const IconThemeInfo& GetIconThemeInfo(const OUString& themeId);
44
45
    /** Checks whether the theme with the provided name has been found in the
46
     * scanned directory.
47
     */
48
    bool IconThemeIsInstalled(const OUString& themeId) const;
49
50
private:
51
    /** Adds the provided icon theme by path. */
52
    bool addResource(const OUString& path) override;
53
54
    /** Check whether a single file is valid */
55
    bool isValidResource(const OUString& rFilename) override;
56
57
    std::vector<IconThemeInfo> mFoundIconThemes;
58
59
    friend class ::IconThemeScannerTest;
60
};
61
62
} // end namespace vcl
63
64
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */