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