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 TEST_WUKONG_PAGE_TREE_H
17#define TEST_WUKONG_PAGE_TREE_H
18
19#include "component_tree.h"
20#include "wukong_define.h"
21#include "wukong_tree.h"
22
23namespace OHOS {
24namespace WuKong {
25class PageTree : public WuKongTree {
26public:
27    PageTree() : WuKongTree(), validComponentCount_(0), allComponentCount_(0)
28    {
29    }
30    virtual ~PageTree()
31    {
32        TRACK_LOG_STR("Node (0x%016llX)", !parent_.expired(), nodeId_);
33    }
34
35    void SetValidComponentCount(uint32_t count)
36    {
37        validComponentCount_ = count;
38    }
39    void SetAllComponentCount(uint32_t count)
40    {
41        allComponentCount_ = count;
42    }
43    uint32_t GetValidComponentCount()
44    {
45        return validComponentCount_;
46    }
47    uint32_t GetAllComponentCount()
48    {
49        return allComponentCount_;
50    }
51    const std::shared_ptr<ComponentTree>& GetCurrentComponentNode()
52    {
53        return inputElementInfo_;
54    }
55
56private:
57    friend class TreeManager;
58    virtual bool SetNodeId() override;
59    void SetCurrentComponentNode(const std::shared_ptr<ComponentTree>& info)
60    {
61        inputElementInfo_ = info;
62    }
63    std::shared_ptr<ComponentTree> inputElementInfo_ = nullptr;
64    uint32_t validComponentCount_ = 0;
65    uint32_t allComponentCount_ = 0;
66    uint32_t count_ = 0;
67};
68}  // namespace WuKong
69}  // namespace OHOS
70
71#endif
72