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