• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 FOUNDATION_ACE_FRAMEWORKS_BASE_WANT_WRAP_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_WANT_WRAP_H
18 
19 #include <map>
20 
21 #include "base/memory/ace_type.h"
22 
23 class NativeEngine;
24 class NativeValue;
25 
26 namespace OHOS::AAFwk {
27 class Want;
28 class WantParams;
29 } // namespace AAFwk
30 
31 namespace OHOS::Ace {
32 class WantParamsWrap : public AceType {
33     DECLARE_ACE_TYPE(WantParamsWrap, AceType);
34 public:
35     static RefPtr<WantParamsWrap> CreateWantWrap(NativeEngine* engine, NativeValue* value);
36 };
37 
38 class ACE_EXPORT WantWrap : public AceType {
39     DECLARE_ACE_TYPE(WantWrap, AceType);
40 
41 public:
42     static NativeValue* ConvertToNativeValue(const OHOS::AAFwk::Want& want, NativeEngine* engine);
43     static NativeValue* ConvertParamsToNativeValue(const OHOS::AAFwk::WantParams& wantParams, NativeEngine* engine);
44     static RefPtr<WantWrap> CreateWantWrap(void* nativeEngine, void* nativeValue);
45     static RefPtr<WantWrap> CreateWantWrap(const std::string& bundleName, const std::string& abilityName);
46 
47     virtual void SetWantParamsFromWantWrap(void* want) = 0;
48     virtual void SetWantParam(const std::map<std::string, std::string>& params) = 0;
49     virtual std::string ToString() const = 0;
50 };
51 
52 } // namespace OHOS::Ace
53 
54 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_WANT_WRAP_H
55