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 "nlohmann/json.hpp" 20 #include "bundle_info.h" 21 #include "bundle_user_info.h" 22 #include "form_info.h" 23 #include "shortcut_info.h" 24 #include "common_event_info.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 29 /* 30 * form_json and to_json is global static overload method, which need callback by json library, 31 * and can not rename this function, so don't named according UpperCamelCase style 32 */ 33 void to_json(nlohmann::json &jsonObject, const CustomizeData &customizeData); 34 void from_json(const nlohmann::json &jsonObject, CustomizeData &customizeData); 35 void to_json(nlohmann::json &jsonObject, const MetaData &metaData); 36 void from_json(const nlohmann::json &jsonObject, MetaData &metaData); 37 void to_json(nlohmann::json &jsonObject, const Metadata &metadata); 38 void from_json(const nlohmann::json &jsonObject, Metadata &metadata); 39 void to_json(nlohmann::json &jsonObject, const AbilityInfo &abilityInfo); 40 void from_json(const nlohmann::json &jsonObject, AbilityInfo &abilityInfo); 41 void to_json(nlohmann::json &jsonObject, const ExtensionAbilityInfo &extensionInfo); 42 void from_json(const nlohmann::json &jsonObject, ExtensionAbilityInfo &extensionInfo); 43 void to_json(nlohmann::json &jsonObject, const ApplicationInfo &applicationInfo); 44 void from_json(const nlohmann::json &jsonObject, ApplicationInfo &applicationInfo); 45 void to_json(nlohmann::json &jsonObject, const BundleInfo &bundleInfo); 46 void from_json(const nlohmann::json &jsonObject, BundleInfo &bundleInfo); 47 void to_json(nlohmann::json &jsonObject, const ModuleInfo &moduleInfo); 48 void from_json(const nlohmann::json &jsonObject, ModuleInfo &moduleInfo); 49 void to_json(nlohmann::json &jsonObject, const FormInfo &formInfo); 50 void from_json(const nlohmann::json &jsonObject, FormInfo &formInfo); 51 void to_json(nlohmann::json &jsonObject, const ShortcutInfo &shortcutInfo); 52 void from_json(const nlohmann::json &jsonObject, ShortcutInfo &shortcutInfo); 53 void to_json(nlohmann::json &jsonObject, const CommonEventInfo &commonEvent); 54 void from_json(const nlohmann::json &jsonObject, CommonEventInfo &commonEvent); 55 void to_json(nlohmann::json &jsonObject, const HapModuleInfo &hapModuleInfo); 56 void from_json(const nlohmann::json &jsonObject, HapModuleInfo &hapModuleInfo); 57 void to_json(nlohmann::json& jsonObject, const BundleUserInfo& bundleUserInfo); 58 void from_json(const nlohmann::json& jsonObject, BundleUserInfo& bundleUserInfo); 59 void from_json(const nlohmann::json &jsonObject, ShortcutWant &shortcutWant); 60 void from_json(const nlohmann::json &jsonObject, Shortcut &shortcut); 61 void from_json(const nlohmann::json &jsonObject, ShortcutJson &shortcutJson); 62 void to_json(nlohmann::json &jsonObject, const RequestPermissionUsedScene &usedScene); 63 void from_json(const nlohmann::json &jsonObject, RequestPermissionUsedScene &usedScene); 64 void to_json(nlohmann::json &jsonObject, const RequestPermission &requestPermission); 65 void from_json(const nlohmann::json &jsonObject, RequestPermission &requestPermission); 66 } // namespace AppExecFwk 67 } // namespace OHOS 68 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_JSON_SERIALIZER_H 69