1 /* 2 * Copyright (c) 2023-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 #ifndef HIVIEW_BASE_DISPATCH_RULE_PARSER_H 16 #define HIVIEW_BASE_DISPATCH_RULE_PARSER_H 17 18 #include <string> 19 20 #include "defines.h" 21 #include "json/json.h" 22 23 namespace OHOS { 24 namespace HiviewDFX { 25 class DllExport DispatchRuleParser { 26 public: 27 explicit DispatchRuleParser(const std::string& filePath); 28 std::shared_ptr<DispatchRule> GetRule(); 29 30 private: 31 std::shared_ptr<DispatchRule> dispatchRule_ = nullptr; 32 void ParseEventTypes(const Json::Value& root); 33 void ParseTagEvents(const Json::Value& root); 34 void ParseEvents(const Json::Value& root); 35 void ParseDomainRule(const Json::Value& root); 36 void ParseDomains(const Json::Value& json, DomainRule &domainRule); 37 }; 38 } // namespace HiviewDFX 39 } // namespace OHOS 40 #endif // HIVIEW_BASE_DISPATCH_RULE_PARSER_H 41