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_ACE_ADAPTER_PREVIEW_INSPECTOR_INSPECT_NODE_H
17 #define FOUNDATION_ACE_ADAPTER_PREVIEW_INSPECTOR_INSPECT_NODE_H
18 
19 #include <string>
20 #include <unordered_map>
21 
22 #include "base/json/json_util.h"
23 #include "base/memory/ace_type.h"
24 #include "core/accessibility/accessibility_node.h"
25 
26 namespace OHOS::Ace::Framework {
27 class InspectNode : public AceType {
28     DECLARE_ACE_TYPE(InspectNode, AceType);
29 
30 public:
31     InspectNode(NodeId nodeId, const std::string& nodeName);
32     ~InspectNode() override;
33 
34     void SetAllAttr(std::unique_ptr<JsonValue>& jsonNode, const char* attrsTag);
35     void SetAllStyle(std::unique_ptr<JsonValue>& jsonNode, const char* stylesTag);
36     void InitCommonStyles();
37     virtual void PackAttrAndStyle();
38 protected:
39     NodeId nodeId_ = -1;
40     std::string tag_;
41     std::unordered_map<std::string, std::string> attrs_;
42     std::unordered_map<std::string, std::string> styles_;
43 };
44 } // namespace OHOS::Ace::Framework
45 
46 #endif // FOUNDATION_ACE_ADAPTER_PREVIEW_INSPECTOR_INSPECT_NODE_H
47