CharCodeToUnicode.h [plain text]
#ifndef CHARCODETOUNICODE_H
#define CHARCODETOUNICODE_H
#include <config.h>
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include "CharTypes.h"
#if MULTITHREADED
#include "GMutex.h"
#endif
struct CharCodeToUnicodeString;
class CharCodeToUnicode {
public:
static CharCodeToUnicode *parseCIDToUnicode(GString *fileName,
GString *collection);
static CharCodeToUnicode *parseUnicodeToUnicode(GString *fileName);
static CharCodeToUnicode *make8BitToUnicode(Unicode *toUnicode);
static CharCodeToUnicode *parseCMap(GString *buf, int nBits);
void mergeCMap(GString *buf, int nBits);
~CharCodeToUnicode();
void incRefCnt();
void decRefCnt();
GBool match(GString *tagA);
void setMapping(CharCode c, Unicode *u, int len);
int mapToUnicode(CharCode c, Unicode *u, int size);
CharCode getLength() { return mapLen; }
private:
void parseCMap1(int (*getCharFunc)(void *), void *data, int nBits);
void addMapping(CharCode code, char *uStr, int n, int offset);
CharCodeToUnicode(GString *tagA);
CharCodeToUnicode(GString *tagA, Unicode *mapA,
CharCode mapLenA, GBool copyMap,
CharCodeToUnicodeString *sMapA,
int sMapLenA, int sMapSizeA);
GString *tag;
Unicode *map;
CharCode mapLen;
CharCodeToUnicodeString *sMap;
int sMapLen, sMapSize;
int refCnt;
#if MULTITHREADED
GMutex mutex;
#endif
};
class CharCodeToUnicodeCache {
public:
CharCodeToUnicodeCache(int sizeA);
~CharCodeToUnicodeCache();
CharCodeToUnicode *getCharCodeToUnicode(GString *tag);
void add(CharCodeToUnicode *ctu);
private:
CharCodeToUnicode **cache;
int size;
};
#endif