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

248 lines
7.1 KiB
C++

// EdIRDVLs.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRDVLs.hpp"
#include "EdIRIAWd.hpp"
#include "acp_base.h"
#include "ITF.h"
#include "IncMEC.h"
#include "incAI.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_DesignerVariableList
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_DesignerVariableList::CPA_EdIR_DesignerVariableList()
{
map = new CMapStringToPtr(500);
map1 = new CMapPtrToPtr(500);
map->InitHashTable(500, TRUE);
map1->InitHashTable(500, TRUE);
}
/****************************************************************************/
CPA_EdIR_DesignerVariableList::CPA_EdIR_DesignerVariableList(CPA_EdIR_DesignerVariableList &clDsgVarList)
{
POSITION pos=clDsgVarList.GetHeadPosition();
while(pos!=NULL)
AddTail(clDsgVarList.GetNext(pos));
map = new CMapStringToPtr(500);
map1 = new CMapPtrToPtr(500);
map->InitHashTable(500, TRUE);
map1->InitHashTable(500, TRUE);
}
/****************************************************************************/
CPA_EdIR_DesignerVariableList::~CPA_EdIR_DesignerVariableList()
{
m_fn_vDestroyAndRemoveAllEntries();
}
/****************************************************************************/
void CPA_EdIR_DesignerVariableList::AddTail(CPA_EdIR_DesignerVariable *p)
{
InsertAfter(GetTailPosition(), p);
p->m_csName.MakeLower();
map->SetAt(p->m_csName, (void *) GetCount());
map1->SetAt((void *) (GetCount()-1), GetTailPosition());
}
/****************************************************************************/
CPA_EdIR_DesignerVariableList CPA_EdIR_DesignerVariableList::operator =(CPA_EdIR_DesignerVariableList &clDsgVarList)
{
POSITION pos=clDsgVarList.GetHeadPosition();
while(pos!=NULL)
AddTail(clDsgVarList.GetNext(pos));
return *this;
}
/****************************************************************************/
void CPA_EdIR_DesignerVariableList::m_fn_vDestroyAndRemoveAllEntries()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
RemoveAll();
map->RemoveAll();
map1->RemoveAll();
}
/****************************************************************************/
POSITION CPA_EdIR_DesignerVariableList::m_fn_posGetPosition(long lIndex)
{
void *p;
if(map1->Lookup((void *) lIndex, p))
return (POSITION) p;
return NULL;
}
/****************************************************************************/
POSITION CPA_EdIR_DesignerVariableList::m_fn_posGetPosition(CString &csDesignerVariable)
{
void *p, *p1;
csDesignerVariable.MakeLower();
if(map->Lookup(csDesignerVariable, p))
if(map1->Lookup((void *) ((long) p - 1), p1))
return (POSITION) p1;
return NULL;
}
/****************************************************************************/
long CPA_EdIR_DesignerVariableList::m_fn_bIsADesignerVariable(CString &csDesignerVariable)
{
void *p;
csDesignerVariable.MakeLower();
if(map->Lookup(csDesignerVariable, p))
return (long) p;
return 0;
}
/****************************************************************************/
long CPA_EdIR_DesignerVariableList::m_fn_lGetIndexOfADesignerVariable(CString &csDesignerVariable)
{
POSITION pos=GetHeadPosition();
long lIndex=0;
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
bFound=(GetNext(pos)->m_fn_csGetDesignerVariableName().CompareNoCase(csDesignerVariable)==0);
lIndex++;
}
return lIndex-1;
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetTypeOfADesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetDesignerVariableType();
else
return "";
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetTypeOfADesignerVariable(long lIndex)
{
POSITION pos=m_fn_posGetPosition(lIndex);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetDesignerVariableType();
else
return "";
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetFirstValueOfADesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetFirstDesignerVariableValue();
else
return "";
}
// BEGIN ROMTEAM Cristi Petrescu 99-01- debug
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetFirstValueOfADesignerVariable(long lIndex)
{
POSITION pos=m_fn_posGetPosition(lIndex);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetFirstDesignerVariableValue();
else
return "";
}
// END ROMTEAM Cristi Petrescu 99-01- debug
/****************************************************************************/
CStringList *CPA_EdIR_DesignerVariableList::m_fn_pcslGetValuesOfADesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_pcslGetDesignerVariableValues();
else
return NULL;
}
/****************************************************************************/
long CPA_EdIR_DesignerVariableList::m_fn_lGetSizeOfAllDesignerVariables()
{
long lSizeOfAllDesignerVariables=0;
POSITION pos=GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_DesignerVariable *pclDesignerVariable=GetNext(pos);
tdeDsgVarTypeId tdeVarType;
long lNbEltInList=0;
tdeVarType=(tdeDsgVarTypeId)fn_lGetDsgVarTypeIdFromEditorName(pclDesignerVariable->m_fn_csGetDesignerVariableType());
if((tdeVarType==eDsgVarType_List) ||
(fn_GetDsgVarType(tdeVarType)==E_vt_Array))
lNbEltInList=atol(pclDesignerVariable->m_fn_csGetFirstDesignerVariableValue());
lSizeOfAllDesignerVariables+=fn_ulSizeOfDsgVar(tdeVarType,(unsigned char)lNbEltInList);
}
return lSizeOfAllDesignerVariables;
}
/****************************************************************************/
BOOL CPA_EdIR_DesignerVariableList::m_fn_bDesignerVariableIsInWatchWindow(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_bIsInWatchWindow();
else
return FALSE;
}
/****************************************************************************/
void CPA_EdIR_DesignerVariableList::m_fn_vDesignerVariableSetInWatchWindow(CString csDesignerVariable,BOOL bIsInWatchWindow)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
GetAt(pos)->m_fn_vSetInWatchWindow(bIsInWatchWindow);
}
//BEGIN ROMTEAM Cristi Petrescu 98-06-
//****************************************************************************
BOOL CPA_EdIR_DesignerVariableList::m_fn_bIsPrivateDesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_bIsPrivate ();
else
return FALSE;
}
//END ROMTEAM Cristi Petrescu 98-06-
#endif //D_ED_IR_ACTIVE