2022-12-14 17:19:14 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "SubsectionNode.h"
|
2022-12-14 17:53:41 +01:00
|
|
|
#include "PageNode.h"
|
|
|
|
|
#include <AK/TypeCasts.h>
|
2022-12-14 17:19:14 +01:00
|
|
|
|
|
|
|
|
namespace Manual {
|
|
|
|
|
|
2023-04-16 10:28:45 +01:00
|
|
|
SubsectionNode::SubsectionNode(NonnullRefPtr<SectionNode const> parent, StringView name, RefPtr<PageNode> page)
|
2022-12-14 17:19:14 +01:00
|
|
|
: SectionNode(name, name)
|
|
|
|
|
, m_parent(move(parent))
|
2023-04-16 10:28:45 +01:00
|
|
|
, m_page(move(page))
|
2022-12-14 17:19:14 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Node const* SubsectionNode::parent() const { return m_parent; }
|
|
|
|
|
|
2023-04-16 10:28:45 +01:00
|
|
|
PageNode const* SubsectionNode::document() const { return m_page; }
|
2022-12-14 17:53:41 +01:00
|
|
|
|
2022-12-14 17:19:14 +01:00
|
|
|
ErrorOr<String> SubsectionNode::name() const { return m_name; }
|
|
|
|
|
|
|
|
|
|
ErrorOr<String> SubsectionNode::path() const
|
|
|
|
|
{
|
|
|
|
|
return String::formatted("{}/{}", TRY(m_parent->path()), m_section);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|