• 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 #ifndef FRAMEWORKS_SERVICES_CLOUD_SYNC_NOTIFY_INCLUDE_HANDLE_BASE_HANDLER_H
17 #define FRAMEWORKS_SERVICES_CLOUD_SYNC_NOTIFY_INCLUDE_HANDLE_BASE_HANDLER_H
18 
19 #include "datashare_helper.h"
20 #include "cloud_sync_observer.h"
21 
22 namespace OHOS {
23 namespace Media {
24 
25 struct CloudSyncHandleData {
26     CloudSyncNotifyInfo orgInfo;
27     std::unordered_map<DataShare::DataShareObserver::ChangeType, std::list<Uri>> notifyInfo;
28 };
29 
30 class BaseHandler {
31 public:
32     BaseHandler() = default;
33     virtual ~BaseHandler() = default;
34 
35 public:
36     virtual void Handle(const CloudSyncHandleData &handleData) = 0;
init()37     virtual void init() {}
SetNextHandler(const std::shared_ptr<BaseHandler> & nextHandler)38     void SetNextHandler(const std::shared_ptr<BaseHandler> &nextHandler)
39     {
40         nextHandler_ = nextHandler;
41     }
42 
43 public:
44     std::shared_ptr<BaseHandler> nextHandler_;
45 };
46 } //namespace Media
47 } //namespace OHOS
48 
49 #endif //FRAMEWORKS_SERVICES_CLOUD_SYNC_NOTIFY_INCLUDE_HANDLE_BASE_HANDLER_H
50