#ifndef CMAP_H
#define CMAP_H
#include <config.h>
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include "gtypes.h"
#include "CharTypes.h"
#if MULTITHREADED
#include "GMutex.h"
#endif
class GString;
struct CMapVectorEntry;
class CMapCache;
class CMap {
public:
static CMap *parse(CMapCache *cache, GString *collectionA,
GString *cMapNameA);
~CMap();
void incRefCnt();
void decRefCnt();
GString *getCollection() { return collection; }
GBool match(GString *collectionA, GString *cMapNameA);
CID getCID(char *s, int len, int *nUsed);
int getWMode() { return wMode; }
private:
CMap(GString *collectionA, GString *cMapNameA);
CMap(GString *collectionA, GString *cMapNameA, int wModeA);
void useCMap(CMapCache *cache, char *useName);
void copyVector(CMapVectorEntry *dest, CMapVectorEntry *src);
void addCodeSpace(CMapVectorEntry *vec, Guint start, Guint end,
Guint nBytes);
void addCIDs(Guint start, Guint end, Guint nBytes, CID firstCID);
void freeCMapVector(CMapVectorEntry *vec);
GString *collection;
GString *cMapName;
int wMode; CMapVectorEntry *vector; int refCnt;
#if MULTITHREADED
GMutex mutex;
#endif
};
#define cMapCacheSize 4
class CMapCache {
public:
CMapCache();
~CMapCache();
CMap *getCMap(GString *collection, GString *cMapName);
private:
CMap *cache[cMapCacheSize];
};
#endif