1885b47fbSopenharmony_ci/*
2885b47fbSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License.
5885b47fbSopenharmony_ci * You may obtain a copy of the License at
6885b47fbSopenharmony_ci *
7885b47fbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8885b47fbSopenharmony_ci *
9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and
13885b47fbSopenharmony_ci * limitations under the License.
14885b47fbSopenharmony_ci */
15885b47fbSopenharmony_ci
16885b47fbSopenharmony_ci#ifndef MOCK_PREFERENCES_H
17885b47fbSopenharmony_ci#define MOCK_PREFERENCES_H
18885b47fbSopenharmony_ci
19885b47fbSopenharmony_ci#include "preferences.h"
20885b47fbSopenharmony_ci
21885b47fbSopenharmony_cinamespace OHOS {
22885b47fbSopenharmony_cinamespace NativePreferences {
23885b47fbSopenharmony_ciclass MockPreferences : public Preferences {
24885b47fbSopenharmony_cipublic:
25885b47fbSopenharmony_ci    explicit MockPreferences();
26885b47fbSopenharmony_ci    ~MockPreferences() override;
27885b47fbSopenharmony_ci
28885b47fbSopenharmony_ci    PreferencesValue Get(const std::string &key, const PreferencesValue &defValue) override;
29885b47fbSopenharmony_ci
30885b47fbSopenharmony_ci    int Put(const std::string &key, const PreferencesValue &value) override;
31885b47fbSopenharmony_ci
32885b47fbSopenharmony_ci    int GetInt(const std::string &key, const int &defValue = {}) override;
33885b47fbSopenharmony_ci
34885b47fbSopenharmony_ci    std::string GetString(const std::string &key, const std::string &defValue = {}) override;
35885b47fbSopenharmony_ci
36885b47fbSopenharmony_ci    bool GetBool(const std::string &key, const bool &defValue = {}) override;
37885b47fbSopenharmony_ci
38885b47fbSopenharmony_ci    float GetFloat(const std::string &key, const float &defValue = {}) override;
39885b47fbSopenharmony_ci
40885b47fbSopenharmony_ci    double GetDouble(const std::string &key, const double &defValue = {}) override;
41885b47fbSopenharmony_ci
42885b47fbSopenharmony_ci    int64_t GetLong(const std::string &key, const int64_t &defValue = {}) override;
43885b47fbSopenharmony_ci
44885b47fbSopenharmony_ci    std::map<std::string, PreferencesValue> GetAll() override;
45885b47fbSopenharmony_ci
46885b47fbSopenharmony_ci    bool HasKey(const std::string &key) override;
47885b47fbSopenharmony_ci
48885b47fbSopenharmony_ci    int PutInt(const std::string &key, int value) override;
49885b47fbSopenharmony_ci
50885b47fbSopenharmony_ci    int PutString(const std::string &key, const std::string &value) override;
51885b47fbSopenharmony_ci
52885b47fbSopenharmony_ci    int PutBool(const std::string &key, bool value) override;
53885b47fbSopenharmony_ci
54885b47fbSopenharmony_ci    int PutLong(const std::string &key, int64_t value) override;
55885b47fbSopenharmony_ci
56885b47fbSopenharmony_ci    int PutFloat(const std::string &key, float value) override;
57885b47fbSopenharmony_ci
58885b47fbSopenharmony_ci    int PutDouble(const std::string &key, double value) override;
59885b47fbSopenharmony_ci
60885b47fbSopenharmony_ci    int Delete(const std::string &key) override;
61885b47fbSopenharmony_ci
62885b47fbSopenharmony_ci    int Clear() override;
63885b47fbSopenharmony_ci
64885b47fbSopenharmony_ci    void Flush() override;
65885b47fbSopenharmony_ci
66885b47fbSopenharmony_ci    int FlushSync() override;
67885b47fbSopenharmony_ci
68885b47fbSopenharmony_ci    int RegisterObserver(std::shared_ptr<PreferencesObserver> preferencesObserver, RegisterMode mode) override;
69885b47fbSopenharmony_ci
70885b47fbSopenharmony_ci    int UnRegisterObserver(std::shared_ptr<PreferencesObserver> preferencesObserver, RegisterMode mode) override;
71885b47fbSopenharmony_ci};
72885b47fbSopenharmony_ci} // End of namespace NativePreferences
73885b47fbSopenharmony_ci} // End of namespace OHOS
74885b47fbSopenharmony_ci#endif // End of #ifndef PREFERENCES_H
75