Lines Matching refs:Size
33 template <typename Fn> bool Adapt(Fn F, const uint8_t *Data, size_t Size);
44 size_t UnpackPrimitive(const uint8_t *Data, size_t Size, T *Value) { in UnpackPrimitive() argument
45 if (Size < sizeof(T)) in UnpackPrimitive()
46 return Size; in UnpackPrimitive()
48 return Size - sizeof(T); in UnpackPrimitive()
55 size_t UnpackSingle(const uint8_t *Data, size_t Size, T *Value);
59 size_t UnpackSingle<Type>(const uint8_t *Data, size_t Size, Type *Value) { \
60 return UnpackPrimitive(Data, Size, Value); \
86 size_t UnpackSingle<std::vector<uint8_t>>(const uint8_t *Data, size_t Size, in UNPACK_SINGLE_PRIMITIVE()
88 if (Size < 1) in UNPACK_SINGLE_PRIMITIVE()
89 return Size; in UNPACK_SINGLE_PRIMITIVE()
90 size_t Len = std::min(static_cast<size_t>(*Data), Size - 1); in UNPACK_SINGLE_PRIMITIVE()
93 return Size - Len - 1; in UNPACK_SINGLE_PRIMITIVE()
97 size_t UnpackSingle<std::string>(const uint8_t *Data, size_t Size,
99 if (Size < 1)
100 return Size;
101 size_t Len = std::min(static_cast<size_t>(*Data), Size - 1);
104 return Size - Len - 1;
112 UnpackImpl(const uint8_t *Data, size_t Size, TupleT *Tuple) { in UnpackImpl() argument
119 UnpackImpl(const uint8_t *Data, size_t Size, TupleT *Tuple) {
120 size_t NewSize = UnpackSingle(Data, Size, &std::get<N>(*Tuple));
121 if (NewSize == Size) {
125 return UnpackImpl<N + 1, TupleT>(Data + (Size - NewSize), NewSize, Tuple);
130 bool Unpack(const uint8_t *Data, size_t Size, std::tuple<Args...> *Tuple) { in Unpack() argument
131 return UnpackImpl<0, std::tuple<Args...>>(Data, Size, Tuple); in Unpack()
170 bool UnpackAndApply(Fn F, const uint8_t *Data, size_t Size) {
172 if (!Unpack(Data, Size, &Tuple))
181 template <typename Fn> bool Adapt(Fn F, const uint8_t *Data, size_t Size) {
182 return impl::UnpackAndApply(F, Data, Size);