| 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Project: GDAL |
| 4 | * Purpose: Includes PoDoFo headers |
| 5 | * Author: Even Rouault <even dot rouault at spatialys dot com> |
| 6 | * |
| 7 | ****************************************************************************** |
| 8 | * Copyright (c) 2015, Even Rouault <even dot rouault at spatialys dot com> |
| 9 | * |
| 10 | * SPDX-License-Identifier: MIT |
| 11 | *****************************************************************************/ |
| 12 | |
| 13 | #ifndef PDFSDK_HEADERS_PODOFO_H |
| 14 | #define PDFSDK_HEADERS_PODOFO_Hcxx . . $ `frmts/pdf/pdfsdk_headers_podofo.h:14:9`! |
| 15 | |
| 16 | #if defined(__GNUC__cxx . . $ `<built-in>:8:9`!) && !defined(_MSC_VER) |
| 17 | #pragma GCC system_header |
| 18 | #endif |
| 19 | |
| 20 | #ifdef HAVE_PODOFO |
| 21 | |
| 22 | #ifdef _WIN32 |
| 23 | /* |
| 24 | * Some Windows header defines a GetObject macro that |
| 25 | * shadows a GetObject() method in PoDoFo. As pdfdataset.cpp includes cpl_spawn.h |
| 26 | * which includes windows.h, so let's bite the bullet and important windows.h |
| 27 | * right now, and then undef GetObject. Undef'ing GetObject is done in some |
| 28 | * source files of PoDoFo itself. |
| 29 | */ |
| 30 | #include <windows.h> |
| 31 | #ifdef GetObject |
| 32 | #undef GetObject |
| 33 | #endif |
| 34 | #endif |
| 35 | |
| 36 | // Related fix submitted per https://github.com/podofo/podofo/pull/98 |
| 37 | #ifdef HAVE_PODOFO_0_10_OR_LATER |
| 38 | #define USE_HACK_BECAUSE_PdfInputStream_constructor_is_not_exported_in_podofo_0_11 |
| 39 | #endif |
| 40 | |
| 41 | #ifdef USE_HACK_BECAUSE_PdfInputStream_constructor_is_not_exported_in_podofo_0_11 |
| 42 | // If we <sstream> is included after our below #define private public errors out |
| 43 | // with an error like: |
| 44 | // /usr/include/c++/13.2.1/sstream:457:7: error: 'struct std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs' redeclared with different access |
| 45 | // 457 | struct __xfer_bufptrs |
| 46 | // so include it before, as otherwise it would get indirectly included by |
| 47 | // PdfDate.h, which includes <chrono>, which includes <sstream> |
| 48 | #include <sstream> |
| 49 | // Ugly! PfdObjectStream::GetParent() is private but we need it... |
| 50 | #define private public |
| 51 | #endif |
| 52 | #include "podofo.h" |
| 53 | #ifdef private |
| 54 | #undef private |
| 55 | #endif |
| 56 | |
| 57 | #if PODOFO_VERSION_MAJOR > 0 || \ |
| 58 | (PODOFO_VERSION_MAJOR == 0 && PODOFO_VERSION_MINOR >= 10) |
| 59 | #define PdfVecObjects PdfIndirectObjectList |
| 60 | #endif |
| 61 | |
| 62 | #endif // HAVE_PODOFO |
| 63 | |
| 64 | #endif // PDFSDK_HEADERS_PODOFO_H |