Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::Capturer Class Reference

#include <catch_message.h>

Public Member Functions

 Capturer (StringRef macroName, SourceLineInfo const &lineInfo, ResultWas::OfType resultType, StringRef names)
 
 ~Capturer ()
 
void captureValue (size_t index, std::string const &value)
 
template<typename T >
void captureValues (size_t index, T const &value)
 
template<typename T , typename... Ts>
void captureValues (size_t index, T const &value, Ts const &... values)
 
 Capturer (StringRef macroName, SourceLineInfo const &lineInfo, ResultWas::OfType resultType, StringRef names)
 
 ~Capturer ()
 
void captureValue (size_t index, std::string const &value)
 
template<typename T >
void captureValues (size_t index, T const &value)
 
template<typename T , typename... Ts>
void captureValues (size_t index, T const &value, Ts const &... values)
 

Detailed Description

Definition at line 2277 of file catch.hpp.

Constructor & Destructor Documentation

◆ Capturer() [1/2]

Catch::Capturer::Capturer ( StringRef macroName,
SourceLineInfo const & lineInfo,
ResultWas::OfType resultType,
StringRef names )

Definition at line 70 of file catch_message.cpp.

70 {
71 auto trimmed = [&] (size_t start, size_t end) {
72 while (names[start] == ',' || isspace(names[start])) {
73 ++start;
74 }
75 while (names[end] == ',' || isspace(names[end])) {
76 --end;
77 }
78 return names.substr(start, end - start + 1);
79 };
80 auto skipq = [&] (size_t start, char quote) {
81 for (auto i = start + 1; i < names.size() ; ++i) {
82 if (names[i] == quote)
83 return i;
84 if (names[i] == '\\')
85 ++i;
86 }
87 CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched parentheses");
88 };
89
90 size_t start = 0;
91 std::stack<char> openings;
92 for (size_t pos = 0; pos < names.size(); ++pos) {
93 char c = names[pos];
94 switch (c) {
95 case '[':
96 case '{':
97 case '(':
98 // It is basically impossible to disambiguate between
99 // comparison and start of template args in this context
100// case '<':
101 openings.push(c);
102 break;
103 case ']':
104 case '}':
105 case ')':
106// case '>':
107 openings.pop();
108 break;
109 case '"':
110 case '\'':
111 pos = skipq(pos, c);
112 break;
113 case ',':
114 if (start != pos && openings.size() == 0) {
115 m_messages.emplace_back(macroName, lineInfo, resultType);
116 m_messages.back().message = trimmed(start, pos);
117 m_messages.back().message += " := ";
118 start = pos;
119 }
120 }
121 }
122 assert(openings.size() == 0 && "Mismatched openings");
123 m_messages.emplace_back(macroName, lineInfo, resultType);
124 m_messages.back().message = trimmed(start, names.size() - 1);
125 m_messages.back().message += " := ";
126 }
#define CATCH_INTERNAL_ERROR(msg)
not_this_one end(...)
Here is the call graph for this function:

◆ ~Capturer() [1/2]

Catch::Capturer::~Capturer ( )

Definition at line 127 of file catch_message.cpp.

127 {
128 if ( !uncaught_exceptions() ){
129 assert( m_captured == m_messages.size() );
130 for( size_t i = 0; i < m_captured; ++i )
131 m_resultCapture.popScopedMessage( m_messages[i] );
132 }
133 }
virtual void popScopedMessage(MessageInfo const &message)=0
Here is the call graph for this function:

◆ Capturer() [2/2]

Catch::Capturer::Capturer ( StringRef macroName,
SourceLineInfo const & lineInfo,
ResultWas::OfType resultType,
StringRef names )

◆ ~Capturer() [2/2]

Catch::Capturer::~Capturer ( )

Member Function Documentation

◆ captureValue() [1/2]

void Catch::Capturer::captureValue ( size_t index,
std::string const & value )

Definition at line 135 of file catch_message.cpp.

135 {
136 assert( index < m_messages.size() );
137 m_messages[index].message += value;
138 m_resultCapture.pushScopedMessage( m_messages[index] );
139 m_captured++;
140 }
#define value
Definition pkcs11.h:157
virtual void pushScopedMessage(MessageInfo const &message)=0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ captureValue() [2/2]

void Catch::Capturer::captureValue ( size_t index,
std::string const & value )

◆ captureValues() [1/4]

template<typename T >
void Catch::Capturer::captureValues ( size_t index,
T const & value )
inline

Definition at line 86 of file catch_message.h.

86 {
88 }
void captureValue(size_t index, std::string const &value)
std::string stringify(const T &e)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ captureValues() [2/4]

template<typename T >
void Catch::Capturer::captureValues ( size_t index,
T const & value )
inline

Definition at line 2288 of file catch.hpp.

2288 {
2290 }
Here is the call graph for this function:

◆ captureValues() [3/4]

template<typename T , typename... Ts>
void Catch::Capturer::captureValues ( size_t index,
T const & value,
Ts const &... values )
inline

Definition at line 91 of file catch_message.h.

91 {
93 captureValues( index+1, values... );
94 }
void captureValues(size_t index, T const &value)
GeneratorWrapper< T > values(std::initializer_list< T > values)
Here is the call graph for this function:

◆ captureValues() [4/4]

template<typename T , typename... Ts>
void Catch::Capturer::captureValues ( size_t index,
T const & value,
Ts const &... values )
inline

Definition at line 2293 of file catch.hpp.

2293 {
2295 captureValues( index+1, values... );
2296 }
Here is the call graph for this function:

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