1 /* 2 * Copyright (c) 2021 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 #ifndef OHOS_ABILITY_RUNTIME_NAPI_DATA_ABILITY_OPERATION_H 16 #define OHOS_ABILITY_RUNTIME_NAPI_DATA_ABILITY_OPERATION_H 17 18 #include "data_ability_operation.h" 19 #include "feature_ability_common.h" 20 21 namespace OHOS { 22 namespace NativeRdb { 23 class DataAbilityPredicates; 24 class ValuesBucket; 25 } // namespace NativeRdb 26 namespace AppExecFwk { 27 /** 28 * @brief DataAbilityOperation NAPI module registration. 29 * 30 * @param env The environment that the Node-API call is invoked under. 31 * @param exports An empty object via the exports parameter as a convenience. 32 * 33 * @return The return value from Init is treated as the exports object for the module. 34 */ 35 napi_value DataAbilityOperationInit(napi_env env, napi_value exports); 36 void SetNamedProperty(napi_env env, napi_value obj, const char *propName, int propValue); 37 /** 38 * @brief Parse the dataAbilityOperation parameters. 39 * 40 * @param param Indicates the dataAbilityOperation parameters saved the parse result. 41 * @param env The environment that the Node-API call is invoked under. 42 * @param args Indicates the arguments passed into the callback. 43 * 44 * @return The return value from NAPI C++ to JS for the module. 45 */ 46 napi_value UnwrapDataAbilityOperation(std::shared_ptr<DataAbilityOperation> ¶m, napi_env env, napi_value args); 47 napi_value BuildDataAbilityOperation( 48 std::shared_ptr<DataAbilityOperation> &dataAbilityOperation, napi_env env, napi_value param); 49 bool GetDataAbilityOperationBuilder( 50 std::shared_ptr<DataAbilityOperationBuilder> &builder, int type, const std::shared_ptr<Uri> &uri); 51 /** 52 * @brief Parse the ValuesBucket parameters. 53 * 54 * @param param Indicates the valuesBucket parameters saved the parse result. 55 * @param env The environment that the Node-API call is invoked under. 56 * @param valueBucketParam Indicates the arguments passed into the callback. 57 * 58 * @return The return value from NAPI C++ to JS for the module. 59 */ 60 napi_value UnwrapValuesBucket(const std::shared_ptr<NativeRdb::ValuesBucket> ¶m, napi_env env, 61 napi_value valueBucketParam); 62 /** 63 * @brief Parse the DataAbilityPredicatesBackReferences parameters. 64 * 65 * @param builder Indicates the dataAbilityPredicatesBackReferences parameters saved the parse result. 66 * @param env The environment that the Node-API call is invoked under. 67 * @param args Indicates the arguments passed into the callback. 68 * 69 * @return The return value from NAPI C++ to JS for the module. 70 */ 71 napi_value UnwrapDataAbilityPredicatesBackReferences( 72 std::shared_ptr<DataAbilityOperationBuilder> &builder, napi_env env, napi_value args); 73 } // namespace AppExecFwk 74 } // namespace OHOS 75 #endif /* OHOS_ABILITY_RUNTIME_NAPI_DATA_ABILITY_OPERATION_H */ 76