1 /*
2  * Copyright (c) 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_ACE_ADAPTER_PREVIEW_OSAL_STAGE_CARD_PARSER_H
17 #define FOUNDATION_ACE_ADAPTER_PREVIEW_OSAL_STAGE_CARD_PARSER_H
18 
19 #include <string>
20 
21 #include "base/log/log.h"
22 #include "base/memory/referenced.h"
23 #include "base/utils/noncopyable.h"
24 #include "frameworks/base/json/json_util.h"
25 #include "frameworks/bridge/common/manifest/manifest_window.h"
26 
27 namespace OHOS::Ace {
28 
29 class StageCardParser : public Referenced {
30 public:
31     StageCardParser();
32     ~StageCardParser() override = default;
33     void Parse(const std::string& contents, const std::string& selectUrl);
34     const std::string& GetColorMode() const;
35     const std::string& GetDefaultDimension() const;
36     const std::string& GetDescription() const;
37     const std::string& GetFormConfigAbility() const;
38     bool GetIsDefault() const;
39     const std::string& GetName() const;
40     const std::string& GetScheduledUpdateTime() const;
41     const std::string& GetSrc() const;
42     const std::vector<std::string>& GetSupportDimensions() const;
43     uint32_t GetUpdateDuration() const;
44     bool GetUpdateEnabled() const;
45     WindowConfig& GetWindowConfig() const;
46 
47 private:
48     std::string colorMode_;
49     std::string defaultDimension_;
50     std::string description_;
51     std::string formConfigAbility_;
52     bool isDefault_;
53     std::string name_;
54     std::string scheduledUpdateTime_;
55     std::string src_;
56     std::vector<std::string> supportDimensions_;
57     uint32_t updateDuration_;
58     bool updateEnabled_;
59     RefPtr<Framework::ManifestWindow> manifestWindow_;
60     ACE_DISALLOW_COPY_AND_MOVE(StageCardParser);
61 };
62 
63 } // namespace OHOS::Ace
64 
65 #endif // FOUNDATION_ACE_ADAPTER_PREVIEW_OSAL_STAGE_CARD_PARSER_H
66