The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
lg::tredirect_output_setter Class Reference

Helper class to redirect the output of the logger in a certain scope. More...

#include <log.hpp>

Public Member Functions

 tredirect_output_setter (std::ostream &stream)
 Constructor. More...
 
 ~tredirect_output_setter ()
 

Private Attributes

std::ostream * old_stream_
 The previously set redirection. More...
 

Detailed Description

Helper class to redirect the output of the logger in a certain scope.

The main usage of the redirection is for the unit tests to validate the output on the logger with the expected output.

Definition at line 71 of file log.hpp.

Constructor & Destructor Documentation

lg::tredirect_output_setter::tredirect_output_setter ( std::ostream &  stream)
explicit

Constructor.

Parameters
streamThe stream to direct the output to.

Definition at line 62 of file log.cpp.

References output_stream.

lg::tredirect_output_setter::~tredirect_output_setter ( )

Definition at line 68 of file log.cpp.

References old_stream_, and output_stream.

Member Data Documentation

std::ostream* lg::tredirect_output_setter::old_stream_
private

The previously set redirection.

This value is stored here to be restored in this destructor.

Definition at line 91 of file log.hpp.

Referenced by ~tredirect_output_setter().


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