CAPTURE is now variadic

This commit is contained in:
Phil Nash
2018-06-27 21:34:35 +01:00
committed by Martin Hořeňovský
parent 1a63fad8d6
commit 1cdaa48a0b
4 changed files with 68 additions and 4 deletions

View File

@@ -8,11 +8,14 @@
#ifndef TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED
#define TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED
#include <string>
#include "catch_result_type.h"
#include "catch_common.h"
#include "catch_stream.h"
#include "catch_stringref.h"
#include "catch_interfaces_capture.h"
#include "catch_tostring.h"
#include <string>
#include <vector>
namespace Catch {
@@ -66,6 +69,28 @@ namespace Catch {
MessageInfo m_info;
};
class Capturer {
std::vector<MessageInfo> m_messages;
IResultCapture& m_resultCapture = getResultCapture();
size_t m_captured = 0;
public:
Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );
~Capturer();
void captureValue( size_t index, StringRef value );
template<typename T>
void captureValues( size_t index, T&& value ) {
captureValue( index, Catch::Detail::stringify( value ) );
}
template<typename T, typename... Ts>
void captureValues( size_t index, T&& value, Ts&&... values ) {
captureValues( index, value );
captureValues( index+1, values... );
}
};
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED