• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_JSON_SERIALIZER_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_JSON_SERIALIZER_H
18 
19 #include "bundle_info.h"
20 #include "bundle_pack_info.h"
21 #include "bundle_user_info.h"
22 #include "common_event_info.h"
23 #include "distributed_ability_info.h"
24 #include "distributed_module_info.h"
25 #include "form_info.h"
26 #include "distributed_manager/rpc_id_result.h"
27 #include "free_install/dispatch_info.h"
28 #include "free_install/install_result.h"
29 #include "free_install/target_ability_info.h"
30 #include "nlohmann/json.hpp"
31 #include "quick_fix/app_quick_fix.h"
32 #include "shortcut_info.h"
33 
34 namespace OHOS {
35 namespace AppExecFwk {
36 
37 /*
38  * form_json and to_json is global static overload method, which need callback by json library,
39  * and can not rename this function, so don't named according UpperCamelCase style
40  */
41 void to_json(nlohmann::json &jsonObject, const CustomizeData &customizeData);
42 void from_json(const nlohmann::json &jsonObject, CustomizeData &customizeData);
43 void to_json(nlohmann::json &jsonObject, const MetaData &metaData);
44 void from_json(const nlohmann::json &jsonObject, MetaData &metaData);
45 void to_json(nlohmann::json &jsonObject, const Metadata &metadata);
46 void from_json(const nlohmann::json &jsonObject, Metadata &metadata);
47 void to_json(nlohmann::json &jsonObject, const AbilityInfo &abilityInfo);
48 void from_json(const nlohmann::json &jsonObject, AbilityInfo &abilityInfo);
49 void to_json(nlohmann::json &jsonObject, const ExtensionAbilityInfo &extensionInfo);
50 void from_json(const nlohmann::json &jsonObject, ExtensionAbilityInfo &extensionInfo);
51 void to_json(nlohmann::json &jsonObject, const ApplicationInfo &applicationInfo);
52 void from_json(const nlohmann::json &jsonObject, ApplicationInfo &applicationInfo);
53 void to_json(nlohmann::json &jsonObject, const BundleInfo &bundleInfo);
54 void from_json(const nlohmann::json &jsonObject, BundleInfo &bundleInfo);
55 void to_json(nlohmann::json &jsonObject, const ModuleInfo &moduleInfo);
56 void from_json(const nlohmann::json &jsonObject, ModuleInfo &moduleInfo);
57 void to_json(nlohmann::json &jsonObject, const FormInfo &formInfo);
58 void from_json(const nlohmann::json &jsonObject, FormInfo &formInfo);
59 void to_json(nlohmann::json &jsonObject, const ShortcutInfo &shortcutInfo);
60 void from_json(const nlohmann::json &jsonObject, ShortcutInfo &shortcutInfo);
61 void to_json(nlohmann::json &jsonObject, const CommonEventInfo &commonEvent);
62 void from_json(const nlohmann::json &jsonObject, CommonEventInfo &commonEvent);
63 void to_json(nlohmann::json &jsonObject, const HapModuleInfo &hapModuleInfo);
64 void from_json(const nlohmann::json &jsonObject, HapModuleInfo &hapModuleInfo);
65 void to_json(nlohmann::json& jsonObject, const BundleUserInfo& bundleUserInfo);
66 void from_json(const nlohmann::json& jsonObject, BundleUserInfo& bundleUserInfo);
67 void to_json(nlohmann::json &jsonObject, const RequestPermissionUsedScene &usedScene);
68 void from_json(const nlohmann::json &jsonObject, RequestPermissionUsedScene &usedScene);
69 void to_json(nlohmann::json &jsonObject, const RequestPermission &requestPermission);
70 void from_json(const nlohmann::json &jsonObject, RequestPermission &requestPermission);
71 void to_json(nlohmann::json& jsonObject, const DistributedAbilityInfo& distributedAbilityInfo);
72 void from_json(const nlohmann::json& jsonObject, DistributedAbilityInfo& distributedAbilityInfo);
73 void to_json(nlohmann::json& jsonObject, const DistributedModuleInfo& distributedModuleInfo);
74 void from_json(const nlohmann::json& jsonObject, DistributedModuleInfo& distributedModuleInfo);
75 void to_json(nlohmann::json &jsonObject, const TargetInfo &targetInfo);
76 void from_json(const nlohmann::json &jsonObject, TargetInfo &targetInfo);
77 void to_json(nlohmann::json &jsonObject, const TargetExtSetting &targetExtSetting);
78 void from_json(const nlohmann::json &jsonObject, TargetExtSetting &targetExtSetting);
79 void to_json(nlohmann::json &jsonObject, const Result &result);
80 void from_json(const nlohmann::json &jsonObject, Result &result);
81 void to_json(nlohmann::json &jsonObject, const Progress &progress);
82 void from_json(const nlohmann::json &jsonObject, Progress &progress);
83 void to_json(nlohmann::json &jsonObject, const TargetAbilityInfo &targetAbilityInfo);
84 void from_json(const nlohmann::json &jsonObject, TargetAbilityInfo &targetAbilityInfo);
85 void to_json(nlohmann::json &jsonObject, const InstallResult &installResult);
86 void from_json(const nlohmann::json &jsonObject, InstallResult &installResult);
87 void to_json(nlohmann::json &jsonObject, const DispatcherInfo &dispatcherInfo);
88 void from_json(const nlohmann::json &jsonObject, DispatcherInfo &dispatcherInfo);
89 void to_json(nlohmann::json &jsonObject, const Version &version);
90 void from_json(const nlohmann::json &jsonObject, Version &version);
91 void to_json(nlohmann::json &jsonObject, const PackageApp &app);
92 void from_json(const nlohmann::json &jsonObject, PackageApp &app);
93 void to_json(nlohmann::json &jsonObject, const ModuleAbilityInfo &abilityinfo);
94 void from_json(const nlohmann::json &jsonObject, ModuleAbilityInfo &abilityinfo);
95 void to_json(nlohmann::json &jsonObject, const ExtensionAbilities &extensionAbilities);
96 void from_json(const nlohmann::json &jsonObject, ExtensionAbilities &extensionAbilities);
97 void to_json(nlohmann::json &jsonObject, const AbilityFormInfo &abilityinfo);
98 void from_json(const nlohmann::json &jsonObject, AbilityFormInfo &abilityinfo);
99 void to_json(nlohmann::json &jsonObject, const ModuleDistro &distro);
100 void from_json(const nlohmann::json &jsonObject, ModuleDistro &distro);
101 void to_json(nlohmann::json &jsonObject, const ApiVersion &apiVersion);
102 void from_json(const nlohmann::json &jsonObject, ApiVersion &apiVersion);
103 void to_json(nlohmann::json &jsonObject, const PackageModule &packageModule);
104 void from_json(const nlohmann::json &jsonObject, PackageModule &packageModule);
105 void to_json(nlohmann::json &jsonObject, const Summary &summary);
106 void from_json(const nlohmann::json &jsonObject, Summary &summary);
107 void to_json(nlohmann::json &jsonObject, const Packages &packages);
108 void from_json(const nlohmann::json &jsonObject, Packages &packages);
109 void to_json(nlohmann::json &jsonObject, const BundlePackInfo &bundlePackInfo);
110 void from_json(const nlohmann::json &jsonObject, BundlePackInfo &bundlePackInfo);
111 void to_json(nlohmann::json &jsonObject, const Resource &resource);
112 void from_json(const nlohmann::json &jsonObject, Resource &resource);
113 void to_json(nlohmann::json &jsonObject, const SummaryAbilityInfo &summaryAbilityInfo);
114 void from_json(const nlohmann::json &jsonObject, SummaryAbilityInfo &summaryAbilityInfo);
115 void to_json(nlohmann::json &jsonObject, const RpcIdResult &rpcIdResult);
116 void from_json(const nlohmann::json &jsonObject, RpcIdResult &rpcIdResult);
117 void to_json(nlohmann::json &jsonObject, const AppQuickFix &appQuickFix);
118 void from_json(const nlohmann::json &jsonObject, AppQuickFix &appQuickFix);
119 void to_json(nlohmann::json &jsonObject, const AppqfInfo &appqfInfo);
120 void from_json(const nlohmann::json &jsonObject, AppqfInfo &appqfInfo);
121 void to_json(nlohmann::json &jsonObject, const HqfInfo &hqfInfo);
122 void from_json(const nlohmann::json &jsonObject, HqfInfo &hqfInfo);
123 void to_json(nlohmann::json &jsonObject, const ShortcutIntent &shortcutIntent);
124 void from_json(const nlohmann::json &jsonObject, ShortcutIntent &shortcutIntent);
125 void to_json(nlohmann::json &jsonObject, const ShortcutInfo &shortcutInfo);
126 void from_json(const nlohmann::json &jsonObject, ShortcutInfo &shortcutInfo);
127 void from_json(const nlohmann::json &jsonObject, ShortcutWant &shortcutWant);
128 void from_json(const nlohmann::json &jsonObject, Shortcut &shortcut);
129 void from_json(const nlohmann::json &jsonObject, ShortcutJson &shortcutJson);
130 }  // namespace AppExecFwk
131 }  // namespace OHOS
132 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_JSON_SERIALIZER_H
133