1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:47:46 +00:00

HexEditor: Use the constructor pattern

This commit is contained in:
Lucas CHOLLET 2023-01-14 22:24:48 -05:00 committed by Andrew Kaster
parent a621b5f015
commit b1d8404c92
3 changed files with 13 additions and 4 deletions

View file

@ -70,10 +70,18 @@ bool HexDocumentMemory::write_to_file(NonnullRefPtr<Core::File> file)
return true;
}
ErrorOr<NonnullOwnPtr<HexDocumentFile>> HexDocumentFile::create(NonnullRefPtr<Core::File> file)
{
auto document = TRY(adopt_nonnull_own_or_enomem(new HexDocumentFile(move(file))));
// FIXME: Remove this hackery
document->set_file(move(document->m_file));
return document;
}
HexDocumentFile::HexDocumentFile(NonnullRefPtr<Core::File> file)
: m_file(file)
{
set_file(file);
}
void HexDocumentFile::write_to_file()