serenity/AK/StringBuilder.h
Andreas Kling 73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
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. :^)
2019-09-06 15:36:54 +02:00

37 lines
631 B
C++

#pragma once
#include <AK/String.h>
#include <AK/Vector.h>
#include <stdarg.h>
namespace AK {
class StringBuilder {
public:
using OutputType = String;
explicit StringBuilder(int initial_capacity = 16);
~StringBuilder() {}
void append(const StringView&);
void append(char);
void append(const char*, int);
void appendf(const char*, ...);
void appendvf(const char*, va_list);
String build() { return to_string(); }
String to_string();
ByteBuffer to_byte_buffer();
private:
void will_append(int);
ByteBuffer m_buffer;
int m_length { 0 };
};
}
using AK::StringBuilder;