00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef CMAP_H
00010 #define CMAP_H
00011
00012 #ifdef __GNUC__
00013 #pragma interface
00014 #endif
00015
00016 #include "gtypes.h"
00017 #include "CharTypes.h"
00018
00019 class GString;
00020 struct CMapVectorEntry;
00021 class CMapCache;
00022
00023
00024
00025 class CMap {
00026 public:
00027
00028
00029
00030 static CMap *parse(CMapCache *cache, GString *collectionA,
00031 GString *cMapNameA);
00032
00033 ~CMap();
00034
00035 void incRefCnt();
00036 void decRefCnt();
00037
00038
00039 GString *getCollection() { return collection; }
00040
00041
00042
00043 GBool match(GString *collectionA, GString *cMapNameA);
00044
00045
00046
00047
00048 CID getCID(char *s, int len, int *nUsed);
00049
00050
00051 int getWMode() { return wMode; }
00052
00053 private:
00054
00055 CMap(GString *collectionA, GString *cMapNameA);
00056 CMap(GString *collectionA, GString *cMapNameA, int wModeA);
00057 void useCMap(CMapCache *cache, char *useName);
00058 void copyVector(CMapVectorEntry *dest, CMapVectorEntry *src);
00059 void addCodeSpace(CMapVectorEntry *vec, Guint start, Guint end,
00060 Guint nBytes);
00061 void addCIDs(Guint start, Guint end, Guint nBytes, CID firstCID);
00062 void freeCMapVector(CMapVectorEntry *vec);
00063
00064 GString *collection;
00065 GString *cMapName;
00066 int wMode;
00067 CMapVectorEntry *vector;
00068
00069 int refCnt;
00070 };
00071
00072
00073
00074 #define cMapCacheSize 4
00075
00076 class CMapCache {
00077 public:
00078
00079 CMapCache();
00080 ~CMapCache();
00081
00082
00083
00084
00085
00086 CMap *getCMap(GString *collection, GString *cMapName);
00087
00088 private:
00089
00090 CMap *cache[cMapCacheSize];
00091 };
00092
00093 #endif