mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
Help+LibManual: Move non-UI-specific manual handling to LibManual
This is a first step in deduplicating code within and across Help and man. Because LibManual also doesn't contain any DeprecatedString, some adjustments to Help's string handling is included, just to interoperate with LibManual better. Further work in this area mostly requires String APIs in LibGUI.
This commit is contained in:
parent
78353ec184
commit
ad6a55e1f0
18 changed files with 339 additions and 265 deletions
38
Userland/Libraries/LibManual/PageNode.h
Normal file
38
Userland/Libraries/LibManual/PageNode.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 String name() const override { return m_page; };
|
||||
virtual bool is_page() const override { return true; }
|
||||
|
||||
ErrorOr<String> path() const;
|
||||
|
||||
private:
|
||||
NonnullRefPtr<SectionNode> m_section;
|
||||
String m_page;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue