00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CHARCODETOUNICODE_H
00012 #define CHARCODETOUNICODE_H
00013
00014 #ifdef __GNUC__
00015 #pragma interface
00016 #endif
00017
00018 #include "CharTypes.h"
00019
00020 struct CharCodeToUnicodeString;
00021
00022
00023
00024 class CharCodeToUnicode {
00025 public:
00026
00027
00028
00029
00030 static CharCodeToUnicode *parseCIDToUnicode(GString *collectionA);
00031
00032
00033
00034
00035 static CharCodeToUnicode *make8BitToUnicode(Unicode *toUnicode);
00036
00037
00038 static CharCodeToUnicode *parseCMap(GString *buf, int nBits);
00039
00040 ~CharCodeToUnicode();
00041
00042 void incRefCnt();
00043 void decRefCnt();
00044
00045
00046 GBool match(GString *collectionA);
00047
00048
00049 int mapToUnicode(CharCode c, Unicode *u, int size);
00050
00051 private:
00052
00053 void parseCMap1(int (*getCharFunc)(void *), void *data, int nBits);
00054 CharCodeToUnicode(GString *collectionA);
00055 CharCodeToUnicode(GString *collectionA, Unicode *mapA,
00056 CharCode mapLenA, GBool copyMap,
00057 CharCodeToUnicodeString *sMapA, int sMapLenA);
00058
00059 GString *collection;
00060 Unicode *map;
00061 CharCode mapLen;
00062 CharCodeToUnicodeString *sMap;
00063 int sMapLen, sMapSize;
00064 int refCnt;
00065 };
00066
00067
00068
00069 #define cidToUnicodeCacheSize 4
00070
00071 class CIDToUnicodeCache {
00072 public:
00073
00074 CIDToUnicodeCache();
00075 ~CIDToUnicodeCache();
00076
00077
00078
00079
00080
00081 CharCodeToUnicode *getCIDToUnicode(GString *collection);
00082
00083 private:
00084
00085 CharCodeToUnicode *cache[cidToUnicodeCacheSize];
00086 };
00087
00088 #endif