• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "mcc_pool.h"
17 
18 using namespace std;
19 
20 namespace OHOS {
21 namespace Telephony {
22 std::vector<MccAccess> MccPool::mccAccessTable_;
23 std::vector<std::string> MccPool::specialMccMnc_;
AccessToMcc(int mcc)24 MccAccess MccPool::AccessToMcc(int mcc)
25 {
26     MccAccess m(mcc, "", 0);
27     InitMccTables();
28     int index = std::find(mccAccessTable_.begin(), mccAccessTable_.end(), m) - mccAccessTable_.begin();
29     int len = static_cast<int>(mccAccessTable_.size());
30     if (index >= len) {
31         return MccAccess(0, "", 0);
32     } else {
33         return mccAccessTable_.at(index);
34     }
35 }
36 
MccCountryCode(int mcc)37 std::string MccPool::MccCountryCode(int mcc)
38 {
39     MccAccess entry = AccessToMcc(mcc);
40     return entry.iso_;
41 }
42 
ShortestMncLengthFromMcc(int mcc)43 int MccPool::ShortestMncLengthFromMcc(int mcc)
44 {
45     MccAccess access = AccessToMcc(mcc);
46     if (access.iso_.empty()) {
47         return MCC_SHORT;
48     } else {
49         return access.mncShortestLength_;
50     }
51 }
52 
InitMccTables()53 void MccPool::InitMccTables()
54 {
55     if (mccAccessTable_.size() == 0) {
56         AddMccForAsia();
57         AddMccForEurope();
58         AddMccForAfrica();
59         AddMccForNorthAmerica();
60         AddMccForSouthAmerica();
61         AddMccForAustralia();
62         std::sort(mccAccessTable_.begin(), mccAccessTable_.end(), MccPool::MccCompare);
63     }
64 }
65 
AddMccForAsia()66 void MccPool::AddMccForAsia()
67 {
68     mccAccessTable_.push_back(MccAccess(MCC_GR, "gr", MCC_SHORT));
69     mccAccessTable_.push_back(MccAccess(MCC_NL, "nl", MCC_SHORT));
70     mccAccessTable_.push_back(MccAccess(MCC_BE, "be", MCC_SHORT));
71     mccAccessTable_.push_back(MccAccess(MCC_FR, "fr", MCC_SHORT));
72     mccAccessTable_.push_back(MccAccess(MCC_MC, "mc", MCC_SHORT));
73     mccAccessTable_.push_back(MccAccess(MCC_AD, "ad", MCC_SHORT));
74     mccAccessTable_.push_back(MccAccess(MCC_ES, "es", MCC_SHORT));
75     mccAccessTable_.push_back(MccAccess(MCC_HU, "hu", MCC_SHORT));
76     mccAccessTable_.push_back(MccAccess(MCC_BA, "ba", MCC_SHORT));
77     mccAccessTable_.push_back(MccAccess(MCC_HR, "hr", MCC_SHORT));
78     mccAccessTable_.push_back(MccAccess(MCC_RS, "rs", MCC_SHORT));
79     mccAccessTable_.push_back(MccAccess(MCC_IT, "it", MCC_SHORT));
80     mccAccessTable_.push_back(MccAccess(MCC_VA, "va", MCC_SHORT));
81     mccAccessTable_.push_back(MccAccess(MCC_RO, "ro", MCC_SHORT));
82     mccAccessTable_.push_back(MccAccess(MCC_CH, "ch", MCC_SHORT));
83     mccAccessTable_.push_back(MccAccess(MCC_CZ, "cz", MCC_SHORT));
84     mccAccessTable_.push_back(MccAccess(MCC_SK, "sk", MCC_SHORT));
85     mccAccessTable_.push_back(MccAccess(MCC_AT, "at", MCC_SHORT));
86     mccAccessTable_.push_back(MccAccess(MCC_GB_A, "gb", MCC_SHORT));
87     mccAccessTable_.push_back(MccAccess(MCC_GB_B, "gb", MCC_SHORT));
88     mccAccessTable_.push_back(MccAccess(MCC_DK, "dk", MCC_SHORT));
89     mccAccessTable_.push_back(MccAccess(MCC_SE, "se", MCC_SHORT));
90     mccAccessTable_.push_back(MccAccess(MCC_NO, "no", MCC_SHORT));
91     mccAccessTable_.push_back(MccAccess(MCC_FI, "fi", MCC_SHORT));
92     mccAccessTable_.push_back(MccAccess(MCC_LT, "lt", MCC_SHORT));
93     mccAccessTable_.push_back(MccAccess(MCC_LV, "lv", MCC_SHORT));
94     mccAccessTable_.push_back(MccAccess(MCC_EE, "ee", MCC_SHORT));
95     mccAccessTable_.push_back(MccAccess(MCC_RU, "ru", MCC_SHORT));
96     mccAccessTable_.push_back(MccAccess(MCC_UA, "ua", MCC_SHORT));
97     mccAccessTable_.push_back(MccAccess(MCC_BY, "by", MCC_SHORT));
98     mccAccessTable_.push_back(MccAccess(MCC_MD, "md", MCC_SHORT));
99     mccAccessTable_.push_back(MccAccess(MCC_PL, "pl", MCC_SHORT));
100     mccAccessTable_.push_back(MccAccess(MCC_DE, "de", MCC_SHORT));
101     mccAccessTable_.push_back(MccAccess(MCC_GI, "gi", MCC_SHORT));
102     mccAccessTable_.push_back(MccAccess(MCC_PT, "pt", MCC_SHORT));
103     mccAccessTable_.push_back(MccAccess(MCC_LU, "lu", MCC_SHORT));
104     mccAccessTable_.push_back(MccAccess(MCC_IE, "ie", MCC_SHORT));
105     mccAccessTable_.push_back(MccAccess(MCC_IS, "is", MCC_SHORT));
106     mccAccessTable_.push_back(MccAccess(MCC_AL, "al", MCC_SHORT));
107     mccAccessTable_.push_back(MccAccess(MCC_MT, "mt", MCC_SHORT));
108     mccAccessTable_.push_back(MccAccess(MCC_CY, "cy", MCC_SHORT));
109 }
110 
AddMccForEurope()111 void MccPool::AddMccForEurope()
112 {
113     mccAccessTable_.push_back(MccAccess(MCC_GE_A, "ge", MCC_SHORT));
114     mccAccessTable_.push_back(MccAccess(MCC_AM, "am", MCC_SHORT));
115     mccAccessTable_.push_back(MccAccess(MCC_BG, "bg", MCC_SHORT));
116     mccAccessTable_.push_back(MccAccess(MCC_TR, "tr", MCC_SHORT));
117     mccAccessTable_.push_back(MccAccess(MCC_FO, "fo", MCC_SHORT));
118     mccAccessTable_.push_back(MccAccess(MCC_GE_B, "ge", MCC_SHORT));
119     mccAccessTable_.push_back(MccAccess(MCC_GL, "gl", MCC_SHORT));
120     mccAccessTable_.push_back(MccAccess(MCC_SM, "sm", MCC_SHORT));
121     mccAccessTable_.push_back(MccAccess(MCC_SI, "si", MCC_SHORT));
122     mccAccessTable_.push_back(MccAccess(MCC_MK, "mk", MCC_SHORT));
123     mccAccessTable_.push_back(MccAccess(MCC_LI, "li", MCC_SHORT));
124     mccAccessTable_.push_back(MccAccess(MCC_ME, "me", MCC_SHORT));
125     mccAccessTable_.push_back(MccAccess(MCC_CA, "ca", MCC_LONG));
126     mccAccessTable_.push_back(MccAccess(MCC_PM, "pm", MCC_SHORT));
127     mccAccessTable_.push_back(MccAccess(MCC_US_A, "us", MCC_LONG));
128     mccAccessTable_.push_back(MccAccess(MCC_US_B, "us", MCC_LONG));
129     mccAccessTable_.push_back(MccAccess(MCC_US_C, "us", MCC_LONG));
130     mccAccessTable_.push_back(MccAccess(MCC_US_D, "us", MCC_LONG));
131     mccAccessTable_.push_back(MccAccess(MCC_US_E, "us", MCC_LONG));
132     mccAccessTable_.push_back(MccAccess(MCC_US_F, "us", MCC_LONG));
133     mccAccessTable_.push_back(MccAccess(MCC_US_G, "us", MCC_LONG));
134     mccAccessTable_.push_back(MccAccess(MCC_PR, "pr", MCC_SHORT));
135     mccAccessTable_.push_back(MccAccess(MCC_VI, "vi", MCC_SHORT));
136     mccAccessTable_.push_back(MccAccess(MCC_MX, "mx", MCC_LONG));
137     mccAccessTable_.push_back(MccAccess(MCC_JM, "jm", MCC_LONG));
138     mccAccessTable_.push_back(MccAccess(MCC_GP, "gp", MCC_SHORT));
139     mccAccessTable_.push_back(MccAccess(MCC_BB, "bb", MCC_LONG));
140     mccAccessTable_.push_back(MccAccess(MCC_AG, "ag", MCC_LONG));
141     mccAccessTable_.push_back(MccAccess(MCC_KY, "ky", MCC_LONG));
142     mccAccessTable_.push_back(MccAccess(MCC_VG, "vg", MCC_LONG));
143     mccAccessTable_.push_back(MccAccess(MCC_BM, "bm", MCC_SHORT));
144     mccAccessTable_.push_back(MccAccess(MCC_GD, "gd", MCC_SHORT));
145     mccAccessTable_.push_back(MccAccess(MCC_MS, "ms", MCC_SHORT));
146     mccAccessTable_.push_back(MccAccess(MCC_KN, "kn", MCC_SHORT));
147     mccAccessTable_.push_back(MccAccess(MCC_LC, "lc", MCC_SHORT));
148     mccAccessTable_.push_back(MccAccess(MCC_VC, "vc", MCC_SHORT));
149     mccAccessTable_.push_back(MccAccess(MCC_AI_A, "ai", MCC_SHORT));
150     mccAccessTable_.push_back(MccAccess(MCC_AW, "aw", MCC_SHORT));
151     mccAccessTable_.push_back(MccAccess(MCC_BS, "bs", MCC_SHORT));
152     mccAccessTable_.push_back(MccAccess(MCC_AI_B, "ai", MCC_LONG));
153     mccAccessTable_.push_back(MccAccess(MCC_DM, "dm", MCC_SHORT));
154 }
155 
AddMccForAfrica()156 void MccPool::AddMccForAfrica()
157 {
158     mccAccessTable_.push_back(MccAccess(MCC_CU, "cu", MCC_SHORT));
159     mccAccessTable_.push_back(MccAccess(MCC_DO, "do", MCC_SHORT));
160     mccAccessTable_.push_back(MccAccess(MCC_HT, "ht", MCC_SHORT));
161     mccAccessTable_.push_back(MccAccess(MCC_TT, "tt", MCC_SHORT));
162     mccAccessTable_.push_back(MccAccess(MCC_TC, "tc", MCC_SHORT));
163     mccAccessTable_.push_back(MccAccess(MCC_AZ, "az", MCC_SHORT));
164     mccAccessTable_.push_back(MccAccess(MCC_KZ, "kz", MCC_SHORT));
165     mccAccessTable_.push_back(MccAccess(MCC_BT, "bt", MCC_SHORT));
166     mccAccessTable_.push_back(MccAccess(MCC_IN_A, "in", MCC_SHORT));
167     mccAccessTable_.push_back(MccAccess(MCC_IN_B, "in", MCC_SHORT));
168     mccAccessTable_.push_back(MccAccess(MCC_IN_C, "in", MCC_SHORT));
169     mccAccessTable_.push_back(MccAccess(MCC_PK, "pk", MCC_SHORT));
170     mccAccessTable_.push_back(MccAccess(MCC_AF, "af", MCC_SHORT));
171     mccAccessTable_.push_back(MccAccess(MCC_LK, "lk", MCC_SHORT));
172     mccAccessTable_.push_back(MccAccess(MCC_MM, "mm", MCC_SHORT));
173     mccAccessTable_.push_back(MccAccess(MCC_LB, "lb", MCC_SHORT));
174     mccAccessTable_.push_back(MccAccess(MCC_JO, "jo", MCC_SHORT));
175     mccAccessTable_.push_back(MccAccess(MCC_SY, "sy", MCC_SHORT));
176     mccAccessTable_.push_back(MccAccess(MCC_IQ, "iq", MCC_SHORT));
177     mccAccessTable_.push_back(MccAccess(MCC_KW, "kw", MCC_SHORT));
178     mccAccessTable_.push_back(MccAccess(MCC_SA, "sa", MCC_SHORT));
179     mccAccessTable_.push_back(MccAccess(MCC_YE, "ye", MCC_SHORT));
180     mccAccessTable_.push_back(MccAccess(MCC_OM, "om", MCC_SHORT));
181     mccAccessTable_.push_back(MccAccess(MCC_PS, "ps", MCC_SHORT));
182     mccAccessTable_.push_back(MccAccess(MCC_AE_A, "ae", MCC_SHORT));
183     mccAccessTable_.push_back(MccAccess(MCC_IL, "il", MCC_SHORT));
184     mccAccessTable_.push_back(MccAccess(MCC_BH, "bh", MCC_SHORT));
185     mccAccessTable_.push_back(MccAccess(MCC_QA, "qa", MCC_SHORT));
186     mccAccessTable_.push_back(MccAccess(MCC_MN, "mn", MCC_SHORT));
187     mccAccessTable_.push_back(MccAccess(MCC_NP, "np", MCC_SHORT));
188     mccAccessTable_.push_back(MccAccess(MCC_AE_B, "ae", MCC_SHORT));
189     mccAccessTable_.push_back(MccAccess(MCC_AE_C, "ae", MCC_SHORT));
190     mccAccessTable_.push_back(MccAccess(MCC_IR, "ir", MCC_SHORT));
191     mccAccessTable_.push_back(MccAccess(MCC_UZ, "uz", MCC_SHORT));
192     mccAccessTable_.push_back(MccAccess(MCC_TJ, "tj", MCC_SHORT));
193     mccAccessTable_.push_back(MccAccess(MCC_KG, "kg", MCC_SHORT));
194     mccAccessTable_.push_back(MccAccess(MCC_TM, "tm", MCC_SHORT));
195     mccAccessTable_.push_back(MccAccess(MCC_JP_A, "jp", MCC_SHORT));
196     mccAccessTable_.push_back(MccAccess(MCC_JP_B, "jp", MCC_SHORT));
197     mccAccessTable_.push_back(MccAccess(MCC_KR, "kr", MCC_SHORT));
198     mccAccessTable_.push_back(MccAccess(MCC_VN, "vn", MCC_SHORT));
199 }
200 
AddMccForNorthAmerica()201 void MccPool::AddMccForNorthAmerica()
202 {
203     mccAccessTable_.push_back(MccAccess(MCC_HK, "hk", MCC_SHORT));
204     mccAccessTable_.push_back(MccAccess(MCC_MO, "mo", MCC_SHORT));
205     mccAccessTable_.push_back(MccAccess(MCC_KH, "kh", MCC_SHORT));
206     mccAccessTable_.push_back(MccAccess(MCC_LA, "la", MCC_SHORT));
207     mccAccessTable_.push_back(MccAccess(MCC_CN_A, "cn", MCC_SHORT));
208     mccAccessTable_.push_back(MccAccess(MCC_CN_B, "cn", MCC_SHORT));
209     mccAccessTable_.push_back(MccAccess(MCC_TW, "tw", MCC_SHORT));
210     mccAccessTable_.push_back(MccAccess(MCC_KP, "kp", MCC_SHORT));
211     mccAccessTable_.push_back(MccAccess(MCC_BD, "bd", MCC_SHORT));
212     mccAccessTable_.push_back(MccAccess(MCC_MV, "mv", MCC_SHORT));
213     mccAccessTable_.push_back(MccAccess(MCC_MY, "my", MCC_SHORT));
214     mccAccessTable_.push_back(MccAccess(MCC_AU, "au", MCC_SHORT));
215     mccAccessTable_.push_back(MccAccess(MCC_ID, "id", MCC_SHORT));
216     mccAccessTable_.push_back(MccAccess(MCC_TL, "tl", MCC_SHORT));
217     mccAccessTable_.push_back(MccAccess(MCC_PH, "ph", MCC_SHORT));
218     mccAccessTable_.push_back(MccAccess(MCC_TH, "th", MCC_SHORT));
219     mccAccessTable_.push_back(MccAccess(MCC_SG, "sg", MCC_SHORT));
220     mccAccessTable_.push_back(MccAccess(MCC_BN, "bn", MCC_SHORT));
221     mccAccessTable_.push_back(MccAccess(MCC_NZ, "nz", MCC_SHORT));
222     mccAccessTable_.push_back(MccAccess(MCC_MP, "mp", MCC_SHORT));
223     mccAccessTable_.push_back(MccAccess(MCC_GU, "gu", MCC_SHORT));
224     mccAccessTable_.push_back(MccAccess(MCC_NR, "nr", MCC_SHORT));
225     mccAccessTable_.push_back(MccAccess(MCC_PG, "pg", MCC_SHORT));
226     mccAccessTable_.push_back(MccAccess(MCC_TO, "to", MCC_SHORT));
227     mccAccessTable_.push_back(MccAccess(MCC_SB, "sb", MCC_SHORT));
228     mccAccessTable_.push_back(MccAccess(MCC_VU, "vu", MCC_SHORT));
229     mccAccessTable_.push_back(MccAccess(MCC_FJ, "fj", MCC_SHORT));
230     mccAccessTable_.push_back(MccAccess(MCC_WF, "wf", MCC_SHORT));
231     mccAccessTable_.push_back(MccAccess(MCC_AS, "as", MCC_SHORT));
232     mccAccessTable_.push_back(MccAccess(MCC_KI, "ki", MCC_SHORT));
233     mccAccessTable_.push_back(MccAccess(MCC_NC, "nc", MCC_SHORT));
234     mccAccessTable_.push_back(MccAccess(MCC_PF, "pf", MCC_SHORT));
235     mccAccessTable_.push_back(MccAccess(MCC_CK, "ck", MCC_SHORT));
236     mccAccessTable_.push_back(MccAccess(MCC_WS, "ws", MCC_SHORT));
237     mccAccessTable_.push_back(MccAccess(MCC_FM, "fm", MCC_SHORT));
238     mccAccessTable_.push_back(MccAccess(MCC_MH, "mh", MCC_SHORT));
239     mccAccessTable_.push_back(MccAccess(MCC_PW, "pw", MCC_SHORT));
240     mccAccessTable_.push_back(MccAccess(MCC_TV, "tv", MCC_SHORT));
241     mccAccessTable_.push_back(MccAccess(MCC_NU, "nu", MCC_SHORT));
242     mccAccessTable_.push_back(MccAccess(MCC_EG, "eg", MCC_SHORT));
243     mccAccessTable_.push_back(MccAccess(MCC_DZ, "dz", MCC_SHORT));
244 }
245 
AddMccForSouthAmerica()246 void MccPool::AddMccForSouthAmerica()
247 {
248     mccAccessTable_.push_back(MccAccess(MCC_MA, "ma", MCC_SHORT));
249     mccAccessTable_.push_back(MccAccess(MCC_TN, "tn", MCC_SHORT));
250     mccAccessTable_.push_back(MccAccess(MCC_LY, "ly", MCC_SHORT));
251     mccAccessTable_.push_back(MccAccess(MCC_GM, "gm", MCC_SHORT));
252     mccAccessTable_.push_back(MccAccess(MCC_SN, "sn", MCC_SHORT));
253     mccAccessTable_.push_back(MccAccess(MCC_MR, "mr", MCC_SHORT));
254     mccAccessTable_.push_back(MccAccess(MCC_ML, "ml", MCC_SHORT));
255     mccAccessTable_.push_back(MccAccess(MCC_GN, "gn", MCC_SHORT));
256     mccAccessTable_.push_back(MccAccess(MCC_CI, "ci", MCC_SHORT));
257     mccAccessTable_.push_back(MccAccess(MCC_BF, "bf", MCC_SHORT));
258     mccAccessTable_.push_back(MccAccess(MCC_NE, "ne", MCC_SHORT));
259     mccAccessTable_.push_back(MccAccess(MCC_TG, "tg", MCC_SHORT));
260     mccAccessTable_.push_back(MccAccess(MCC_BJ, "bj", MCC_SHORT));
261     mccAccessTable_.push_back(MccAccess(MCC_MU, "mu", MCC_SHORT));
262     mccAccessTable_.push_back(MccAccess(MCC_LR, "lr", MCC_SHORT));
263     mccAccessTable_.push_back(MccAccess(MCC_SL, "sl", MCC_SHORT));
264     mccAccessTable_.push_back(MccAccess(MCC_GH, "gh", MCC_SHORT));
265     mccAccessTable_.push_back(MccAccess(MCC_NG, "ng", MCC_SHORT));
266     mccAccessTable_.push_back(MccAccess(MCC_TD, "td", MCC_SHORT));
267     mccAccessTable_.push_back(MccAccess(MCC_CF, "cf", MCC_SHORT));
268     mccAccessTable_.push_back(MccAccess(MCC_CM, "cm", MCC_SHORT));
269     mccAccessTable_.push_back(MccAccess(MCC_CV, "cv", MCC_SHORT));
270     mccAccessTable_.push_back(MccAccess(MCC_ST, "st", MCC_SHORT));
271     mccAccessTable_.push_back(MccAccess(MCC_GQ, "gq", MCC_SHORT));
272     mccAccessTable_.push_back(MccAccess(MCC_GA, "ga", MCC_SHORT));
273     mccAccessTable_.push_back(MccAccess(MCC_CG, "cg", MCC_SHORT));
274     mccAccessTable_.push_back(MccAccess(MCC_CD, "cd", MCC_SHORT));
275     mccAccessTable_.push_back(MccAccess(MCC_AO, "ao", MCC_SHORT));
276     mccAccessTable_.push_back(MccAccess(MCC_GW, "gw", MCC_SHORT));
277     mccAccessTable_.push_back(MccAccess(MCC_SC, "sc", MCC_SHORT));
278     mccAccessTable_.push_back(MccAccess(MCC_SD, "sd", MCC_SHORT));
279     mccAccessTable_.push_back(MccAccess(MCC_RW, "rw", MCC_SHORT));
280     mccAccessTable_.push_back(MccAccess(MCC_ET, "et", MCC_SHORT));
281     mccAccessTable_.push_back(MccAccess(MCC_SO, "so", MCC_SHORT));
282     mccAccessTable_.push_back(MccAccess(MCC_DJ, "dj", MCC_SHORT));
283     mccAccessTable_.push_back(MccAccess(MCC_KE, "ke", MCC_SHORT));
284     mccAccessTable_.push_back(MccAccess(MCC_TZ, "tz", MCC_SHORT));
285     mccAccessTable_.push_back(MccAccess(MCC_UG, "ug", MCC_SHORT));
286     mccAccessTable_.push_back(MccAccess(MCC_BI, "bi", MCC_SHORT));
287     mccAccessTable_.push_back(MccAccess(MCC_MZ, "mz", MCC_SHORT));
288 }
289 
AddMccForAustralia()290 void MccPool::AddMccForAustralia()
291 {
292     mccAccessTable_.push_back(MccAccess(MCC_ZM, "zm", MCC_SHORT));
293     mccAccessTable_.push_back(MccAccess(MCC_MG, "mg", MCC_SHORT));
294     mccAccessTable_.push_back(MccAccess(MCC_RE, "re", MCC_SHORT));
295     mccAccessTable_.push_back(MccAccess(MCC_ZW, "zw", MCC_SHORT));
296     mccAccessTable_.push_back(MccAccess(MCC_NA, "na", MCC_SHORT));
297     mccAccessTable_.push_back(MccAccess(MCC_MW, "mw", MCC_SHORT));
298     mccAccessTable_.push_back(MccAccess(MCC_LS, "ls", MCC_SHORT));
299     mccAccessTable_.push_back(MccAccess(MCC_BW, "bw", MCC_SHORT));
300     mccAccessTable_.push_back(MccAccess(MCC_SZ, "sz", MCC_SHORT));
301     mccAccessTable_.push_back(MccAccess(MCC_KM, "km", MCC_SHORT));
302     mccAccessTable_.push_back(MccAccess(MCC_ZA, "za", MCC_SHORT));
303     mccAccessTable_.push_back(MccAccess(MCC_ER, "er", MCC_SHORT));
304     mccAccessTable_.push_back(MccAccess(MCC_SH, "sh", MCC_SHORT));
305     mccAccessTable_.push_back(MccAccess(MCC_SS, "ss", MCC_SHORT));
306     mccAccessTable_.push_back(MccAccess(MCC_BZ, "bz", MCC_SHORT));
307     mccAccessTable_.push_back(MccAccess(MCC_GT, "gt", MCC_SHORT));
308     mccAccessTable_.push_back(MccAccess(MCC_SV, "sv", MCC_SHORT));
309     mccAccessTable_.push_back(MccAccess(MCC_HN, "hn", MCC_LONG));
310     mccAccessTable_.push_back(MccAccess(MCC_NI, "ni", MCC_SHORT));
311     mccAccessTable_.push_back(MccAccess(MCC_CR, "cr", MCC_SHORT));
312     mccAccessTable_.push_back(MccAccess(MCC_PA, "pa", MCC_SHORT));
313     mccAccessTable_.push_back(MccAccess(MCC_PE, "pe", MCC_SHORT));
314     mccAccessTable_.push_back(MccAccess(MCC_AR, "ar", MCC_LONG));
315     mccAccessTable_.push_back(MccAccess(MCC_BR, "br", MCC_SHORT));
316     mccAccessTable_.push_back(MccAccess(MCC_CL, "cl", MCC_SHORT));
317     mccAccessTable_.push_back(MccAccess(MCC_CO, "co", MCC_LONG));
318     mccAccessTable_.push_back(MccAccess(MCC_VE, "ve", MCC_SHORT));
319     mccAccessTable_.push_back(MccAccess(MCC_BO, "bo", MCC_SHORT));
320     mccAccessTable_.push_back(MccAccess(MCC_GY, "gy", MCC_SHORT));
321     mccAccessTable_.push_back(MccAccess(MCC_EC, "ec", MCC_SHORT));
322     mccAccessTable_.push_back(MccAccess(MCC_GF, "gf", MCC_SHORT));
323     mccAccessTable_.push_back(MccAccess(MCC_PY, "py", MCC_SHORT));
324     mccAccessTable_.push_back(MccAccess(MCC_SR, "sr", MCC_SHORT));
325     mccAccessTable_.push_back(MccAccess(MCC_UY, "uy", MCC_SHORT));
326     mccAccessTable_.push_back(MccAccess(MCC_FK, "fk", MCC_SHORT));
327 }
328 
MccCompare(const MccAccess & a,const MccAccess & b)329 bool MccPool::MccCompare(const MccAccess &a, const MccAccess &b)
330 {
331     return (a.mcc_ < b.mcc_);
332 }
333 
LengthIsThreeMnc(const std::string & mccMncCode)334 bool MccPool::LengthIsThreeMnc(const std::string &mccMncCode)
335 {
336     InitSpecialMccMncTables();
337     std::vector<std::string>::iterator obj = std::find(specialMccMnc_.begin(), specialMccMnc_.end(), mccMncCode);
338     return (obj == specialMccMnc_.end()) ? false : true;
339 }
340 
InitSpecialMccMncTables()341 void MccPool::InitSpecialMccMncTables()
342 {
343     if (specialMccMnc_.size() == 0) {
344         AddMccMncForCa();
345         AddMccMncForInAirtel();
346         AddMccMncForInHutch();
347         AddMccMncForMy();
348     }
349 }
350 
AddMccMncForCa()351 void MccPool::AddMccMncForCa()
352 {
353     specialMccMnc_.push_back("302370");
354     specialMccMnc_.push_back("302720");
355     specialMccMnc_.push_back("310260");
356     specialMccMnc_.push_back("405025");
357     specialMccMnc_.push_back("405026");
358     specialMccMnc_.push_back("405027");
359     specialMccMnc_.push_back("405028");
360     specialMccMnc_.push_back("405029");
361     specialMccMnc_.push_back("405030");
362     specialMccMnc_.push_back("405031");
363     specialMccMnc_.push_back("405032");
364     specialMccMnc_.push_back("405033");
365     specialMccMnc_.push_back("405034");
366     specialMccMnc_.push_back("405035");
367     specialMccMnc_.push_back("405036");
368     specialMccMnc_.push_back("405037");
369     specialMccMnc_.push_back("405038");
370     specialMccMnc_.push_back("405039");
371     specialMccMnc_.push_back("405040");
372     specialMccMnc_.push_back("405041");
373     specialMccMnc_.push_back("405042");
374     specialMccMnc_.push_back("405043");
375     specialMccMnc_.push_back("405044");
376     specialMccMnc_.push_back("405045");
377     specialMccMnc_.push_back("405046");
378     specialMccMnc_.push_back("405047");
379     specialMccMnc_.push_back("405750");
380     specialMccMnc_.push_back("405751");
381     specialMccMnc_.push_back("405752");
382     specialMccMnc_.push_back("405753");
383     specialMccMnc_.push_back("405754");
384     specialMccMnc_.push_back("405755");
385     specialMccMnc_.push_back("405756");
386     specialMccMnc_.push_back("405799");
387     specialMccMnc_.push_back("405800");
388     specialMccMnc_.push_back("405801");
389 }
390 
AddMccMncForInAirtel()391 void MccPool::AddMccMncForInAirtel()
392 {
393     specialMccMnc_.push_back("405802");
394     specialMccMnc_.push_back("405803");
395     specialMccMnc_.push_back("405804");
396     specialMccMnc_.push_back("405805");
397     specialMccMnc_.push_back("405806");
398     specialMccMnc_.push_back("405807");
399     specialMccMnc_.push_back("405808");
400     specialMccMnc_.push_back("405809");
401     specialMccMnc_.push_back("405810");
402     specialMccMnc_.push_back("405811");
403     specialMccMnc_.push_back("405812");
404     specialMccMnc_.push_back("405813");
405     specialMccMnc_.push_back("405814");
406     specialMccMnc_.push_back("405815");
407     specialMccMnc_.push_back("405816");
408     specialMccMnc_.push_back("405817");
409     specialMccMnc_.push_back("405818");
410     specialMccMnc_.push_back("405819");
411     specialMccMnc_.push_back("405820");
412     specialMccMnc_.push_back("405821");
413     specialMccMnc_.push_back("405822");
414     specialMccMnc_.push_back("405823");
415     specialMccMnc_.push_back("405824");
416     specialMccMnc_.push_back("405825");
417     specialMccMnc_.push_back("405826");
418     specialMccMnc_.push_back("405827");
419     specialMccMnc_.push_back("405828");
420     specialMccMnc_.push_back("405829");
421     specialMccMnc_.push_back("405830");
422     specialMccMnc_.push_back("405831");
423     specialMccMnc_.push_back("405832");
424     specialMccMnc_.push_back("405833");
425     specialMccMnc_.push_back("405834");
426     specialMccMnc_.push_back("405835");
427     specialMccMnc_.push_back("405836");
428 }
429 
AddMccMncForInHutch()430 void MccPool::AddMccMncForInHutch()
431 {
432     specialMccMnc_.push_back("405837");
433     specialMccMnc_.push_back("405838");
434     specialMccMnc_.push_back("405839");
435     specialMccMnc_.push_back("405840");
436     specialMccMnc_.push_back("405841");
437     specialMccMnc_.push_back("405842");
438     specialMccMnc_.push_back("405843");
439     specialMccMnc_.push_back("405844");
440     specialMccMnc_.push_back("405845");
441     specialMccMnc_.push_back("405846");
442     specialMccMnc_.push_back("405847");
443     specialMccMnc_.push_back("405848");
444     specialMccMnc_.push_back("405849");
445     specialMccMnc_.push_back("405850");
446     specialMccMnc_.push_back("405851");
447     specialMccMnc_.push_back("405852");
448     specialMccMnc_.push_back("405853");
449     specialMccMnc_.push_back("405854");
450     specialMccMnc_.push_back("405855");
451     specialMccMnc_.push_back("405856");
452     specialMccMnc_.push_back("405857");
453     specialMccMnc_.push_back("405858");
454     specialMccMnc_.push_back("405859");
455     specialMccMnc_.push_back("405860");
456     specialMccMnc_.push_back("405861");
457     specialMccMnc_.push_back("405862");
458     specialMccMnc_.push_back("405863");
459     specialMccMnc_.push_back("405864");
460     specialMccMnc_.push_back("405865");
461     specialMccMnc_.push_back("405866");
462     specialMccMnc_.push_back("405867");
463     specialMccMnc_.push_back("405868");
464     specialMccMnc_.push_back("405869");
465     specialMccMnc_.push_back("405870");
466     specialMccMnc_.push_back("405871");
467     specialMccMnc_.push_back("405872");
468     specialMccMnc_.push_back("405873");
469     specialMccMnc_.push_back("405874");
470     specialMccMnc_.push_back("405875");
471 }
472 
AddMccMncForMy()473 void MccPool::AddMccMncForMy()
474 {
475     specialMccMnc_.push_back("405876");
476     specialMccMnc_.push_back("405877");
477     specialMccMnc_.push_back("405878");
478     specialMccMnc_.push_back("405879");
479     specialMccMnc_.push_back("405880");
480     specialMccMnc_.push_back("405881");
481     specialMccMnc_.push_back("405882");
482     specialMccMnc_.push_back("405883");
483     specialMccMnc_.push_back("405884");
484     specialMccMnc_.push_back("405885");
485     specialMccMnc_.push_back("405886");
486     specialMccMnc_.push_back("405908");
487     specialMccMnc_.push_back("405909");
488     specialMccMnc_.push_back("405910");
489     specialMccMnc_.push_back("405911");
490     specialMccMnc_.push_back("405912");
491     specialMccMnc_.push_back("405913");
492     specialMccMnc_.push_back("405914");
493     specialMccMnc_.push_back("405915");
494     specialMccMnc_.push_back("405916");
495     specialMccMnc_.push_back("405917");
496     specialMccMnc_.push_back("405918");
497     specialMccMnc_.push_back("405919");
498     specialMccMnc_.push_back("405920");
499     specialMccMnc_.push_back("405921");
500     specialMccMnc_.push_back("405922");
501     specialMccMnc_.push_back("405923");
502     specialMccMnc_.push_back("405924");
503     specialMccMnc_.push_back("405925");
504     specialMccMnc_.push_back("405926");
505     specialMccMnc_.push_back("405927");
506     specialMccMnc_.push_back("405928");
507     specialMccMnc_.push_back("405929");
508     specialMccMnc_.push_back("405930");
509     specialMccMnc_.push_back("405931");
510     specialMccMnc_.push_back("405932");
511     specialMccMnc_.push_back("502142");
512     specialMccMnc_.push_back("502143");
513     specialMccMnc_.push_back("502145");
514     specialMccMnc_.push_back("502146");
515     specialMccMnc_.push_back("502147");
516     specialMccMnc_.push_back("502148");
517 }
518 
MccPool()519 MccPool::MccPool() {}
520 
~MccPool()521 MccPool::~MccPool() {}
522 } // namespace Telephony
523 } // namespace OHOS
524