proxygen
folly::gen::detail::UnsplitBuffer< Delimiter, OutputBuffer > Class Template Reference

#include <String-inl.h>

Inheritance diagram for folly::gen::detail::UnsplitBuffer< Delimiter, OutputBuffer >:
folly::gen::Operator< UnsplitBuffer< Delimiter, OutputBuffer > > folly::gen::FBounded< Self >

Public Member Functions

 UnsplitBuffer (const Delimiter &delimiter, OutputBuffer *outputBuffer)
 
template<class Source , class Value >
void compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::Operator< UnsplitBuffer< Delimiter, OutputBuffer > >
ResultGen compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::FBounded< Self >
const Self & self () const
 
Self & self ()
 

Private Attributes

Delimiter delimiter_
 
OutputBuffer * outputBuffer_
 

Additional Inherited Members

- Protected Member Functions inherited from folly::gen::Operator< UnsplitBuffer< Delimiter, OutputBuffer > >
 Operator ()=default
 
 Operator (Operator &&) noexcept=default
 
 Operator (const Operator &)=default
 
Operatoroperator= (Operator &&) noexcept=default
 
Operatoroperator= (const Operator &)=default
 

Detailed Description

template<class Delimiter, class OutputBuffer>
class folly::gen::detail::UnsplitBuffer< Delimiter, OutputBuffer >

UnsplitBuffer - For joining tokens from a generator into a string, and inserting them into a custom buffer.

This type is primarily used through the 'unsplit' function.

Definition at line 326 of file String-inl.h.

Constructor & Destructor Documentation

template<class Delimiter, class OutputBuffer>
folly::gen::detail::UnsplitBuffer< Delimiter, OutputBuffer >::UnsplitBuffer ( const Delimiter delimiter,
OutputBuffer *  outputBuffer 
)
inline

Definition at line 331 of file String-inl.h.

332  : delimiter_(delimiter), outputBuffer_(outputBuffer) {
333  CHECK(outputBuffer);
334  }

Member Function Documentation

template<class Delimiter, class OutputBuffer>
template<class Source , class Value >
void folly::gen::detail::UnsplitBuffer< Delimiter, OutputBuffer >::compose ( const GenImpl< Value, Source > &  source) const
inline

Definition at line 337 of file String-inl.h.

References folly::toAppend(), v, and testing::Value().

Referenced by folly::gen::detail::Unsplit< Delimiter, Output >::compose().

337  {
338  // If the output buffer is empty, we skip inserting the delimiter for the
339  // first element.
340  bool skipDelim = outputBuffer_->empty();
341  source | [&](Value v) {
342  if (skipDelim) {
343  skipDelim = false;
344  toAppend(std::forward<Value>(v), outputBuffer_);
345  } else {
346  toAppend(delimiter_, std::forward<Value>(v), outputBuffer_);
347  }
348  };
349  }
auto v
bool Value(const T &value, M matcher)
void toAppend(char value, Tgt *result)
Definition: Conv.h:406

Member Data Documentation

template<class Delimiter, class OutputBuffer>
Delimiter folly::gen::detail::UnsplitBuffer< Delimiter, OutputBuffer >::delimiter_
private

Definition at line 327 of file String-inl.h.

template<class Delimiter, class OutputBuffer>
OutputBuffer* folly::gen::detail::UnsplitBuffer< Delimiter, OutputBuffer >::outputBuffer_
private

Definition at line 328 of file String-inl.h.


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