• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 FRAMEWORKS_INNERKITSIMPL_MEDIA_LIBRARY_HELPER_INCLUDE_PHOTO_QUERY_FILTER_H
17 #define FRAMEWORKS_INNERKITSIMPL_MEDIA_LIBRARY_HELPER_INCLUDE_PHOTO_QUERY_FILTER_H
18 
19 #include <string>
20 
21 #include "rdb_predicates.h"
22 
23 namespace OHOS::Media {
24 
25 class PhotoQueryFilter {
26 public:
27     enum class Option {
28         CUSTOM_FILTER,
29         FILTER_VISIBLE,
30         FILTER_HIDDEN,
31         FILTER_TRASHED,
32     };
33 
34     enum class ConfigType {
35         INCLUDE,
36         EXCLUDE,
37         IGNORE,
38     };
39 
40     struct Config {
41         ConfigType hiddenConfig = ConfigType::EXCLUDE;
42         ConfigType trashedConfig = ConfigType::EXCLUDE;
43         ConfigType tempConfig = ConfigType::EXCLUDE;
44         ConfigType pendingConfig = ConfigType::EXCLUDE;
45         ConfigType burstCoverOnly = ConfigType::INCLUDE;
46         ConfigType syncStatusConfig = ConfigType::EXCLUDE;
47         ConfigType cleanFlagConfig = ConfigType::EXCLUDE;
48     };
49 
50     static std::string GetSqlWhereClause(const PhotoQueryFilter::Option option);
51     static std::string GetSqlWhereClause(const PhotoQueryFilter::Config& config);
52 
53     template <class T>
54     static void ModifyPredicate(const PhotoQueryFilter::Option option, T& predicate);
55 
56     template <class T>
57     static void ModifyPredicate(const PhotoQueryFilter::Config& config, T& predicate);
58 };
59 
60 }  // namespace Media
61 #endif // FRAMEWORKS_INNERKITSIMPL_MEDIA_LIBRARY_HELPER_INCLUDE_PHOTO_QUERY_FILTER_H