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-06-14 04:43:56 +00:00
|
|
|
#include <stdarg.h>
|
2018-10-10 09:53:07 +00:00
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
|
|
class StringBuilder {
|
|
|
|
public:
|
2019-06-14 04:43:56 +00:00
|
|
|
explicit StringBuilder(int initial_capacity = 16);
|
2019-05-28 09:53:16 +00:00
|
|
|
~StringBuilder() {}
|
2018-10-10 09:53:07 +00:00
|
|
|
|
2019-06-02 10:26:28 +00:00
|
|
|
void append(const StringView&);
|
2018-10-10 09:53:07 +00:00
|
|
|
void append(char);
|
2019-06-14 04:43:56 +00:00
|
|
|
void append(const char*, int);
|
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-06-14 04:43:56 +00:00
|
|
|
void will_append(int);
|
2019-01-18 02:27:51 +00:00
|
|
|
|
|
|
|
ByteBuffer m_buffer;
|
2019-06-14 04:43:56 +00:00
|
|
|
int m_length { 0 };
|
2018-10-10 09:53:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
using AK::StringBuilder;
|