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 constexpr const char* FORMS = "forms";
28 constexpr const char* NAME = "name";
29 constexpr const char* DISPLAY_NAME = "displayName";
30 constexpr const char* DESCRIPTION = "description";
31 constexpr const char* SRC = "src";
32 constexpr const char* WINDOW = "window";
33 constexpr const char* WINDOW_DESIGN_WIDTH = "designWidth";
34 constexpr const char* WINDOW_AUTO_DESIGN_WIDTH = "autoDesignWidth";
35 constexpr const char* COLOR_MODE = "colorMode";
36 constexpr const char* FORM_CONFIG_ABILITY = "formConfigAbility";
37 constexpr const char* TYPE = "type";
38 constexpr const char* UI_SYNTAX = "uiSyntax";
39 constexpr const char* FORM_VISIBLE_NOTIFY = "formVisibleNotify";
40 constexpr const char* IS_DEFAULT = "isDefault";
41 constexpr const char* UPDATE_ENABLED = "updateEnabled";
42 constexpr const char* SCHEDULED_UPDATE_TIME = "scheduledUpdateTime";
43 constexpr const char* UPDATE_DURATION = "updateDuration";
44 constexpr const char* DEFAULT_DIMENSION = "defaultDimension";
45 constexpr const char* SUPPORT_DIMENSIONS = "supportDimensions";
46 constexpr const char* METADATA = "metadata";
47 constexpr const char* METADATA_NAME = "name";
48 constexpr const char* METADATA_VALUE = "value";
49 constexpr const char* DATA_PROXY_ENABLED = "dataProxyEnabled";
50 constexpr const char* IS_DYNAMIC = "isDynamic";
51 constexpr const char* TRANSPARENCY_ENABLED = "transparencyEnabled";
52 constexpr const char* PRIVACY_LEVEL = "privacyLevel";
53 constexpr const char* FONT_SCALE_FOLLOW_SYSTEM = "fontScaleFollowSystem";
54 constexpr const char* SUPPORT_SHAPES = "supportShapes";
55 }
56 
57 class ExtensionFormProfile {
58 public:
59     /**
60      * @brief Transform the form profile to ExtensionFormInfos.
61      * @param formProfile Indicates the string of the form profile.
62      * @param infos Indicates the obtained ExtensionFormProfileInfo.
63      * @param privacyLevel Indicates the form data privacy level.
64      * @return Returns ERR_OK if the information transformed successfully; returns error code otherwise.
65      */
66     static ErrCode TransformTo(
67         const std::string &formProfile, std::vector<ExtensionFormInfo> &infos, int32_t &privacyLevel);
68 };
69 }  // namespace AppExecFwk
70 }  // namespace OHOS
71 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_EXTENSION_FORM_PROFILE_H
72