2020-01-18 08:38:21 +00:00
|
|
|
/*
|
2020-01-24 13:45:29 +00:00
|
|
|
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
|
2022-02-10 19:28:48 +00:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-01-18 08:38:21 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2019-09-20 21:47:31 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ManualNode.h"
|
|
|
|
|
|
|
|
class ManualSectionNode : public ManualNode {
|
|
|
|
public:
|
2022-02-10 19:28:48 +00:00
|
|
|
virtual ~ManualSectionNode() override = default;
|
2019-09-20 21:47:31 +00:00
|
|
|
|
|
|
|
ManualSectionNode(String section, String name)
|
|
|
|
: m_section(section)
|
2020-10-05 16:05:35 +00:00
|
|
|
, m_full_name(String::formatted("{}. {}", section, name))
|
2019-09-20 21:47:31 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual NonnullOwnPtrVector<ManualNode>& children() const override
|
|
|
|
{
|
|
|
|
reify_if_needed();
|
|
|
|
return m_children;
|
|
|
|
}
|
|
|
|
|
2022-04-01 17:58:27 +00:00
|
|
|
virtual ManualNode const* parent() const override { return nullptr; }
|
2019-09-20 21:47:31 +00:00
|
|
|
virtual String name() const override { return m_full_name; }
|
2020-07-07 11:19:30 +00:00
|
|
|
virtual bool is_open() const override { return m_open; }
|
|
|
|
void set_open(bool open);
|
2019-09-20 21:47:31 +00:00
|
|
|
|
2022-04-01 17:58:27 +00:00
|
|
|
String const& section_name() const { return m_section; }
|
2019-09-20 21:47:31 +00:00
|
|
|
String path() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void reify_if_needed() const;
|
|
|
|
|
|
|
|
String m_section;
|
|
|
|
String m_full_name;
|
|
|
|
mutable NonnullOwnPtrVector<ManualNode> m_children;
|
|
|
|
mutable bool m_reified { false };
|
2020-07-07 11:19:30 +00:00
|
|
|
bool m_open { false };
|
2019-09-20 21:47:31 +00:00
|
|
|
};
|