[Base] Add repeating character append to StringBuffer.

This commit is contained in:
gibbed 2020-04-13 10:29:04 -05:00 committed by Rick Gibbed
parent 96067fb293
commit dc119c178f
2 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,13 @@ void StringBuffer::Append(char c) {
AppendBytes(reinterpret_cast<const uint8_t*>(&c), 1);
}
void StringBuffer::Append(char c, size_t count) {
Grow(count + 1);
std::memset(buffer_ + buffer_offset_, c, count);
buffer_offset_ += count;
buffer_[buffer_offset_] = 0;
}
void StringBuffer::Append(const char* value) {
AppendBytes(reinterpret_cast<const uint8_t*>(value), std::strlen(value));
}

View File

@ -29,6 +29,7 @@ class StringBuffer {
void Reset();
void Append(char c);
void Append(char c, size_t count);
void Append(const char* value);
void Append(const std::string_view value);