• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "account_data_collection.h"
17 
18 #include <vector>
19 
20 #include "contacts_columns.h"
21 
22 namespace OHOS {
23 namespace Contacts {
AccountDataCollection(void)24 AccountDataCollection::AccountDataCollection(void)
25 {
26 }
27 
~AccountDataCollection()28 AccountDataCollection::~AccountDataCollection()
29 {
30 }
31 
AccountDataCollection(std::string accountName,std::string accountType,std::string dataCollection)32 AccountDataCollection::AccountDataCollection(
33     std::string accountName, std::string accountType, std::string dataCollection)
34 {
35     this->cAccountName_ = accountName;
36     this->cAccountType_ = accountType;
37     this->cDataCollection_ = dataCollection;
38 }
39 
GetcAccountName()40 std::string AccountDataCollection::GetcAccountName()
41 {
42     return this->cAccountName_;
43 }
44 
GetcAccountType()45 std::string AccountDataCollection::GetcAccountType()
46 {
47     return this->cAccountType_;
48 }
49 
GetcDataCollection()50 std::string AccountDataCollection::GetcDataCollection()
51 {
52     return this->cDataCollection_;
53 }
54 
IsDefaultAccount()55 bool AccountDataCollection::IsDefaultAccount()
56 {
57     return AccountData::ACCOUNT_NAME == this->cAccountName_ && AccountData::ACCOUNT_TYPE == this->cAccountType_;
58 }
59 
ContainSysAccounts(std::vector<OHOS::AccountSA::OhosAccountInfo> sysAccounts)60 bool AccountDataCollection::ContainSysAccounts(std::vector<OHOS::AccountSA::OhosAccountInfo> sysAccounts)
61 {
62     for (auto iter = sysAccounts.begin(); iter != sysAccounts.end(); ++iter) {
63         if (iter->name_ == this->cAccountName_ && iter->uid_ == this->cAccountType_) {
64             return true;
65         }
66     }
67     return false;
68 }
69 } // namespace Contacts
70 } // namespace OHOS
71