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