My Project
Loading...
Searching...
No Matches
StdioFilePrinter.h
Go to the documentation of this file.
1#ifndef __cxxtest__StdioFilePrinter_h__
2#define __cxxtest__StdioFilePrinter_h__
3
4//
5// The StdioFilePrinter is a simple TestListener that
6// just prints "OK" if everything goes well, otherwise
7// reports the error in the format of compiler messages.
8// This class uses <stdio.h>, i.e. FILE * and fprintf().
9//
10
12#include <stdio.h>
13
14namespace CxxTest
15{
17 {
18 public:
19 StdioFilePrinter( FILE *o, const char *preLine = ":", const char *postLine = "" ) :
20 ErrorFormatter( new Adapter(o), preLine, postLine ) {}
21 virtual ~StdioFilePrinter() { delete outputStream(); }
22
23 private:
24 class Adapter : public OutputStream
25 {
26 Adapter( const Adapter & );
28
29 FILE *_o;
30
31 public:
32 Adapter( FILE *o ) : _o(o) {}
33 void flush() { fflush( _o ); }
34 OutputStream &operator<<( unsigned i ) { fprintf( _o, "%u", i ); return *this; }
35 OutputStream &operator<<( const char *s ) { fputs( s, _o ); return *this; }
37 };
38 };
39}
40
41#endif // __cxxtest__StdioFilePrinter_h__
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
OutputStream * outputStream() const
virtual OutputStream & operator<<(unsigned)
void(* Manipulator)(OutputStream &)
OutputStream & operator<<(const char *s)
OutputStream & operator<<(Manipulator m)
Adapter & operator=(const Adapter &)
OutputStream & operator<<(unsigned i)
StdioFilePrinter(FILE *o, const char *preLine=":", const char *postLine="")
char * s
Definition: ValueTraits.h:143