SDC C-Project CF Review 프로그램
LYW
2021-07-08 e10b8c2a3f6ee6b639dbb49ff6635d0657531d1e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#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;
}