Debian Codegraph @

src/pdfgrep.h

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2015-2023 by Hans-Peter Deifel *
3 * [email protected] *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
18 * Boston, MA 02110-1301 USA. *
19 ***************************************************************************/
20
21 #ifndef PDFGREP_H
22 #define PDFGREP_H
23
24 #include "config.h"
25 #include "exclude.h"
26 #include "intervals.h"
27
28 #include <vector>
29 #include <string>
30
31 /* Exit codes. */
32 enum {
33 /* EXIT_SUCCESS = 0 */
34
35 // no match was found
36 EXIT_NOT_FOUND = 1,
37 // an error occured
38 EXIT_ERROR = 2,
39 };
40
41 enum class Recursion {
42 NONE,
43 FOLLOW_SYMLINKS,
44 DONT_FOLLOW_SYMLINKS
45 };
46
47 struct Colorconf {
48 char *filename;
49 char *pagenum;
50 char *highlight;
51 char *separator;
52 };
53
54 enum class PagenumType { INDEX, LABEL };
55
56 // Controls, what to print
57 struct Outconf {
58 bool filename = false;
59 bool pagenum = false;
60 PagenumType pagenum_type = PagenumType::INDEX;
61 bool color = false;
62 bool only_matching = false;
63 bool null_byte_sep = false;
64 std::string prefix_sep = ":";
65
66 // true, if we need to print context separators between lines
67 bool context_mode = false;
68 int context_before = 0;
69 int context_after = 0;
70
71 Colorconf colors;
72 };
73
74 enum class OnlyFilenames {
75 NOPE,
76 WITH_MATCHES,
77 WITHOUT_MATCH
78 };
79
80 struct Options {
81 bool ignore_case = false;
82 Recursion recursive = Recursion::NONE;
83 bool count = false;
84 bool pagecount = false;
85 bool quiet = false;
86 // vector of all passwords to try on any pdf
87 std::vector<std::string> passwords;
88 int max_count = 0;
89 bool debug = 0;
90 bool warn_empty = false;
91 #ifdef HAVE_UNAC
92 bool use_unac = false;
93 #endif
94 Outconf outconf;
95 ExcludeList excludes;
96 ExcludeList includes;
97 bool use_cache = false;
98 std::string cache_directory;
99 IntervalContainer page_range;
100 OnlyFilenames only_filenames = OnlyFilenames::NOPE;
101 };
102
103 #ifdef HAVE_UNAC
104 /* convenience layer over libunac */
105 std::string simple_unac(const Options &opts, const std::string str);
106 #endif
107
108 #endif /* PDFGREP_H */
109
110 /* Local Variables: */
111 /* mode: c++ */
112 /* End: */