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