1 /* 2 * Copyright (c) 2022-2023 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_EXTENSION_FORM_PROFILE_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_EXTENSION_FORM_PROFILE_H 18 19 #include <string> 20 #include <vector> 21 #include "appexecfwk_errors.h" 22 #include "extension_form_info.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 namespace ExtensionFormProfileReader { 27 const std::string FORMS = "forms"; 28 const std::string NAME = "name"; 29 const std::string DESCRIPTION = "description"; 30 const std::string SRC = "src"; 31 const std::string WINDOW = "window"; 32 const std::string WINDOW_DESIGN_WIDTH = "designWidth"; 33 const std::string WINDOW_AUTO_DESIGN_WIDTH = "autoDesignWidth"; 34 const std::string COLOR_MODE = "colorMode"; 35 const std::string FORM_CONFIG_ABILITY = "formConfigAbility"; 36 const std::string TYPE = "type"; 37 const std::string UI_SYNTAX = "uiSyntax"; 38 const std::string FORM_VISIBLE_NOTIFY = "formVisibleNotify"; 39 const std::string IS_DEFAULT = "isDefault"; 40 const std::string UPDATE_ENABLED = "updateEnabled"; 41 const std::string SCHEDULED_UPDATE_TIME = "scheduledUpdateTime"; 42 const std::string UPDATE_DURATION = "updateDuration"; 43 const std::string DEFAULT_DIMENSION = "defaultDimension"; 44 const std::string SUPPORT_DIMENSIONS = "supportDimensions"; 45 const std::string METADATA = "metadata"; 46 const std::string METADATA_NAME = "name"; 47 const std::string METADATA_VALUE = "value"; 48 const std::string DATA_PROXY_ENABLED = "dataProxyEnabled"; 49 const std::string IS_DYNAMIC = "isDynamic"; 50 } 51 52 class ExtensionFormProfile { 53 public: 54 /** 55 * @brief Transform the form profile to ExtensionFormInfos. 56 * @param formProfile Indicates the string of the form profile. 57 * @param info Indicates the obtained ExtensionFormProfileInfo. 58 * @return Returns ERR_OK if the information transformed successfully; returns error code otherwise. 59 */ 60 static ErrCode TransformTo(const std::string &formProfile, std::vector<ExtensionFormInfo> &infos); 61 }; 62 } // namespace AppExecFwk 63 } // namespace OHOS 64 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_EXTENSION_FORM_PROFILE_H 65