2020-01-18 09:38:21 +01:00
|
|
|
/*
|
2020-01-24 16:45:29 +03:00
|
|
|
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2019-09-21 00:47:31 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ManualNode.h"
|
|
|
|
|
|
|
|
class ManualSectionNode : public ManualNode {
|
|
|
|
public:
|
2020-09-18 09:49:51 +02:00
|
|
|
virtual ~ManualSectionNode() override { }
|
2019-09-21 00:47:31 +03:00
|
|
|
|
|
|
|
ManualSectionNode(String section, String name)
|
|
|
|
: m_section(section)
|
2020-10-05 18:05:35 +02:00
|
|
|
, m_full_name(String::formatted("{}. {}", section, name))
|
2019-09-21 00:47:31 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual NonnullOwnPtrVector<ManualNode>& children() const override
|
|
|
|
{
|
|
|
|
reify_if_needed();
|
|
|
|
return m_children;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual const ManualNode* parent() const override { return nullptr; }
|
|
|
|
virtual String name() const override { return m_full_name; }
|
2020-07-07 07:19:30 -04:00
|
|
|
virtual bool is_open() const override { return m_open; }
|
|
|
|
void set_open(bool open);
|
2019-09-21 00:47:31 +03:00
|
|
|
|
|
|
|
const String& section_name() const { return m_section; }
|
|
|
|
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 07:19:30 -04:00
|
|
|
bool m_open { false };
|
2019-09-21 00:47:31 +03:00
|
|
|
};
|