LCOV - code coverage report
Current view: directory - frmts/pdf - pdfobject.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2011-12-18 Functions: 4 4 100.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: pdfobject.h 22503 2011-06-04 22:08:34Z rouault $
       3                 :  *
       4                 :  * Project:  PDF driver
       5                 :  * Purpose:  GDALDataset driver for PDF dataset.
       6                 :  * Author:   Even Rouault, <even dot rouault at mines dash paris dot org>
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2011, Even Rouault
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  *
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  *
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : #ifndef PDFOBJECT_H_INCLUDED
      31                 : #define PDFOBJECT_H_INCLUDED
      32                 : 
      33                 : #include "cpl_string.h"
      34                 : #include <map>
      35                 : 
      36                 : #ifdef USE_POPPLER
      37                 : 
      38                 : /* begin of poppler xpdf includes */
      39                 : #include <poppler/Object.h>
      40                 : 
      41                 : #define private public /* Ugly! Page::pageObj is private but we need it... */
      42                 : #include <poppler/Page.h>
      43                 : #undef private
      44                 : 
      45                 : #include <poppler/Dict.h>
      46                 : 
      47                 : #define private public /* Ugly! Catalog::optContent is private but we need it... */
      48                 : #include <poppler/Catalog.h>
      49                 : #undef private
      50                 : 
      51                 : #define private public  /* Ugly! PDFDoc::str is private but we need it... */
      52                 : #include <poppler/PDFDoc.h>
      53                 : #undef private
      54                 : 
      55                 : #include <poppler/splash/SplashBitmap.h>
      56                 : #include <poppler/splash/Splash.h>
      57                 : #include <poppler/SplashOutputDev.h>
      58                 : #include <poppler/GlobalParams.h>
      59                 : #include <poppler/ErrorCodes.h>
      60                 : /* end of poppler xpdf includes */
      61                 : 
      62                 : #else
      63                 : 
      64                 : #include "podofo.h"
      65                 : 
      66                 : #endif
      67                 : 
      68                 : typedef enum
      69                 : {
      70                 :     PDFObjectType_Unknown,
      71                 :     PDFObjectType_Int,
      72                 :     PDFObjectType_Real,
      73                 :     PDFObjectType_String,
      74                 :     PDFObjectType_Name,
      75                 :     PDFObjectType_Array,
      76                 :     PDFObjectType_Dictionary
      77                 : } GDALPDFObjectType;
      78                 : 
      79                 : class GDALPDFDictionary;
      80                 : class GDALPDFArray;
      81                 : 
      82                 : class GDALPDFObject
      83             142 : {
      84                 :     public:
      85                 :         virtual ~GDALPDFObject();
      86                 : 
      87                 :         virtual GDALPDFObjectType GetType() = 0;
      88                 :         virtual const char*       GetTypeName() = 0;
      89                 :         virtual int               GetInt() = 0;
      90                 :         virtual double            GetReal() = 0;
      91                 :         virtual const CPLString&  GetString() = 0;
      92                 :         virtual const CPLString&  GetName() = 0;
      93                 :         virtual GDALPDFDictionary*  GetDictionary() = 0;
      94                 :         virtual GDALPDFArray*       GetArray() = 0;
      95                 : };
      96                 : 
      97                 : class GDALPDFDictionary
      98              16 : {
      99                 :     public:
     100                 :         virtual ~GDALPDFDictionary();
     101                 : 
     102                 :         virtual GDALPDFObject* Get(const char* pszKey) = 0;
     103                 :         virtual std::map<CPLString, GDALPDFObject*>& GetValues() = 0;
     104                 : 
     105                 : };
     106                 : 
     107                 : class GDALPDFArray
     108              18 : {
     109                 :     public:
     110                 :         virtual ~GDALPDFArray();
     111                 : 
     112                 :         virtual int GetLength() = 0;
     113                 :         virtual GDALPDFObject* Get(int nIndex) = 0;
     114                 : };
     115                 : 
     116                 : 
     117                 : #ifdef USE_POPPLER
     118                 : 
     119                 : class GDALPDFObjectPoppler : public GDALPDFObject
     120                 : {
     121                 :     private:
     122                 :         Object* m_po;
     123                 :         int     m_bDestroy;
     124                 :         GDALPDFDictionary* m_poDict;
     125                 :         GDALPDFArray* m_poArray;
     126                 :         CPLString osStr;
     127                 : 
     128                 :     public:
     129             142 :         GDALPDFObjectPoppler(Object* po, int bDestroy) : m_po(po), m_bDestroy(bDestroy), m_poDict(NULL), m_poArray(NULL) {}
     130                 : 
     131                 :         virtual ~GDALPDFObjectPoppler();
     132                 : 
     133                 :         virtual GDALPDFObjectType GetType();
     134                 :         virtual const char*       GetTypeName();
     135                 :         virtual int               GetInt();
     136                 :         virtual double            GetReal();
     137                 :         virtual const CPLString&  GetString();
     138                 :         virtual const CPLString&  GetName();
     139                 :         virtual GDALPDFDictionary*  GetDictionary();
     140                 :         virtual GDALPDFArray*       GetArray();
     141                 : };
     142                 : 
     143                 : #else
     144                 : 
     145                 : class GDALPDFObjectPodofo : public GDALPDFObject
     146                 : {
     147                 :     private:
     148                 :         PoDoFo::PdfObject* m_po;
     149                 :         PoDoFo::PdfVecObjects& m_poObjects;
     150                 :         GDALPDFDictionary* m_poDict;
     151                 :         GDALPDFArray* m_poArray;
     152                 :         CPLString osStr;
     153                 : 
     154                 :     public:
     155                 :         GDALPDFObjectPodofo(PoDoFo::PdfObject* po, PoDoFo::PdfVecObjects& poObjects);
     156                 : 
     157                 :         virtual ~GDALPDFObjectPodofo();
     158                 : 
     159                 :         virtual GDALPDFObjectType GetType();
     160                 :         virtual const char*       GetTypeName();
     161                 :         virtual int               GetInt();
     162                 :         virtual double            GetReal();
     163                 :         virtual const CPLString&  GetString();
     164                 :         virtual const CPLString&  GetName();
     165                 :         virtual GDALPDFDictionary*  GetDictionary();
     166                 :         virtual GDALPDFArray*       GetArray();
     167                 : };
     168                 : 
     169                 : #endif
     170                 : 
     171                 : #endif // PDFOBJECT_H_INCLUDED

Generated by: LCOV version 1.7