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