1 /*
2  * Copyright (C) 2022 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 #ifndef OHOS_OPERATOR_MATCHING_RULE_H
17 #define OHOS_OPERATOR_MATCHING_RULE_H
18 
19 #include <regex>
20 #include <string>
21 
22 #include "string_ex.h"
23 #include "telephony_log_wrapper.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 static const std::string MCCMNC = "mccmnc";
28 static const std::string ICCID = "iccid";
29 static const std::string IMSI = "imsi";
30 static const std::string SPN = "spn";
31 static const std::string GID1 = "gid1";
32 static const std::string GID2 = "gid2";
33 static const std::string OPKEY = "operator_key";
34 static const std::string OPKEY_EXT = "operator_key_ext";
35 static const std::string OPNAME = "operator_name";
36 static const int32_t PREFIX_INDEX = 0;
37 class OperatorMatchingRule {
38 public:
39     static bool IccidRegexMatch(const std::string &iccidFromSim, const std::string &iccidRegex);
40     static bool ImsiRegexMatch(const std::string &imsiFromSim, const std::string &imsiRegex);
41     static bool SpnRegexMatch(const std::string &spnFromSim, const std::string &spnRegex);
42     static bool PrefixMatch(const std::string &valueFromSim, const std::string &valuePrefix);
43 };
44 } // namespace Telephony
45 } // namespace OHOS
46 #endif // OHOS_OPERATOR_MATCHING_RULE_H