1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00
serenity/Userland/Libraries/LibManual/PageNode.h
kleines Filmröllchen 5a346c4297 Help+LibManual: Without arguments, open index page instead of crashing
This is the old behavior before the recent LibManual refactor. It also
moves the definition of the index page into LibManual for better reuse.
2022-12-12 00:37:29 -07:00

40 lines
875 B
C++

/*
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <LibManual/Node.h>
namespace Manual {
class SectionNode;
class PageNode : public Node {
public:
virtual ~PageNode() override = default;
PageNode(NonnullRefPtr<SectionNode> section, String page)
: m_section(move(section))
, m_page(move(page))
{
}
virtual NonnullRefPtrVector<Node>& children() const override;
virtual Node const* parent() const override;
virtual ErrorOr<String> name() const override { return m_page; };
virtual bool is_page() const override { return true; }
ErrorOr<String> path() const;
static ErrorOr<NonnullRefPtr<PageNode>> help_index_page();
private:
NonnullRefPtr<SectionNode> m_section;
String m_page;
};
}