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 16 #ifndef OHOS_DISTRIBUTED_DATA_SERVICES_CLOUD_CLOUD_VALUE_UTIL_H 17 #define OHOS_DISTRIBUTED_DATA_SERVICES_CLOUD_CLOUD_VALUE_UTIL_H 18 19 #include "cloud/sharing_center.h" 20 #include "cloud_service.h" 21 #include "cloud_types.h" 22 #include "error/general_error.h" 23 24 namespace OHOS::CloudData { 25 namespace SharingUtil { 26 using SharingPtpant = OHOS::DistributedData::SharingCenter::Participant; 27 using SharingPlege = OHOS::DistributedData::SharingCenter::Privilege; 28 using SharingCfm = OHOS::DistributedData::SharingCenter::Confirmation; 29 using SharingRole = OHOS::DistributedData::SharingCenter::Role; 30 using SharingResults = OHOS::DistributedData::SharingCenter::QueryResults; 31 using CenterCode = OHOS::DistributedData::SharingCenter::SharingCode; 32 using Status = CloudService::Status; 33 using GenErr = DistributedData::GeneralError; 34 35 template<typename T, typename O> 36 std::vector<O> Convert(const std::vector<T> &data); 37 38 SharingPlege Convert(const Privilege &privilege); 39 SharingPtpant Convert(const Participant &participant); 40 SharingCfm Convert(const Confirmation &cfm); 41 42 Privilege Convert(const SharingPlege &privilege); 43 Participant Convert(const SharingPtpant &participant); 44 Confirmation Convert(const SharingCfm &cfm); 45 46 QueryResults Convert(const SharingResults &results); 47 48 std::vector<SharingPtpant> Convert(const std::vector<Participant> &participants); 49 50 std::vector<Participant> Convert(const std::vector<SharingPtpant> &input); 51 52 Status Convert(CenterCode code); 53 Status Convert(GenErr code); 54 } // namespace SharingUtil 55 } // namespace OHOS::CloudData 56 #endif // OHOS_DISTRIBUTED_DATA_SERVICES_CLOUD_CLOUD_VALUE_UTIL_H