Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/framework/source/loadenv/targethelper.cxx
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
#include <loadenv/targethelper.hxx>
21
#include <targets.h>
22
23
namespace framework{
24
25
bool TargetHelper::matchSpecialTarget(std::u16string_view sCheckTarget  ,
26
                                                ESpecialTarget   eSpecialTarget)
27
16.7k
{
28
16.7k
    switch(eSpecialTarget)
29
16.7k
    {
30
0
        case ESpecialTarget::Blank :
31
0
            return sCheckTarget == SPECIALTARGET_BLANK;
32
33
0
        case ESpecialTarget::Default :
34
0
            return sCheckTarget == SPECIALTARGET_DEFAULT;
35
36
8.36k
        case ESpecialTarget::Beamer :
37
8.36k
            return sCheckTarget == SPECIALTARGET_BEAMER;
38
39
8.36k
        case ESpecialTarget::HelpTask :
40
8.36k
            return sCheckTarget == SPECIALTARGET_HELPTASK;
41
0
        default:
42
0
            return false;
43
16.7k
    }
44
16.7k
}
45
46
bool TargetHelper::isValidNameForFrame(std::u16string_view sName)
47
8.36k
{
48
    // some special targets are really special ones :-)
49
    // E.g. the are really used to locate one frame inside the frame tree.
50
8.36k
    if (
51
8.36k
        (sName.empty()                                    ) ||
52
8.36k
        (TargetHelper::matchSpecialTarget(sName, ESpecialTarget::HelpTask)) ||
53
8.36k
        (TargetHelper::matchSpecialTarget(sName, ESpecialTarget::Beamer)  )
54
8.36k
       )
55
0
        return true;
56
57
    // all other names must be checked more general
58
    // special targets starts with a "_".
59
8.36k
    return (sName.find('_') != 0);
60
8.36k
}
61
62
} // namespace framework
63
64
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */