ManaPlus
Data Structures | Public Member Functions | Private Member Functions | Private Attributes | Friends
doctest::detail::ContextBuilder Class Reference

#include <doctest.h>

Data Structures

struct  Capture
 OCLINT destructor of virtual class. More...
 
struct  Chunk
 
struct  ICapture
 
struct  Node
 

Public Member Functions

 ContextBuilder ()
 
 ~ContextBuilder ()
 
template<typename T >
 __attribute__ ((noinline)) ContextBuilder &operator<<(T &in)
 
template<typename T >
ContextBuilderoperator<< (const T &&)
 

Private Member Functions

 ContextBuilder (ContextBuilder &other)
 
ContextBuilderoperator= (const ContextBuilder &)=delete
 
void stringify (std::ostream *s) const
 

Private Attributes

Chunk stackChunks [5]
 
int numCaptures = 0
 
Nodehead = 0
 
Nodetail = 0
 

Friends

class ContextScope
 

Detailed Description

Definition at line 1529 of file doctest.h.

Constructor & Destructor Documentation

◆ ContextBuilder() [1/2]

doctest::detail::ContextBuilder::ContextBuilder ( ContextBuilder other)
private

◆ ContextBuilder() [2/2]

doctest::detail::ContextBuilder::ContextBuilder ( )

◆ ~ContextBuilder()

doctest::detail::ContextBuilder::~ContextBuilder ( )

Member Function Documentation

◆ __attribute__()

template<typename T >
doctest::detail::ContextBuilder::__attribute__ ( (noinline)  ) &
inline

Definition at line 1585 of file doctest.h.

1585  {
1586  Capture<T> temp(&in);
1587 
1588  // construct either on stack or on heap
1589  // copy the bytes for the whole object - including the vtable because we cant construct
1590  // the object directly in the buffer using placement new - need the <new> header...
1592  my_memcpy(stackChunks[numCaptures].buf, &temp, sizeof(Chunk));
1593  } else {
1594  auto curr = new Node;
1595  curr->next = 0;
1596  if(tail) {
1597  tail->next = curr;
1598  tail = curr;
1599  } else {
1600  head = tail = curr;
1601  }
1602 
1603  my_memcpy(tail->chunk.buf, &temp, sizeof(Chunk));
1604  }
1605  ++numCaptures;
1606  return *this;
1607  }
#define DOCTEST_CONFIG_NUM_CAPTURES_ON_STACK
void my_memcpy(void *dest, const void *src, unsigned num)

References doctest::detail::ContextBuilder::Node::chunk, DOCTEST_CONFIG_NUM_CAPTURES_ON_STACK, doctest::detail::my_memcpy(), and doctest::detail::ContextBuilder::Node::next.

◆ operator<<()

template<typename T >
ContextBuilder& doctest::detail::ContextBuilder::operator<< ( const T &&  )
inline

Definition at line 1610 of file doctest.h.

1610  {
1611  static_assert(deferred_false<T>::value,
1612  "Cannot pass temporaries or rvalues to the streaming operator because it "
1613  "caches pointers to the passed objects for lazy evaluation!");
1614  return *this;
1615  }
static const bool value
Definition: doctest.h:782

◆ operator=()

ContextBuilder& doctest::detail::ContextBuilder::operator= ( const ContextBuilder )
privatedelete

◆ stringify()

void doctest::detail::ContextBuilder::stringify ( std::ostream *  s) const
private

Friends And Related Function Documentation

◆ ContextScope

friend class ContextScope
friend

Definition at line 1531 of file doctest.h.

Field Documentation

◆ head

Node* doctest::detail::ContextBuilder::head = 0
private

Definition at line 1571 of file doctest.h.

◆ numCaptures

int doctest::detail::ContextBuilder::numCaptures = 0
private

Definition at line 1570 of file doctest.h.

◆ stackChunks

Chunk doctest::detail::ContextBuilder::stackChunks[5]
private

Definition at line 1569 of file doctest.h.

◆ tail

Node* doctest::detail::ContextBuilder::tail = 0
private

Definition at line 1572 of file doctest.h.


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