• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 FORM_BINDING_DATA_COMMON_H
16 #define FORM_BINDING_DATA_COMMON_H
17 
18 #include <string>
19 #include <vector>
20 
21 namespace OHOS {
22 namespace AbilityRuntime {
23 class ProxyData {
24 public:
key(key)25     ProxyData(std::string key, std::string subscribeId = std::string()): key(key), subscribeId(subscribeId) {}
26 
27     std::string key;
28     std::string subscribeId;
29 };
30 
31 class FormBindingData {
32 public:
33     FormBindingData(
data(data)34         std::string data, std::vector<ProxyData> proxies = std::vector<ProxyData>()): data(data), proxies(proxies) {}
35     ~FormBindingData() = default;
36 
37     std::string data;
38     std::vector<ProxyData> proxies;
39 };
40 class CjFormBindingData {
41 public:
42     CjFormBindingData() = default;
43     ~CjFormBindingData() = default;
44 
CreateFormBindingData(std::string obj)45     static FormBindingData CreateFormBindingData(std::string obj)
46     {
47         return OnCreateFormBindingData(obj);
48     }
49 
50 private:
51     static FormBindingData OnCreateFormBindingData(std::string obj);
52 };
53 
54 char* MallocCString(const std::string &origin);
55 } // namespace AbilityRuntime
56 } // namespace OHOS
57 #endif