Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svl/itemiter.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
#ifndef INCLUDED_SVL_ITEMITER_HXX
20
#define INCLUDED_SVL_ITEMITER_HXX
21
22
#include <svl/svldllapi.h>
23
#include <svl/itemset.hxx>
24
25
class SfxPoolItem;
26
27
class SVL_DLLPUBLIC SfxItemIter
28
{
29
    const SfxItemSet& m_rSet;
30
    PoolItemMap::const_iterator maCurrent;
31
32
public:
33
    SfxItemIter(const SfxItemSet& rSet)
34
86.1M
        : m_rSet(rSet)
35
86.1M
        , maCurrent(rSet.m_aPoolItemMap.begin())
36
86.1M
    {
37
#ifdef DBG_UTIL
38
        const_cast<SfxItemSet&>(m_rSet).m_nRegisteredSfxItemIter++;
39
#endif
40
86.1M
    }
41
42
#ifdef DBG_UTIL
43
    ~SfxItemIter() { const_cast<SfxItemSet&>(m_rSet).m_nRegisteredSfxItemIter--; }
44
#endif
45
46
    const SfxPoolItem* GetCurItem() const
47
235M
    {
48
235M
        if (IsAtEnd())
49
36.1M
            return nullptr;
50
51
199M
        return maCurrent->second;
52
235M
    }
53
54
    sal_uInt16 GetCurWhich() const
55
4.46M
    {
56
4.46M
        if (IsAtEnd())
57
0
            return 0;
58
59
4.46M
        return maCurrent->first;
60
4.46M
    }
61
62
    const SfxPoolItem* NextItem()
63
150M
    {
64
150M
        if (IsAtEnd())
65
0
            return nullptr;
66
67
150M
        maCurrent++;
68
150M
        return GetCurItem();
69
150M
    }
70
71
395M
    bool IsAtEnd() const { return maCurrent == m_rSet.m_aPoolItemMap.end(); }
72
73
    SfxItemState GetItemState(bool bSrchInParent = true,
74
                              const SfxPoolItem** ppItem = nullptr) const;
75
};
76
77
#endif
78
79
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */