source: trunk/poppler/mypoppler/poppler/CMap.h @ 250

Last change on this file since 250 was 250, checked in by Eugene Romanenko, 13 years ago

PDF plugin: poppler library updated to version 0.8.3

File size: 2.7 KB
Line 
1//========================================================================
2//
3// CMap.h
4//
5// Copyright 2001-2003 Glyph & Cog, LLC
6//
7//========================================================================
8
9#ifndef CMAP_H
10#define CMAP_H
11
12#ifdef USE_GCC_PRAGMAS
13#pragma interface
14#endif
15
16#include "poppler-config.h"
17#include "goo/gtypes.h"
18#include "CharTypes.h"
19
20#if MULTITHREADED
21#include "goo/GooMutex.h"
22#endif
23
24class GooString;
25struct CMapVectorEntry;
26class CMapCache;
27
28//------------------------------------------------------------------------
29
30class CMap {
31public:
32
33  // Create the CMap specified by <collection> and <cMapName>.  Sets
34  // the initial reference count to 1.  Returns NULL on failure.
35  static CMap *parse(CMapCache *cache, GooString *collectionA,
36                     GooString *cMapNameA);
37
38  ~CMap();
39
40  void incRefCnt();
41  void decRefCnt();
42
43  // Return collection name (<registry>-<ordering>).
44  GooString *getCollection() { return collection; }
45
46  // Return true if this CMap matches the specified <collectionA>, and
47  // <cMapNameA>.
48  GBool match(GooString *collectionA, GooString *cMapNameA);
49
50  // Return the CID corresponding to the character code starting at
51  // <s>, which contains <len> bytes.  Sets *<nUsed> to the number of
52  // bytes used by the char code.
53  CID getCID(char *s, int len, int *nUsed);
54
55  // Return the writing mode (0=horizontal, 1=vertical).
56  int getWMode() { return wMode; }
57
58  void setReverseMap(Guint *rmap, Guint rmapSize, Guint ncand);
59
60private:
61
62  CMap(GooString *collectionA, GooString *cMapNameA);
63  CMap(GooString *collectionA, GooString *cMapNameA, int wModeA);
64  void useCMap(CMapCache *cache, char *useName);
65  void copyVector(CMapVectorEntry *dest, CMapVectorEntry *src);
66  void addCodeSpace(CMapVectorEntry *vec, Guint start, Guint end,
67                    Guint nBytes);
68  void addCIDs(Guint start, Guint end, Guint nBytes, CID firstCID);
69  void freeCMapVector(CMapVectorEntry *vec);
70  void setReverseMapVector(Guint startCode, CMapVectorEntry *vec,
71          Guint *rmap, Guint rmapSize, Guint ncand);
72
73  GooString *collection;
74  GooString *cMapName;
75  int wMode;                    // writing mode (0=horizontal, 1=vertical)
76  CMapVectorEntry *vector;      // vector for first byte (NULL for
77                                //   identity CMap)
78  int refCnt;
79#if MULTITHREADED
80  GooMutex mutex;
81#endif
82};
83
84//------------------------------------------------------------------------
85
86#define cMapCacheSize 4
87
88class CMapCache {
89public:
90
91  CMapCache();
92  ~CMapCache();
93
94  // Get the <cMapName> CMap for the specified character collection.
95  // Increments its reference count; there will be one reference for
96  // the cache plus one for the caller of this function.  Returns NULL
97  // on failure.
98  CMap *getCMap(GooString *collection, GooString *cMapName);
99
100private:
101
102  CMap *cache[cMapCacheSize];
103};
104
105#endif
Note: See TracBrowser for help on using the repository browser.