#include "StdAfx.h"
|
#include "RcpZoneInfo.h"
|
|
CRcpZoneInfo::CRcpZoneInfo(int nType)
|
{
|
Reset(nType);
|
}
|
|
CRcpZoneInfo::CRcpZoneInfo(void)
|
{
|
|
}
|
|
CRcpZoneInfo::~CRcpZoneInfo(void)
|
{
|
}
|
|
void CRcpZoneInfo::Reset(int nType)
|
{
|
m_nZoneType = nType;
|
m_strZoneString = _T("");
|
m_vecZoneString.clear();
|
m_vecZoneNumber.clear();
|
}
|
|
void CRcpZoneInfo::SetInfo(const CRcpZoneInfo& rhs)
|
{
|
*this = rhs;
|
}
|
|
void CRcpZoneInfo::GetInfo(CRcpZoneInfo& rhs)
|
{
|
rhs = *this;
|
}
|
|
void CRcpZoneInfo::SetZoneString(const CString& strString)
|
{
|
m_strZoneString.Format(_T("%s"), strString);
|
|
SetZoneVecString();
|
}
|
|
void CRcpZoneInfo::SetZoneVecString()
|
{
|
if (m_strZoneString.GetLength()<=0) return;
|
|
CString strData=_T(""), strZone=_T("");
|
m_vecZoneString.clear();
|
m_vecZoneNumber.clear();
|
|
strData = m_strZoneString;
|
|
int nIdx = 0, nCount = 0, nCount2=0;
|
|
while(TRUE)
|
{
|
nIdx = strData.Find(_T(','), nIdx + 1);
|
|
if(nIdx != -1) nCount++;
|
else break;
|
}
|
|
if (nCount<=0)
|
{
|
m_vecZoneString.push_back(strData);
|
m_vecZoneNumber.push_back(GetZoneNumber(strData));
|
}
|
else
|
{
|
char strLine[128] = {0, };
|
char *strTemp, *strTemp2;
|
char *strType;
|
|
USES_CONVERSION;
|
sprintf_s(strLine, "%s", strData);
|
|
for (int nIdx=0; nIdx<nCount; nIdx++)
|
{
|
strTemp = strtok_s(strLine, ",", &strType);
|
|
if (nIdx<nCount-1)
|
{
|
strZone = A2W(strTemp);
|
m_vecZoneString.push_back(strZone);
|
m_vecZoneNumber.push_back(GetZoneNumber(strZone));
|
|
strTemp2 = strtok_s(NULL, " ",&strType);
|
if (strLine == NULL)
|
continue;
|
|
memcpy(strLine, strTemp2, sizeof(char)*128);
|
}
|
|
else
|
{
|
strZone = A2W(strTemp);
|
m_vecZoneString.push_back(strZone);
|
m_vecZoneNumber.push_back(GetZoneNumber(strZone));
|
strZone = A2W(strType);
|
m_vecZoneString.push_back(strZone);
|
m_vecZoneNumber.push_back(GetZoneNumber(strZone));
|
}
|
}
|
}
|
}
|
|
int CRcpZoneInfo::GetZoneNumber(const CString& strZone)
|
{
|
if (strZone==_T("Z0")) return RCP_ZONE_INDEX_Z0;
|
else if (strZone==_T("Z1")) return RCP_ZONE_INDEX_Z1;
|
else if (strZone==_T("Z2")) return RCP_ZONE_INDEX_Z2;
|
else if (strZone==_T("Z3")) return RCP_ZONE_INDEX_Z3;
|
else if (strZone==_T("Z4")) return RCP_ZONE_INDEX_Z4;
|
else if (strZone==_T("Z5")) return RCP_ZONE_INDEX_Z5;
|
else if (strZone==_T("Z6")) return RCP_ZONE_INDEX_Z6;
|
else if (strZone==_T("Z7")) return RCP_ZONE_INDEX_Z7;
|
else if (strZone==_T("Z8")) return RCP_ZONE_INDEX_Z8;
|
else if (strZone==_T("Z9")) return RCP_ZONE_INDEX_Z9;
|
else if (strZone==_T("Z10")) return RCP_ZONE_INDEX_Z10;
|
else if (strZone==_T("Z11")) return RCP_ZONE_INDEX_Z11;
|
else if (strZone==_T("Z12")) return RCP_ZONE_INDEX_Z12;
|
else if (strZone==_T("Z13")) return RCP_ZONE_INDEX_Z13;
|
else if (strZone==_T("Z14")) return RCP_ZONE_INDEX_Z14;
|
else if (strZone==_T("Z15")) return RCP_ZONE_INDEX_Z15;
|
else return RCP_ZONE_INDEX_Z0;
|
}
|