• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 "reminder_request.h"
17 #include "reminder_request_factory.h"
18 #include "reminder_request_adaptation.h"
19 
20 namespace OHOS {
21 namespace Notification {
Marshalling(Parcel & parcel) const22 bool ReminderRequestAdaptation::Marshalling(Parcel &parcel) const
23 {
24     return reminderRequest_->Marshalling(parcel);
25 }
26 
Unmarshalling(Parcel & parcel)27 ReminderRequestAdaptation* ReminderRequestAdaptation::Unmarshalling(Parcel &parcel)
28 {
29     ReminderRequest::ReminderType tarReminderType = ReminderRequest::ReminderType::INVALID;
30     ReminderRequest::ReadReminderTypeFormParcel(parcel, tarReminderType);
31     auto reminderRequest = ReminderRequestFactory::CreateReminderRequest(tarReminderType);
32     if (reminderRequest == nullptr) {
33         ANSR_LOGE("null reminderRequest");
34         return nullptr;
35     }
36     if (!reminderRequest->ReadFromParcel(parcel)) {
37         delete reminderRequest;
38         return nullptr;
39     }
40     ReminderRequestAdaptation* reminderRequestAdaptation = new (std::nothrow) ReminderRequestAdaptation();
41     if (reminderRequestAdaptation == nullptr) {
42         delete reminderRequest;
43         return nullptr;
44     }
45     reminderRequestAdaptation->reminderRequest_ = reminderRequest;
46     return reminderRequestAdaptation;
47 }
48 
49 }  // namespace Notification
50 }  // namespace OHOS
51