1 | /* |
2 | * Copyright (C) 2009-2010, Pino Toscano <pino@kde.org> |
3 | * Copyright (C) 2010, Patrick Spendrin <ps_ml@gmx.de> |
4 | * Copyright (C) 2014, Hans-Peter Deifel <hpdeifel@gmx.de> |
5 | * Copyright (C) 2018, Adam Reichold <adam.reichold@t-online.de> |
6 | * Copyright (C) 2021, 2022, Albert Astals Cid <aacid@kde.org> |
7 | * Copyright (C) 2022, Tobias C. Berner <tcberner@gmail.com> |
8 | * Copyright (C) 2022, Oliver Sander <oliver.sander@tu-dresden.de> |
9 | * Copyright (C) 2024, hugegameartgd@gmail.com |
10 | * |
11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2, or (at your option) |
14 | * any later version. |
15 | * |
16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | * GNU General Public License for more details. |
20 | * |
21 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
24 | */ |
25 | |
26 | #ifndef POPPLER_GLOBAL_H |
27 | #define POPPLER_GLOBAL_H |
28 | |
29 | #include "poppler_cpp_export.h" |
30 | |
31 | #include <ctime> |
32 | #include <iosfwd> |
33 | #include <string> |
34 | #include <vector> |
35 | |
36 | namespace poppler { |
37 | |
38 | /// \cond DOXYGEN_SKIP_THIS |
39 | namespace detail { |
40 | |
41 | class POPPLER_CPP_EXPORT noncopyable |
42 | { |
43 | public: |
44 | noncopyable(const noncopyable &) = delete; |
45 | const noncopyable &operator=(const noncopyable &) = delete; |
46 | |
47 | protected: |
48 | noncopyable(); |
49 | ~noncopyable(); |
50 | noncopyable &operator=(noncopyable &&other) noexcept; |
51 | }; |
52 | |
53 | } |
54 | |
55 | typedef detail::noncopyable noncopyable; |
56 | /// \endcond |
57 | |
58 | enum rotation_enum |
59 | { |
60 | rotate_0, |
61 | rotate_90, |
62 | rotate_180, |
63 | rotate_270 |
64 | }; |
65 | |
66 | enum page_box_enum |
67 | { |
68 | media_box, |
69 | crop_box, |
70 | bleed_box, |
71 | trim_box, |
72 | art_box |
73 | }; |
74 | |
75 | enum permission_enum |
76 | { |
77 | perm_print, |
78 | perm_change, |
79 | perm_copy, |
80 | perm_add_notes, |
81 | perm_fill_forms, |
82 | perm_accessibility, |
83 | perm_assemble, |
84 | perm_print_high_resolution |
85 | }; |
86 | |
87 | enum case_sensitivity_enum |
88 | { |
89 | case_sensitive, |
90 | case_insensitive |
91 | }; |
92 | |
93 | typedef std::vector<char> byte_array; |
94 | |
95 | typedef unsigned int /* time_t */ time_type; |
96 | |
97 | // to disable warning only for this occurrence |
98 | #ifdef _MSC_VER |
99 | # pragma warning(push) |
100 | # pragma warning(disable : 4251) /* class 'A' needs to have dll interface for to be used by clients of class 'B'. */ |
101 | #endif |
102 | class POPPLER_CPP_EXPORT ustring : public std::basic_string<char16_t> |
103 | { |
104 | public: |
105 | ustring(); |
106 | ustring(size_type len, value_type ch); |
107 | ~ustring(); |
108 | |
109 | byte_array to_utf8() const; |
110 | std::string to_latin1() const; |
111 | |
112 | static ustring from_utf8(const char *str, int len = -1); |
113 | static ustring from_latin1(const std::string &str); |
114 | |
115 | private: |
116 | // forbid implicit std::string conversions |
117 | explicit ustring(const std::string &); |
118 | explicit operator std::string() const; |
119 | ustring &operator=(const std::string &); |
120 | }; |
121 | #ifdef _MSC_VER |
122 | # pragma warning(pop) |
123 | #endif |
124 | |
125 | [[deprecated]] POPPLER_CPP_EXPORT time_type convert_date(const std::string &date); |
126 | |
127 | POPPLER_CPP_EXPORT time_t convert_date_t(const std::string &date); |
128 | |
129 | POPPLER_CPP_EXPORT std::ostream &operator<<(std::ostream &stream, const byte_array &array); |
130 | |
131 | POPPLER_CPP_EXPORT bool set_data_dir(const std::string &new_data_dir); |
132 | |
133 | typedef void (*debug_func)(const std::string &, void *); |
134 | |
135 | POPPLER_CPP_EXPORT void set_debug_error_function(debug_func debug_function, void *closure); |
136 | |
137 | } |
138 | |
139 | #endif |
140 | |