Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/UserResourceScanner.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
#include <rtl/ustring.hxx>
14
#include <vector>
15
#include <deque>
16
17
namespace osl
18
{
19
class FileStatus;
20
}
21
22
namespace vcl
23
{
24
namespace file
25
{
26
VCL_DLLPUBLIC bool readFileStatus(osl::FileStatus& rStatus, const OUString& rFile);
27
VCL_DLLPUBLIC void splitPathString(std::u16string_view aPathString, std::deque<OUString>& rPaths);
28
}
29
30
class VCL_DLLPUBLIC UserResourceScanner
31
{
32
protected:
33
    /** Scans the provided directory for the resource.
34
     *
35
     * The returned strings will contain the URLs to the resources.
36
     */
37
    std::vector<OUString> readFilesFromPath(const OUString& dir);
38
39
    /** Return true if the filename is a valid resource */
40
    virtual bool isValidResource(const OUString& rFilename) = 0;
41
42
    /** Adds the provided resource by path. */
43
    virtual bool addResource(const OUString& /*path*/) = 0;
44
45
public:
46
    UserResourceScanner();
47
19
    virtual ~UserResourceScanner() {}
48
49
    /** Provide a semicolon-separated list of paths to search for resource.
50
     *
51
     * There are several cases when scan will fail:
52
     * - The directory does not exist
53
     * - There are no files which have a valid resource
54
     */
55
56
    void addPaths(std::u16string_view paths);
57
};
58
59
} // end namespace vcl
60
61
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */