mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:27:45 +00:00
LibCore: Remove [[nodiscard]] attribute from Resource implementations
This attribute is only needed on the declarations in the header.
This commit is contained in:
parent
98a82565cd
commit
e9aa72ee98
1 changed files with 8 additions and 8 deletions
|
@ -48,27 +48,27 @@ ErrorOr<NonnullRefPtr<Resource>> Resource::load_from_uri(StringView uri)
|
||||||
return ResourceImplementation::the().load_from_uri(uri);
|
return ResourceImplementation::the().load_from_uri(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] String Resource::uri() const
|
String Resource::uri() const
|
||||||
{
|
{
|
||||||
return MUST(String::formatted("{}://{}", m_scheme == Scheme::Resource ? "resource"sv : "file"sv, m_path));
|
return MUST(String::formatted("{}://{}", m_scheme == Scheme::Resource ? "resource"sv : "file"sv, m_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] String Resource::filesystem_path() const
|
String Resource::filesystem_path() const
|
||||||
{
|
{
|
||||||
return ResourceImplementation::the().filesystem_path(*this);
|
return ResourceImplementation::the().filesystem_path(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] String Resource::filename() const
|
String Resource::filename() const
|
||||||
{
|
{
|
||||||
return MUST(String::from_utf8(LexicalPath(m_path.bytes_as_string_view()).basename()));
|
return MUST(String::from_utf8(LexicalPath(m_path.bytes_as_string_view()).basename()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Vector<String> Resource::children() const
|
Vector<String> Resource::children() const
|
||||||
{
|
{
|
||||||
return ResourceImplementation::the().child_names(*this);
|
return ResourceImplementation::the().child_names(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ByteBuffer Resource::clone_data() const
|
ByteBuffer Resource::clone_data() const
|
||||||
{
|
{
|
||||||
return m_data.visit(
|
return m_data.visit(
|
||||||
[](NonnullOwnPtr<Core::MappedFile> const& file) { return MUST(ByteBuffer::copy(file->bytes())); },
|
[](NonnullOwnPtr<Core::MappedFile> const& file) { return MUST(ByteBuffer::copy(file->bytes())); },
|
||||||
|
@ -76,7 +76,7 @@ ErrorOr<NonnullRefPtr<Resource>> Resource::load_from_uri(StringView uri)
|
||||||
[](DirectoryTag) -> ByteBuffer { VERIFY_NOT_REACHED(); });
|
[](DirectoryTag) -> ByteBuffer { VERIFY_NOT_REACHED(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ByteBuffer Resource::release_data() &&
|
ByteBuffer Resource::release_data() &&
|
||||||
{
|
{
|
||||||
VERIFY(!m_data.has<DirectoryTag>());
|
VERIFY(!m_data.has<DirectoryTag>());
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ ErrorOr<NonnullRefPtr<Resource>> Resource::load_from_uri(StringView uri)
|
||||||
return move(m_data).get<ByteBuffer>();
|
return move(m_data).get<ByteBuffer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ReadonlyBytes Resource::data() const
|
ReadonlyBytes Resource::data() const
|
||||||
{
|
{
|
||||||
return m_data.visit(
|
return m_data.visit(
|
||||||
[](NonnullOwnPtr<Core::MappedFile> const& file) { return file->bytes(); },
|
[](NonnullOwnPtr<Core::MappedFile> const& file) { return file->bytes(); },
|
||||||
|
@ -93,7 +93,7 @@ ErrorOr<NonnullRefPtr<Resource>> Resource::load_from_uri(StringView uri)
|
||||||
[](DirectoryTag) -> ReadonlyBytes { VERIFY_NOT_REACHED(); });
|
[](DirectoryTag) -> ReadonlyBytes { VERIFY_NOT_REACHED(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] FixedMemoryStream Resource::stream() const
|
FixedMemoryStream Resource::stream() const
|
||||||
{
|
{
|
||||||
return FixedMemoryStream(data());
|
return FixedMemoryStream(data());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue