MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / attach

Method attach

proto/fbe.cpp:284–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282#endif
283
284void FBEBuffer::attach(const void* data, size_t size, size_t offset)
285{
286 assert((data != nullptr) && "Invalid buffer!");
287 if (data == nullptr)
288 throw std::invalid_argument("Invalid buffer!");
289 assert((size > 0) && "Invalid size!");
290 if (size == 0)
291 throw std::invalid_argument("Invalid size!");
292 assert((offset <= size) && "Invalid offset!");
293 if (offset > size)
294 throw std::invalid_argument("Invalid offset!");
295
296 _data = (uint8_t*)data;
297 _capacity = 0;
298 _size = size;
299 _offset = offset;
300}
301
302void FBEBuffer::attach(const std::vector<uint8_t>& buffer, size_t offset)
303{

Callers 14

onReceiveMethod · 0.45
onReceiveMethod · 0.45
onReceiveMethod · 0.45
onReceiveMethod · 0.45
test_create.cppFile · 0.45
test_enums.cppFile · 0.45
test_extending.cppFile · 0.45
mainFunction · 0.45

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected