Loading...
Searching...
No Matches
StdioFilePrinter.h
Go to the documentation of this file.
#ifndef __cxxtest__StdioFilePrinter_h__
#define __cxxtest__StdioFilePrinter_h__
//
// The StdioFilePrinter is a simple TestListener that
// just prints "OK" if everything goes well, otherwise
// reports the error in the format of compiler messages.
// This class uses <stdio.h>, i.e. FILE * and fprintf().
//
#include <cxxtest/ErrorFormatter.h>
#include <stdio.h>
namespace CxxTest
{
class StdioFilePrinter : public ErrorFormatter
{
public:
StdioFilePrinter( FILE *o, const char *preLine = ":", const char *postLine = "" ) :
ErrorFormatter( new Adapter(o), preLine, postLine ) {}
virtual ~StdioFilePrinter() { delete outputStream(); }
private:
class Adapter : public OutputStream
{
Adapter( const Adapter & );
Adapter &operator=( const Adapter & );
FILE *_o;
public:
Adapter( FILE *o ) : _o(o) {}
void flush() { fflush( _o ); }
OutputStream &operator<<( unsigned i ) { fprintf( _o, "%u", i ); return *this; }
OutputStream &operator<<( const char *s ) { fputs( s, _o ); return *this; }
OutputStream &operator<<( Manipulator m ) { return OutputStream::operator<<( m ); }
};
};
}
#endif // __cxxtest__StdioFilePrinter_h__
ErrorFormatter.h
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
CxxTest::ErrorFormatter::outputStream
OutputStream * outputStream() const
Definition ErrorFormatter.h:208
CxxTest::ErrorFormatter::ErrorFormatter
ErrorFormatter(OutputStream *o, const char *preLine=":", const char *postLine="")
Definition ErrorFormatter.h:36
CxxTest::OutputStream
Definition ErrorFormatter.h:20
CxxTest::OutputStream::operator<<
virtual OutputStream & operator<<(unsigned)
Definition ErrorFormatter.h:24
CxxTest::OutputStream::Manipulator
void(* Manipulator)(OutputStream &)
Definition ErrorFormatter.h:27
CxxTest::StdioFilePrinter::Adapter
Definition StdioFilePrinter.h:25
CxxTest::StdioFilePrinter::Adapter::operator<<
OutputStream & operator<<(const char *s)
Definition StdioFilePrinter.h:35
CxxTest::StdioFilePrinter::Adapter::operator<<
OutputStream & operator<<(Manipulator m)
Definition StdioFilePrinter.h:36
CxxTest::StdioFilePrinter::Adapter::Adapter
Adapter(FILE *o)
Definition StdioFilePrinter.h:32
CxxTest::StdioFilePrinter::Adapter::operator=
Adapter & operator=(const Adapter &)
CxxTest::StdioFilePrinter::Adapter::operator<<
OutputStream & operator<<(unsigned i)
Definition StdioFilePrinter.h:34
CxxTest::StdioFilePrinter::Adapter::_o
FILE * _o
Definition StdioFilePrinter.h:29
CxxTest::StdioFilePrinter::Adapter::Adapter
Adapter(const Adapter &)
CxxTest::StdioFilePrinter::Adapter::flush
void flush()
Definition StdioFilePrinter.h:33
CxxTest::StdioFilePrinter::~StdioFilePrinter
virtual ~StdioFilePrinter()
Definition StdioFilePrinter.h:21
CxxTest::StdioFilePrinter::StdioFilePrinter
StdioFilePrinter(FILE *o, const char *preLine=":", const char *postLine="")
Definition StdioFilePrinter.h:19
CxxTest
Definition Descriptions.cpp:7
CxxTest::s
char * s
Definition ValueTraits.h:143