MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / BufferRef

Class BufferRef

native/thirdpart/flatbuffers/flatbuffers.h:2505–2524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2503// A BufferRef does not own its buffer.
2504struct BufferRefBase {}; // for std::is_base_of
2505template<typename T> struct BufferRef : BufferRefBase {
2506 BufferRef() : buf(nullptr), len(0), must_free(false) {}
2507 BufferRef(uint8_t *_buf, uoffset_t _len)
2508 : buf(_buf), len(_len), must_free(false) {}
2509
2510 ~BufferRef() {
2511 if (must_free) free(buf);
2512 }
2513
2514 const T *GetRoot() const { return flatbuffers::GetRoot<T>(buf); }
2515
2516 bool Verify() {
2517 Verifier verifier(buf, len);
2518 return verifier.VerifyBuffer<T>(nullptr);
2519 }
2520
2521 uint8_t *buf;
2522 uoffset_t len;
2523 bool must_free;
2524};
2525
2526// "structs" are flat structures that do not have an offset table, thus
2527// always have all members present and do not support forwards/backwards

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected