reman3/Rayman_X/cpa/tempgrp/TIA/Src/EdIRCsLs.cpp

115 lines
2.8 KiB
C++

// EdIRMacL.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRCsLs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_ConstantList
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_ConstantList::CPA_EdIR_ConstantList()
{
map = new CMapStringToPtr(500);
map->InitHashTable(500, TRUE);
}
/****************************************************************************/
CPA_EdIR_ConstantList::~CPA_EdIR_ConstantList()
{
m_fn_vDestroyAndRemoveAllEntries();
}
/****************************************************************************/
void CPA_EdIR_ConstantList::m_fn_vDestroyAndRemoveAllEntries()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
RemoveAll();
map->RemoveAll();
}
/****************************************************************************/
void CPA_EdIR_ConstantList::m_fn_vAdd(CString csType,CString csName,CString csValue)
{
CPA_EdIR_Constant *pclConstant=new CPA_EdIR_Constant(csType,csName,csValue);
AddTail(pclConstant);
csName.MakeLower();
map->SetAt(csName, (void *) pclConstant);
}
/****************************************************************************/
CPA_EdIR_Constant * CPA_EdIR_ConstantList::m_fn_pAdd(CString csType,CString csName,CString csValue)
{
CPA_EdIR_Constant *pclConstant=new CPA_EdIR_Constant(csType,csName,csValue);
AddTail(pclConstant);
csName.MakeLower();
map->SetAt(csName, (void *) pclConstant);
return pclConstant;
}
/****************************************************************************/
void CPA_EdIR_ConstantList::m_fn_vRemove(CString csName)
{
POSITION pos=GetHeadPosition();
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
bFound=(GetAt(pos)->m_fn_csGetConstantName().CompareNoCase(csName)==0);
if(!bFound)
GetNext(pos);
}
if(pos!=NULL)
{
csName.MakeLower();
if(map->RemoveKey(csName))
delete GetAt(pos);
RemoveAt(pos);
}
}
/****************************************************************************/
BOOL CPA_EdIR_ConstantList::m_fn_bIsAConstant(CString &csConstant)
{
void *p;
return map->Lookup(csConstant, p);
}
/****************************************************************************/
CString CPA_EdIR_ConstantList::m_fn_csGetValueOfAConstant(CString &csConstant)
{
void *p;
map->Lookup(csConstant, p);
return ((CPA_EdIR_Constant *) p)->m_csValue;
}
/****************************************************************************/
CString CPA_EdIR_ConstantList::m_fn_csGetTypeOfAConstant(CString &csConstant)
{
void *p;
map->Lookup(csConstant, p);
return ((CPA_EdIR_Constant *) p)->m_csType;
}
#endif //D_ED_IR_ACTIVE