1 /* 2 * Copyright (c) 2022-2023 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 SERVICES_EDM_INCLUDE_UTILS_FUNCCODE_UTILS_H 17 #define SERVICES_EDM_INCLUDE_UTILS_FUNCCODE_UTILS_H 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 #include "func_code.h" 23 24 namespace OHOS { 25 namespace EDM { 26 class FuncCodeUtils { 27 public: 28 static FuncFlag ConvertSystemFlag(std::uint32_t flag); 29 30 static FuncFlag GetSystemFlag(std::uint32_t funcCode); 31 32 static bool IsServiceFlag(std::uint32_t funcCode); 33 34 static bool IsPolicyFlag(std::uint32_t funcCode); 35 36 static FuncOperateType ConvertOperateType(std::uint32_t type); 37 38 static FuncOperateType GetOperateType(std::uint32_t funcCode); 39 40 static std::uint32_t GetPolicyCode(std::uint32_t funcCode); 41 42 static std::uint32_t CreateFuncCode(std::uint32_t systemFlag, std::uint32_t operateType, std::uint32_t policyCode); 43 44 static std::string PrintFuncCode(std::uint32_t funcCode); 45 }; 46 47 class ArrayPolicyUtils { 48 public: 49 static bool ArrayStringContains(const std::vector<std::string> &array, const std::string &findItem); 50 51 static void RemovePolicy(std::vector<std::string> &removeData, std::vector<std::string> ¤tData); 52 53 static void RemovePolicy(std::vector<std::map<std::string, std::string>> &removeData, 54 std::vector<std::map<std::string, std::string>> ¤tData); 55 }; 56 } // namespace EDM 57 } // namespace OHOS 58 #endif // SERVICES_EDM_INCLUDE_UTILS_FUNCCODE_UTILS_H 59