CamResourceFixNameEntry Class Reference

List of all members.

Public Types

typedef CamResourceFixNameEntrypCamResourceFixNameEntry

Public Member Functions

 CamResourceFixNameEntry ()

Static Public Member Functions

static UINT32 MakeHash (const TCHAR *k)
static const TCHARFind (const TCHAR *from, const TCHAR *to=NULL)
static void MakeResources ()

Public Attributes

const TCHARMapFrom
const TCHARMapTo
CamResourceFixNameEntrypNext

Static Public Attributes

static pCamResourceFixNameEntrypArray = NULL

Detailed Description

Definition at line 249 of file camresource.cpp.


Member Typedef Documentation

typedef CamResourceFixNameEntry* CamResourceFixNameEntry::pCamResourceFixNameEntry
 

Definition at line 268 of file camresource.cpp.


Constructor & Destructor Documentation

CamResourceFixNameEntry::CamResourceFixNameEntry  )  [inline]
 

Definition at line 325 of file camresource.cpp.

00325 {MapFrom =NULL ; MapTo = NULL ; pNext = NULL;}


Member Function Documentation

static const TCHAR* CamResourceFixNameEntry::Find const TCHAR from,
const TCHAR to = NULL
[inline, static]
 

Definition at line 270 of file camresource.cpp.

00271     {
00272         // Ensure we have an array
00273         if (!pArray)
00274         {
00275             pArray=new pCamResourceFixNameEntry[CRFNH_BUCKETS];
00276             UINT32 i;
00277             for (i=0; i<CRFNH_BUCKETS; i++) pArray[i]=NULL;
00278         }
00279         if (!pArray) return from;
00280         UINT32 h = MakeHash(from);
00281         pCamResourceFixNameEntry * pPoint = &(pArray[h]);
00282         while (*pPoint) // while we have a valid pointer to a "next" item
00283         {
00284             if (!camStrcmp( (*pPoint)->MapFrom, from ) ) return ( (*pPoint)->MapTo );
00285             pPoint = &((*pPoint)->pNext);
00286         }
00287 
00288         // no match - if they have not asked us to insert, return it unaltered
00289         if (!to) return from;
00290         // We now knonw pPoint is a pointer to a NULL CamResourceFixedNameEntry *, where we will insert ourselves
00291         *pPoint = new(CamResourceFixNameEntry);
00292         if (*pPoint)
00293         {
00294             // No need to strdup these as we know this map is only created with constants, because
00295             // the map is created in init phase
00296             (*pPoint)->MapFrom = from;
00297             (*pPoint)->MapTo = to;
00298         }
00299         return to;
00300     }

static UINT32 CamResourceFixNameEntry::MakeHash const TCHAR k  )  [inline, static]
 

Definition at line 252 of file camresource.cpp.

00253     {
00254         UINT32 hash = 0;
00255 
00256         while( *k )
00257         {
00258             hash += *k++;
00259             hash += (hash << 10);
00260             hash ^= (hash >> 6);
00261         }
00262         hash += (hash << 3);
00263         hash ^= (hash >> 11);
00264 
00265         return (hash + (hash << 15)) % CRFNH_BUCKETS;
00266     }

static void CamResourceFixNameEntry::MakeResources  )  [inline, static]
 

Definition at line 302 of file camresource.cpp.

00303     {
00304         if (pArray)
00305         {
00306             INT32 i;
00307             for (i=0; i<CRFNH_BUCKETS; i++)
00308             {
00309                 pCamResourceFixNameEntry p=pArray[i];
00310                 while (p)
00311                 {
00312                     CamResource::GetResourceID(p->MapFrom);
00313                     p = p->pNext;
00314                 }
00315             }
00316         }
00317     }


Member Data Documentation

const TCHAR* CamResourceFixNameEntry::MapFrom
 

Definition at line 319 of file camresource.cpp.

const TCHAR* CamResourceFixNameEntry::MapTo
 

Definition at line 320 of file camresource.cpp.

CamResourceFixNameEntry::pCamResourceFixNameEntry * CamResourceFixNameEntry::pArray = NULL [static]
 

Definition at line 323 of file camresource.cpp.

CamResourceFixNameEntry* CamResourceFixNameEntry::pNext
 

Definition at line 321 of file camresource.cpp.


The documentation for this class was generated from the following file:
Generated on Sat Nov 10 03:51:51 2007 for Camelot by  doxygen 1.4.4