Kernel: Annotate KString methods as [[nodiscard]]

This commit is contained in:
Brian Gianforcaro 2021-08-12 21:20:31 -07:00 committed by Andreas Kling
parent f2d684fc24
commit 060503ef25
Notes: sideshowbarker 2024-07-18 22:57:59 +09:00

View File

@ -16,19 +16,19 @@ class KString {
AK_MAKE_NONMOVABLE(KString);
public:
static OwnPtr<KString> try_create_uninitialized(size_t, char*&);
static NonnullOwnPtr<KString> must_create_uninitialized(size_t, char*&);
static OwnPtr<KString> try_create(StringView const&);
static NonnullOwnPtr<KString> must_create(StringView const&);
[[nodiscard]] static OwnPtr<KString> try_create_uninitialized(size_t, char*&);
[[nodiscard]] static NonnullOwnPtr<KString> must_create_uninitialized(size_t, char*&);
[[nodiscard]] static OwnPtr<KString> try_create(StringView const&);
[[nodiscard]] static NonnullOwnPtr<KString> must_create(StringView const&);
void operator delete(void*);
OwnPtr<KString> try_clone() const;
[[nodiscard]] OwnPtr<KString> try_clone() const;
bool is_empty() const { return m_length == 0; }
size_t length() const { return m_length; }
char const* characters() const { return m_characters; }
StringView view() const { return { characters(), length() }; }
[[nodiscard]] bool is_empty() const { return m_length == 0; }
[[nodiscard]] size_t length() const { return m_length; }
[[nodiscard]] char const* characters() const { return m_characters; }
[[nodiscard]] StringView view() const { return { characters(), length() }; }
private:
explicit KString(size_t length)