scsl/bufferTest.cc

30 lines
518 B
C++
Raw Normal View History

2023-10-09 17:24:40 +00:00
#include <iostream>
#include "Buffer.h"
int
main()
{
klib::Buffer buffer("hlo, world");
std::cout << buffer.Contents() << std::endl;
buffer.Insert(1, (uint8_t *)"el", 2);
2023-10-09 19:45:19 +00:00
buffer.Append('!');
2023-10-09 17:24:40 +00:00
std::cout << buffer.Contents() << std::endl;
2023-10-09 19:45:19 +00:00
buffer.Remove(buffer.Length()-1);
buffer.Remove(0, 5);
buffer.Insert(0, 'g');
buffer.Insert(1, (uint8_t *)"oodbye", 6);
buffer.Reclaim();
buffer.Append("and now for something completely different...");
std::cout << buffer.Contents() << std::endl;
return 0;
2023-10-09 17:24:40 +00:00
}