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

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

PDF plugin: Poppler library updated to version 0.10.0

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