kst/kte/AppendBuffer.h

31 lines
438 B
C++

/*
* abuf.cc
* 2024-05-30
* kyle@imap.cc
*
* append buffers
*/
#pragma once
#include <string>
namespace kte {
class AppendBuffer {
public:
AppendBuffer() : b(nullptr), len(0), cap(0) {};
void Append(const char *, int);
void Append(const std::string& s);
void Append(const char ch);
friend std::ostream &operator<<(std::ostream& os, AppendBuffer buf);
private:
char *b;
int len;
int cap;
};
} // namespace kte