proxygen
folly::test::IovecBuffers Class Reference

Public Member Functions

 IovecBuffers (std::initializer_list< size_t > sizes)
 
 IovecBuffers (std::vector< size_t > sizes)
 
std::vector< iovec > iov () const
 
std::string join () const
 
size_t size () const
 

Private Attributes

std::vector< std::stringbuffers_
 
std::vector< iovec > iov_
 

Detailed Description

Definition at line 183 of file FileUtilTest.cpp.

Constructor & Destructor Documentation

folly::test::IovecBuffers::IovecBuffers ( std::initializer_list< size_t >  sizes)
explicit

Definition at line 201 of file FileUtilTest.cpp.

References b, s, and string.

201  {
202  iov_.reserve(sizes.size());
203  for (auto& s : sizes) {
204  buffers_.push_back(std::string(s, '\0'));
205  }
206  for (auto& b : buffers_) {
207  iovec iov;
208  iov.iov_base = &b[0];
209  iov.iov_len = b.size();
210  iov_.push_back(iov);
211  }
212 }
char b
std::vector< iovec > iov_
std::vector< std::string > buffers_
const int sizes[]
const char * string
Definition: Conv.cpp:212
static set< string > s
std::vector< iovec > iov() const
folly::test::IovecBuffers::IovecBuffers ( std::vector< size_t >  sizes)
explicit

Definition at line 214 of file FileUtilTest.cpp.

References b, s, and string.

214  {
215  iov_.reserve(sizes.size());
216  for (auto s : sizes) {
217  buffers_.push_back(std::string(s, '\0'));
218  }
219  for (auto& b : buffers_) {
220  iovec iov;
221  iov.iov_base = &b[0];
222  iov.iov_len = b.size();
223  iov_.push_back(iov);
224  }
225 }
char b
std::vector< iovec > iov_
std::vector< std::string > buffers_
const char * string
Definition: Conv.cpp:212
static set< string > s
std::vector< iovec > iov() const

Member Function Documentation

std::vector<iovec> folly::test::IovecBuffers::iov ( ) const
inline

Definition at line 188 of file FileUtilTest.cpp.

Referenced by folly::test::TEST().

188  {
189  return iov_;
190  } // yes, make a copy
std::vector< iovec > iov_
std::string folly::test::IovecBuffers::join ( ) const
inline

Definition at line 191 of file FileUtilTest.cpp.

References folly::join(), and folly::size().

191  {
192  return folly::join("", buffers_);
193  }
std::vector< std::string > buffers_
void join(const Delim &delimiter, Iterator begin, Iterator end, String &output)
Definition: String-inl.h:498
size_t folly::test::IovecBuffers::size ( ) const

Definition at line 227 of file FileUtilTest.cpp.

References b, and s.

Referenced by folly::test::TEST().

227  {
228  size_t s = 0;
229  for (auto& b : buffers_) {
230  s += b.size();
231  }
232  return s;
233 }
char b
std::vector< std::string > buffers_
static set< string > s

Member Data Documentation

std::vector<std::string> folly::test::IovecBuffers::buffers_
private

Definition at line 197 of file FileUtilTest.cpp.

std::vector<iovec> folly::test::IovecBuffers::iov_
private

Definition at line 198 of file FileUtilTest.cpp.


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