1 /* 2 * Copyright (c) 2024-2024 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_QUERY_POLICY_PLUGIN_POLICY_READER_H 17 #define SERVICES_EDM_INCLUDE_QUERY_POLICY_PLUGIN_POLICY_READER_H 18 19 #include <string> 20 21 #include "edm_errors.h" 22 #include "ipolicy_query.h" 23 #include "message_parcel.h" 24 #include "policy_manager.h" 25 26 namespace OHOS { 27 namespace EDM { 28 class PluginPolicyReader { 29 public: 30 static std::shared_ptr<PluginPolicyReader> GetInstance(); 31 32 ErrCode GetPolicyByCode(std::shared_ptr<PolicyManager> policyManager, uint32_t code, MessageParcel &data, 33 MessageParcel &reply, int32_t userId); 34 35 ErrCode GetPolicyByCodeInner(std::shared_ptr<PolicyManager> policyManager, uint32_t code, MessageParcel &data, 36 MessageParcel &reply, int32_t userId); 37 38 ErrCode GetPolicyQuery(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 39 ErrCode GetPolicyQueryFirst(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 40 ErrCode GetPolicyQuerySecond(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 41 ErrCode GetPolicyQueryThird(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 42 ErrCode GetPolicyQueryFourth(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 43 ErrCode GetPolicyQueryFifthPartOne(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 44 ErrCode GetPolicyQueryFifthPartTwo(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 45 ErrCode GetPolicyQuerySixth(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 46 ErrCode GetPolicyQuerySeventh(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 47 ErrCode GetPolicyQueryEighth(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 48 ErrCode GetPolicyQueryNinth(std::shared_ptr<IPolicyQuery> &obj, uint32_t code); 49 50 private: 51 static std::shared_ptr<PluginPolicyReader> instance_; 52 static std::once_flag flag_; 53 }; 54 } // namespace EDM 55 } // namespace OHOS 56 57 #endif // SERVICES_EDM_INCLUDE_QUERY_POLICY_PLUGIN_POLICY_READER_H 58