proxygen
fizz::detail::ReadVector< bits24, T > Struct Template Reference

#include <Types-inl.h>

Public Member Functions

size_t readVector (std::vector< T > &out, folly::io::Cursor &cursor)
 

Detailed Description

template<class T>
struct fizz::detail::ReadVector< bits24, T >

Definition at line 283 of file Types-inl.h.

Member Function Documentation

template<class T >
size_t fizz::detail::ReadVector< bits24, T >::readVector ( std::vector< T > &  out,
folly::io::Cursor cursor 
)
inline

Definition at line 284 of file Types-inl.h.

References fizz::detail::read(), fizz::detail::readBits24(), fizz::detail::bits24::size, T, and folly::io::detail::CursorBase< Derived, BufType >::totalLength().

284  {
285  auto len = readBits24(cursor);
286  if (cursor.totalLength() < len) {
287  throw std::out_of_range("Not enough data");
288  }
289 
290  size_t consumed = 0;
291  while (consumed < len) {
292  out.push_back(T());
293  consumed += read(*out.rbegin(), cursor);
294  }
295  if (consumed != len) {
296  throw std::runtime_error("Invalid data length supplied");
297  }
298  return len + bits24::size;
299  }
#define T(v)
Definition: http_parser.c:233
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
uint32_t readBits24(folly::io::Cursor &cursor)
Definition: Types-inl.h:210
static constexpr size_t size
Definition: Types-inl.h:18
size_t totalLength() const
Definition: Cursor.h:126

The documentation for this struct was generated from the following file: