2018-10-10 09:53:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-12-03 23:27:16 +00:00
|
|
|
#include "AKString.h"
|
2018-10-10 09:53:07 +00:00
|
|
|
#include "Vector.h"
|
2019-01-30 15:28:51 +00:00
|
|
|
#include <LibC/stdarg.h>
|
2018-10-10 09:53:07 +00:00
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
|
|
class StringBuilder {
|
|
|
|
public:
|
2019-02-25 21:06:55 +00:00
|
|
|
explicit StringBuilder(ssize_t initial_capacity = 16);
|
2018-10-10 09:53:07 +00:00
|
|
|
~StringBuilder() { }
|
|
|
|
|
2018-11-18 13:57:41 +00:00
|
|
|
void append(const String&);
|
2018-10-10 09:53:07 +00:00
|
|
|
void append(char);
|
2019-02-25 21:06:55 +00:00
|
|
|
void append(const char*, ssize_t);
|
2019-01-18 01:41:27 +00:00
|
|
|
void appendf(const char*, ...);
|
2019-01-30 15:28:51 +00:00
|
|
|
void appendvf(const char*, va_list);
|
2018-10-10 09:53:07 +00:00
|
|
|
|
2019-01-31 16:31:23 +00:00
|
|
|
String to_string();
|
2019-01-18 02:27:51 +00:00
|
|
|
ByteBuffer to_byte_buffer();
|
2018-10-10 09:53:07 +00:00
|
|
|
|
|
|
|
private:
|
2019-02-25 21:06:55 +00:00
|
|
|
void will_append(ssize_t);
|
2019-01-18 02:27:51 +00:00
|
|
|
|
|
|
|
ByteBuffer m_buffer;
|
2019-02-25 21:06:55 +00:00
|
|
|
ssize_t m_length { 0 };
|
2018-10-10 09:53:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
using AK::StringBuilder;
|
|
|
|
|