• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 DATASHARE_COMMON_H
17 #define DATASHARE_COMMON_H
18 #include "ability.h"
19 #include "napi/native_api.h"
20 #include "napi/native_common.h"
21 #include "napi/native_node_api.h"
22 #include "napi_common_data.h"
23 #include "datashare_helper.h"
24 
25 using Ability = OHOS::AppExecFwk::Ability;
26 
27 namespace OHOS {
28 namespace DataShare {
29 using namespace AppExecFwk;
30 
31 struct CBBase {
32     CallbackInfo cbInfo;
33     napi_async_work asyncWork;
34     napi_deferred deferred;
35     Ability *ability = nullptr;
36     AbilityType abilityType = AbilityType::UNKNOWN;
37     int errCode = 0;
38 };
39 
40 class NAPIDataShareObserver;
41 struct DSHelperOnOffCB {
42     CBBase cbBase;
43     DataShareHelper *dataShareHelper = nullptr;
44     sptr<NAPIDataShareObserver> observer;
45     std::string uri;
46     int result = 0;
47     std::vector<DSHelperOnOffCB *> NotifyList;
48     std::vector<DSHelperOnOffCB *> DestoryList;
49 };
50 }  // namespace DataShare
51 }  // namespace OHOS
52 #endif /* DATASHARE_COMMON_H */
53