Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/include/editeng/EPaM.hxx
Line
Count
Source (jump to first uncovered line)
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
#pragma once
21
22
#include <sal/config.h>
23
24
#include <sal/types.h>
25
26
inline constexpr sal_Int32 EE_PARA_MAX = SAL_MAX_INT32;
27
inline constexpr sal_Int32 EE_TEXTPOS_MAX = SAL_MAX_INT32;
28
29
struct EPaM
30
{
31
0
    static constexpr EPaM NotFound() { return { EE_PARA_MAX, EE_TEXTPOS_MAX }; }
32
33
    sal_Int32 nPara = 0;
34
    sal_Int32 nIndex = 0;
35
36
77.7M
    constexpr EPaM() = default;
37
38
    constexpr EPaM(sal_Int32 _nParagraph, sal_Int32 _nIndex)
39
106M
        : nPara(_nParagraph)
40
106M
        , nIndex(_nIndex)
41
106M
    {
42
106M
    }
43
44
5.23M
    bool operator==(const EPaM&) const = default;
45
46
    bool operator<(const EPaM& rInstance) const
47
343k
    {
48
343k
        return (nPara < rInstance.nPara) || (nPara == rInstance.nPara && nIndex < rInstance.nIndex);
49
343k
    }
50
};
51
52
template <typename charT, typename traits>
53
inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
54
                                                     EPaM const& aPaM)
55
{
56
    return stream << "EPaM(" << aPaM.nPara << ',' << aPaM.nIndex << ")";
57
}
58
59
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */