Files
Sun1602/Tools/SunUpdateManager/UpdateCommon/FunctionMap.cpp
T
2022-10-26 12:25:11 +08:00

60 lines
1.1 KiB
C++

#include "StdAfx.h"
#include ".\functionmap.h"
FunctionMap::FunctionMap(void)
{
}
FunctionMap::~FunctionMap(void)
{
}
VOID FunctionMap::Release()
{
for( FUNC_ITER itr = m_mapFucntion.begin(); itr != m_mapFucntion.end();)
{
BASE_FUNC *pFunc = itr->second;
if( pFunc )
{
delete pFunc;
pFunc = NULL;
}
itr = m_mapFucntion.erase(itr);
}
}
BOOL FunctionMap::Add( BASE_FUNC* pFunc )
{
FUNC_ITER iter;
//현재 똑같은 키 값이 있는지 체크.
if( m_mapFucntion.size() > 0 )
{
iter = m_mapFucntion.find( pFunc->m_wFuncKey );
if( iter != m_mapFucntion.end() ) //현재 똑깥은 키값이 있다면.
return FALSE;
}
//여기에 오면.. 맵 데이터가 없거나, 똑같은 키 값이 없는 경우이다.
m_mapFucntion.insert( std::make_pair(pFunc->m_wFuncKey, pFunc) );
return TRUE;
}
BASE_FUNC* FunctionMap::Find( WORD wFuncKey )
{
FUNC_ITER iter;
BASE_FUNC* pFindFunc = NULL;
//현재 똑같은 키 값이 있는지 체크.
if( m_mapFucntion.size() > 0 )
{
iter = m_mapFucntion.find( wFuncKey );
if( iter != m_mapFucntion.end() ) //현재 똑깥은 키값이 있다면.
pFindFunc = iter->second;
}
return pFindFunc;
}