mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
ThrowableStringBuilder is a thin wrapper around StringBuilder to map results from the try_* methods to a throw completion. This will let us try to throw on OOM conditions rather than just blowing up.
31 lines
674 B
C++
31 lines
674 B
C++
/*
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/StringBuilder.h>
|
|
#include <AK/StringView.h>
|
|
#include <LibJS/Forward.h>
|
|
#include <LibJS/Runtime/Completion.h>
|
|
#include <LibJS/Runtime/ErrorTypes.h>
|
|
#include <LibJS/Runtime/VM.h>
|
|
|
|
namespace JS {
|
|
|
|
class ThrowableStringBuilder : public AK::StringBuilder {
|
|
public:
|
|
explicit ThrowableStringBuilder(VM&);
|
|
|
|
ThrowCompletionOr<void> append(char);
|
|
ThrowCompletionOr<void> append(StringView);
|
|
ThrowCompletionOr<void> append(Utf16View const&);
|
|
ThrowCompletionOr<void> append_code_point(u32 value);
|
|
|
|
private:
|
|
VM& m_vm;
|
|
};
|
|
|
|
}
|