MCPcopy Create free account
hub / github.com/arun11299/cpp-subprocess / Buffer

Class Buffer

cpp-subprocess/subprocess.hpp:1057–1083  ·  view source on GitHub ↗

! * class: Buffer * This class is a very thin wrapper around std::vector * This is basically used to determine the length of the actual * data stored inside the dynamically resized vector. * * This is what is returned as the output to communicate and check_output * functions, so, users must know about this class. * * OutBuffer and ErrBuffer are just different typedefs to this class.

Source from the content-addressed store, hash-verified

1055 * OutBuffer and ErrBuffer are just different typedefs to this class.
1056 */
1057class Buffer
1058{
1059public:
1060 Buffer() {}
1061 explicit Buffer(size_t cap) { buf.resize(cap); }
1062 void add_cap(size_t cap) { buf.resize(cap); }
1063
1064#if 0
1065 Buffer(const Buffer& other):
1066 buf(other.buf),
1067 length(other.length)
1068 {
1069 std::cout << "COPY" << std::endl;
1070 }
1071
1072 Buffer(Buffer&& other):
1073 buf(std::move(other.buf)),
1074 length(other.length)
1075 {
1076 std::cout << "MOVE" << std::endl;
1077 }
1078#endif
1079
1080public:
1081 std::vector<char> buf;
1082 size_t length = 0;
1083};
1084
1085// Buffer for storing output written to output fd
1086using OutBuffer = Buffer;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected