OTest2
A C++ testing framework
Public Member Functions | List of all members
OTest2::AssertStream Class Reference

Assertion stream. More...

#include <assertstream.h>

Inheritance diagram for OTest2::AssertStream:
Inheritance graph
[legend]
Collaboration diagram for OTest2::AssertStream:
Collaboration graph
[legend]

Public Member Functions

 AssertStream (const AssertStream &)=delete
 
AssertStreamoperator= (const AssertStream &)=delete
 
 AssertStream (const Context &context_, AssertBufferPtr buffer_, bool result_, std::initializer_list< const char * > parameters_)
 Ctor. More...
 
 AssertStream (AssertStream &&other_)
 Move ctor. More...
 
virtual ~AssertStream ()
 Dtor. More...
 
void setForeground (Color color_)
 Set foreground color. More...
 
void setBackground (Color color_)
 Set background color. More...
 
void setTextStyle (Style style_)
 Set text style. More...
 
void resetAttributes ()
 Reset the color and style attributes. More...
 
void printParameter (int index_)
 Print assertion parameter at the zero based index_. More...
 
void commitMessage ()
 Commit the assertion message. More...
 
bool getResult ()
 Return the assertion result. More...
 

Detailed Description

Assertion stream.

The assertion stream is used to construct assertion messages. Beside traditional text formatting it allows to colorize the output.

Definition at line 40 of file assertstream.h.

Constructor & Destructor Documentation

◆ AssertStream() [1/3]

OTest2::AssertStream::AssertStream ( const AssertStream )
delete

◆ AssertStream() [2/3]

OTest2::AssertStream::AssertStream ( const Context context_,
AssertBufferPtr  buffer_,
bool  result_,
std::initializer_list< const char * >  parameters_ 
)
explicit

Ctor.

Parameters
context_OTest2 context
buffer_An assertion buffer
result_Result of the assertion
parameters_Text strings representing assertion parameters.

Definition at line 29 of file assertstream.cpp.

◆ AssertStream() [3/3]

OTest2::AssertStream::AssertStream ( AssertStream &&  other_)

Move ctor.

Definition at line 43 of file assertstream.cpp.

◆ ~AssertStream()

OTest2::AssertStream::~AssertStream ( )
virtual

Dtor.

Definition at line 52 of file assertstream.cpp.

Member Function Documentation

◆ commitMessage()

void OTest2::AssertStream::commitMessage ( )

Commit the assertion message.

Definition at line 88 of file assertstream.cpp.

◆ getResult()

bool OTest2::AssertStream::getResult ( )

Return the assertion result.

This is a helper method which is designated to be used at the end of the assertion function. The user doesn't keep the result flag himself.

Definition at line 93 of file assertstream.cpp.

◆ operator=()

AssertStream& OTest2::AssertStream::operator= ( const AssertStream )
delete

◆ printParameter()

void OTest2::AssertStream::printParameter ( int  index_)

Print assertion parameter at the zero based index_.

Definition at line 80 of file assertstream.cpp.

◆ resetAttributes()

void OTest2::AssertStream::resetAttributes ( )

Reset the color and style attributes.

Definition at line 75 of file assertstream.cpp.

◆ setBackground()

void OTest2::AssertStream::setBackground ( Color  color_)

Set background color.

Parameters
color_The color

Definition at line 63 of file assertstream.cpp.

◆ setForeground()

void OTest2::AssertStream::setForeground ( Color  color_)

Set foreground color.

Parameters
color_The color

Definition at line 57 of file assertstream.cpp.

◆ setTextStyle()

void OTest2::AssertStream::setTextStyle ( Style  style_)

Set text style.

Parameters
style_The style

Definition at line 69 of file assertstream.cpp.


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