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