Coverage Report

Created: 2025-09-27 07:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poppler/cpp/poppler-private.h
Line
Count
Source
1
/*
2
 * Copyright (C) 2009, Pino Toscano <pino@kde.org>
3
 * Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
4
 * Copyright (C) 2014, Hans-Peter Deifel <hpdeifel@gmx.de>
5
 * Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
6
 * Copyright (C) 2018, 2020, Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
7
 * Copyright (C) 2018, 2020 Adam Reichold <adam.reichold@t-online.de>
8
 * Copyright (C) 2018, 2020, 2024 Albert Astals Cid <aacid@kde.org>
9
 * Copyright (C) 2018, Zsombor Hollay-Horvath <hollay.horvath@gmail.com>
10
 * Copyright (C) 2025 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk>
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2, or (at your option)
15
 * any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
25
 */
26
27
#ifndef POPPLER_PRIVATE_H
28
#define POPPLER_PRIVATE_H
29
30
#include "poppler-global.h"
31
#include "poppler-rectangle.h"
32
#include "poppler-page.h" // to use text_box::writing_mode_enum
33
34
#include "Error.h"
35
#include "CharTypes.h"
36
37
#include <cstdarg>
38
39
class GooString;
40
class PDFRectangle;
41
42
#define PSTR(str) (const_cast<char *>(str))
43
44
namespace poppler {
45
46
namespace detail {
47
48
extern debug_func user_debug_function;
49
extern void *debug_closure;
50
void error_function(ErrorCategory category, Goffset pos, const char *msg);
51
52
rectf pdfrectangle_to_rectf(const PDFRectangle &pdfrect);
53
54
ustring unicode_GooString_to_ustring(const GooString *str);
55
ustring unicode_to_ustring(const Unicode *u, int length);
56
std::unique_ptr<GooString> ustring_to_unicode_GooString(const ustring &str);
57
58
}
59
60
template<typename ConstIterator>
61
void delete_all(ConstIterator it, ConstIterator end)
62
50.4k
{
63
186k
    while (it != end) {
64
135k
        delete *it++;
65
135k
    }
66
50.4k
}
void poppler::delete_all<std::__1::__wrap_iter<poppler::embedded_file* const*> >(std::__1::__wrap_iter<poppler::embedded_file* const*>, std::__1::__wrap_iter<poppler::embedded_file* const*>)
Line
Count
Source
62
50.4k
{
63
186k
    while (it != end) {
64
135k
        delete *it++;
65
135k
    }
66
50.4k
}
Unexecuted instantiation: void poppler::delete_all<std::__1::__wrap_iter<poppler::toc_item* const*> >(std::__1::__wrap_iter<poppler::toc_item* const*>, std::__1::__wrap_iter<poppler::toc_item* const*>)
67
68
template<typename Collection>
69
void delete_all(const Collection &c)
70
50.4k
{
71
50.4k
    delete_all(c.begin(), c.end());
72
50.4k
}
void poppler::delete_all<std::__1::vector<poppler::embedded_file*, std::__1::allocator<poppler::embedded_file*> > >(std::__1::vector<poppler::embedded_file*, std::__1::allocator<poppler::embedded_file*> > const&)
Line
Count
Source
70
50.4k
{
71
50.4k
    delete_all(c.begin(), c.end());
72
50.4k
}
Unexecuted instantiation: void poppler::delete_all<std::__1::vector<poppler::toc_item*, std::__1::allocator<poppler::toc_item*> > >(std::__1::vector<poppler::toc_item*, std::__1::allocator<poppler::toc_item*> > const&)
73
74
class font_info;
75
struct text_box_font_info_data
76
{
77
    ~text_box_font_info_data();
78
79
    double font_size;
80
    std::vector<text_box::writing_mode_enum> wmodes;
81
82
    /*
83
     * a duplication of the font_info_cache created by the
84
     * poppler::font_iterator and owned by the poppler::page
85
     * object. Its lifetime might differ from that of text_box
86
     * object (think about collecting all text_box objects
87
     * from all pages), so we have to duplicate it into all
88
     * text_box instances.
89
     */
90
    std::vector<font_info> font_info_cache;
91
92
    /*
93
     * a std::vector from the glyph index in the owner
94
     * text_box to the font_info index in font_info_cache.
95
     * The "-1" means no corresponding fonts found in the
96
     * cache.
97
     */
98
    std::vector<int> glyph_to_cache_index;
99
};
100
101
class font_info;
102
struct text_box_data
103
{
104
    ~text_box_data();
105
106
    ustring text;
107
    rectf bbox;
108
    int rotation;
109
    std::vector<rectf> char_bboxes;
110
    bool has_space_after;
111
112
    std::unique_ptr<text_box_font_info_data> text_box_font;
113
};
114
115
}
116
117
#endif