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 OHOS_FILEMGMT_CLOUD_PREF_IMPL_H
16 #define OHOS_FILEMGMT_CLOUD_PREF_IMPL_H
17 #include "preferences.h"
18 #include "preferences_helper.h"
19 
20 namespace OHOS::FileManagement::CloudSync {
21 const static std::string START_CURSOR = "start_cursor";
22 const static std::string NEXT_CURSOR = "next_cursor";
23 const static std::string TEMP_START_CURSOR = "temp_start_cursor";
24 const static std::string CLOUDFILE_DIR = "/data/service/el1/public/cloudfile/";
25 class CloudPrefImpl {
26 public:
27     CloudPrefImpl(const std::string& fileName);
28     CloudPrefImpl(const int32_t userId, const std::string& bundleName, const std::string& tableName);
29     ~CloudPrefImpl() = default;;
30 
31     void SetString(const std::string& key, const std::string& value);
32     void GetString(const std::string& key, std::string& value);
33     void SetLong(const std::string& key, const int64_t value);
34     void GetLong(const std::string& key, int64_t& value);
35     void SetInt(const std::string& key, const int value);
36     void GetInt(const std::string& key, int32_t& value);
37     void SetBool(const std::string& key, const bool& value);
38     void GetBool(const std::string& key, bool& value);
39     void Clear();
40     void Delete(const std::string& key);
41 
42 private:
43     std::string fileName_;
44     std::shared_ptr<NativePreferences::Preferences> pref_;
45 };
46 }
47 #endif // OHOS_FILEMGMT_CLOUD_PREF_IMPL_H