1 /* 2 * Copyright (c) 2022 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 NFC_PREFERENCES_H 16 #define NFC_PREFERENCES_H 17 #include "preferences.h" 18 #include "preferences_helper.h" 19 20 namespace OHOS { 21 namespace NFC { 22 class NfcPreferences { 23 public: 24 static NfcPreferences& GetInstance(); 25 26 void SetString(const std::string& key, const std::string& value); 27 std::string GetString(const std::string& key); 28 void SetInt(const std::string& key, const int value); 29 int GetInt(const std::string& key); 30 void Clear(); 31 void Delete(const std::string& key); 32 33 private: 34 NfcPreferences(); 35 ~NfcPreferences(); 36 37 std::shared_ptr<NativePreferences::Preferences> GetPreference(const std::string& fileName); 38 int errCode_; 39 std::string fileName_; 40 }; 41 } // NFC 42 } // OHOS 43 #endif // NFC_PREFERENCES_H