• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 
16 #ifndef DATA_SHARE_PREDICATES_IMPL_PREDICATES_H
17 #define DATA_SHARE_PREDICATES_IMPL_PREDICATES_H
18 
19 #include <memory>
20 
21 #include "cj_common_ffi.h"
22 #include "data_share_predicates_utils.h"
23 #include "ffi_remote_data.h"
24 
25 namespace OHOS {
26 namespace DataShare {
27 
28 class DataSharePredicatesImpl : public OHOS::FFI::FFIData {
29     DECL_TYPE(DataSharePredicatesImpl, OHOS::FFI::FFIData)
30 public:
31     explicit DataSharePredicatesImpl();
32 
33     std::shared_ptr<DataSharePredicates> GetPredicates();
34 
35     void EqualTo(const char *field, CValueType value);
36 
37     void And();
38 
39     void OrderByAsc(const char *field);
40 
41     void OrderByDesc(const char *field);
42 
43     void Limit(const int32_t total, const int32_t offset);
44 
45     void In(const char *field, CValueType *values, int64_t valuesSize);
46 
47     void Or();
48 
49     void BeginWrap();
50 
51     void EndWrap();
52 
53 private:
54     std::shared_ptr<DataSharePredicates> predicates_;
55 };
56 } // namespace DataShare
57 } // namespace OHOS
58 
59 #endif // endif DATA_SHARE_PREDICATES_IMPL_H
60