• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_BASE_EVENT_STORE_INCLUDE_DOC_QUERY_H
16 #define HIVIEW_BASE_EVENT_STORE_INCLUDE_DOC_QUERY_H
17 
18 #include <string>
19 
20 #include "base_def.h"
21 
22 namespace OHOS {
23 namespace HiviewDFX {
24 namespace EventRaw {
25 class DecodedEvent;
26 } // EventRaw
27 namespace EventStore {
28 class Cond;
29 class FieldValue;
30 
31 class DocQuery {
32 public:
33     std::pair<std::string, bool> GetOrderField();
34     void And(const Cond& cond);
35     bool IsContainExtraConds(EventRaw::DecodedEvent& decodedEvent) const;
36     bool IsContainInnerConds(uint8_t* content) const;
37     std::string ToString() const;
38 
39 private:
40     bool IsContainInnerCond(const DocEventHeader& eventHeader, const Cond& cond) const;
41     bool IsContainCond(const Cond& cond, const FieldValue& value) const;
42     bool IsInnerCond(const Cond& cond) const;
43 
44     std::vector<Cond> innerConds_;
45     std::vector<Cond> extraConds_;
46 }; // DocQuery
47 } // EventStore
48 } // HiviewDFX
49 } // OHOS
50 #endif // HIVIEW_BASE_EVENT_STORE_INCLUDE_DOC_QUERY_H
51