1 /*
2  * Copyright (c) 2021-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_HIVIEWDFX_SYS_EVENT_RULE_H
17 #define OHOS_HIVIEWDFX_SYS_EVENT_RULE_H
18 
19 #include "parcel.h"
20 #include "rule_type.h"
21 
22 namespace OHOS {
23 namespace HiviewDFX {
24 class SysEventRule : public Parcelable {
25 public:
SysEventRule()26     SysEventRule() {};
27     SysEventRule(const std::string& domain, const std::string& eventName,
28         const std::string& tag, uint32_t ruleType = RuleType::WHOLE_WORD, uint32_t eventType = 0)
29         : domain(domain), eventName(eventName), tag(tag), ruleType(ruleType), eventType(eventType) {}
30     SysEventRule(const std::string& domain, const std::string& eventName,
31         uint32_t ruleType = RuleType::WHOLE_WORD, uint32_t eventType = 0)
32         : SysEventRule(domain, eventName, "", ruleType, eventType) {}
33     SysEventRule(const std::string& tag, uint32_t ruleType = RuleType::WHOLE_WORD, uint32_t eventType = 0)
34         : SysEventRule("", "", tag, ruleType, eventType) {}
35     ~SysEventRule() = default;
36 
37     bool Marshalling(Parcel& parcel) const override;
38     static SysEventRule* Unmarshalling(Parcel& parcel);
39 
40     std::string domain;
41     std::string eventName;
42     std::string tag;
43     uint32_t ruleType = RuleType::WHOLE_WORD;
44     uint32_t eventType = 0;
45 };
46 } // namespace HiviewDFX
47 } // namespace OHOS
48 
49 #endif // OHOS_HIVIEWDFX_SYS_EVENT_RULE_H