1 /* 2 * Copyright (c) 2021-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 16 #ifndef CONTACT_ACCOUNT_H 17 #define CONTACT_ACCOUNT_H 18 19 #include "rdb_errno.h" 20 #include "rdb_store.h" 21 #include "result_set.h" 22 23 #include "account_data_collection.h" 24 25 namespace OHOS { 26 namespace Contacts { 27 class ContactsAccount { 28 public: 29 static std::shared_ptr<ContactsAccount> GetInstance(); 30 ~ContactsAccount(); 31 int64_t Insert( 32 std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, std::string accountName, std::string accountType); 33 int LookupAccountTypeId( 34 std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, std::string accountName, std::string accountType); 35 void PrepopulateCommonAccountTypes(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore); 36 std::vector<AccountDataCollection> GetAccountFromLocal(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore); 37 int GetNotExistAccount(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, AccountDataCollection collection); 38 int DeleteDataByRawId(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, int needDeleteRawContactId); 39 int DeleteGroupsByAccountId(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, int accountId); 40 int DeleteAccountByAccountId(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore, int accountId); 41 int StopForegin(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore); 42 int OpenForegin(std::shared_ptr<OHOS::NativeRdb::RdbStore> rdbStore); 43 44 private: 45 ContactsAccount(); 46 static std::shared_ptr<ContactsAccount> instance_; 47 }; 48 } // namespace Contacts 49 } // namespace OHOS 50 51 #endif // CONTACT_ACCOUNT_H 52