mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 11:00:29 +00:00
73fdbba59c
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
28 lines
557 B
C++
28 lines
557 B
C++
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <Kernel/KBuffer.h>
|
|
#include <stdarg.h>
|
|
|
|
class KBufferBuilder {
|
|
public:
|
|
using OutputType = KBuffer;
|
|
|
|
explicit KBufferBuilder();
|
|
~KBufferBuilder() {}
|
|
|
|
void append(const StringView&);
|
|
void append(char);
|
|
void append(const char*, int);
|
|
void appendf(const char*, ...);
|
|
void appendvf(const char*, va_list);
|
|
|
|
KBuffer build();
|
|
|
|
private:
|
|
bool can_append(size_t) const;
|
|
u8* insertion_ptr() { return m_buffer.data() + m_size; }
|
|
|
|
KBuffer m_buffer;
|
|
size_t m_size { 0 };
|
|
};
|