poppler-global.h 3.25 KB
Newer Older
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>
Albert Astals Cid's avatar
Albert Astals Cid committed
5
 * Copyright (C) 2018, Adam Reichold <adam.reichold@t-online.de>
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef POPPLER_GLOBAL_H
#define POPPLER_GLOBAL_H

#if defined(_WIN32)
#  define LIB_EXPORT __declspec(dllexport)
#  define LIB_IMPORT __declspec(dllimport)
#else
#  define LIB_EXPORT
#  define LIB_IMPORT
#endif

#if defined(poppler_cpp_EXPORTS)
#  define POPPLER_CPP_EXPORT LIB_EXPORT
#else
#  define POPPLER_CPP_EXPORT LIB_IMPORT
#endif

39
#include <iosfwd>
40
#include <string>
41
#include <vector>
42 43 44 45

namespace poppler
{

46
/// \cond DOXYGEN_SKIP_THIS
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
namespace detail
{

class POPPLER_CPP_EXPORT noncopyable
{
protected:
    noncopyable();
    ~noncopyable();
private:
    noncopyable(const noncopyable &);
    const noncopyable& operator=(const noncopyable &);
};

}

typedef detail::noncopyable noncopyable;
63
/// \endcond
64 65 66 67 68

enum rotation_enum { rotate_0, rotate_90, rotate_180, rotate_270 };

enum page_box_enum { media_box, crop_box, bleed_box, trim_box, art_box };

69 70 71 72
enum permission_enum { perm_print, perm_change, perm_copy, perm_add_notes,
                       perm_fill_forms, perm_accessibility, perm_assemble,
                       perm_print_high_resolution };

73 74
enum case_sensitivity_enum { case_sensitive, case_insensitive };

75 76
typedef std::vector<char> byte_array;

77 78
typedef unsigned int /* time_t */ time_type;

79 80 81 82 83
// to disable warning only for this occurrence
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) /* class 'A' needs to have dll interface for to be used by clients of class 'B'. */
#endif
84 85 86 87 88 89 90
class POPPLER_CPP_EXPORT ustring : public std::basic_string<unsigned short>
{
public:
    ustring();
    ustring(size_type len, value_type ch);
    ~ustring();

91
    byte_array to_utf8() const;
92 93
    std::string to_latin1() const;

94
    static ustring from_utf8(const char *str, int len = -1);
95 96 97 98 99 100 101 102
    static ustring from_latin1(const std::string &str);

private:
    // forbid implicit std::string conversions
    ustring(const std::string &);
    operator std::string() const;
    ustring& operator=(const std::string &);
};
103 104 105
#ifdef _MSC_VER
#pragma warning(pop)
#endif
106

107
POPPLER_CPP_EXPORT time_type convert_date(const std::string &date);
108

109 110
POPPLER_CPP_EXPORT std::ostream& operator<<(std::ostream& stream, const byte_array &array);

111 112
POPPLER_CPP_EXPORT bool set_data_dir(const std::string &new_data_dir);

113 114 115 116
typedef void(*debug_func)(const std::string &, void *);

POPPLER_CPP_EXPORT void set_debug_error_function(debug_func debug_function, void *closure);

117 118 119
}

#endif