My Project
UNKNOWN_GIT_VERSION
libpolys
tests
cxxtest
ErrorPrinter.h
Go to the documentation of this file.
1
#ifndef __cxxtest__ErrorPrinter_h__
2
#define __cxxtest__ErrorPrinter_h__
3
4
//
5
// The ErrorPrinter 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
// The ErrorPrinter uses std::cout
9
//
10
11
#include <
cxxtest/Flags.h
>
12
13
#ifndef _CXXTEST_HAVE_STD
14
# define _CXXTEST_HAVE_STD
15
#endif // _CXXTEST_HAVE_STD
16
17
#include <
cxxtest/ErrorFormatter.h
>
18
#include <
cxxtest/StdValueTraits.h
>
19
20
#ifdef _CXXTEST_OLD_STD
21
# include <iostream.h>
22
#else // !_CXXTEST_OLD_STD
23
# include <iostream>
24
#endif // _CXXTEST_OLD_STD
25
26
namespace
CxxTest
27
{
28
class
ErrorPrinter
:
public
ErrorFormatter
29
{
30
public
:
31
ErrorPrinter
(
CXXTEST_STD
(ostream) &o =
CXXTEST_STD
(cout),
const
char
*preLine =
":"
,
const
char
*postLine =
""
) :
32
ErrorFormatter
( new
Adapter
(o), preLine, postLine ) {}
33
virtual
~ErrorPrinter
() {
delete
outputStream
(); }
34
35
private
:
36
class
Adapter
:
public
OutputStream
37
{
38
CXXTEST_STD
(ostream) &
_o
;
39
public
:
40
Adapter
(
CXXTEST_STD
(ostream) &o ) :
_o
(o) {}
41
void
flush
() {
_o
.
flush
(); }
42
OutputStream
&
operator<<
(
const
char
*
s
) {
_o
<<
s
;
return
*
this
; }
43
OutputStream
&
operator<<
(
Manipulator
m
) {
return
OutputStream::operator<<
(
m
); }
44
OutputStream
&
operator<<
(
unsigned
i
)
45
{
46
char
s
[1 + 3 *
sizeof
(unsigned)];
47
numberToString(
i
,
s
);
48
_o
<<
s
;
49
return
*
this
;
50
}
51
};
52
};
53
}
54
55
#endif // __cxxtest__ErrorPrinter_h__
StdValueTraits.h
CxxTest::ErrorPrinter::Adapter
Definition:
ErrorPrinter.h:37
CxxTest::ErrorPrinter::Adapter::Adapter
Adapter(CXXTEST_STD(ostream) &o)
Definition:
ErrorPrinter.h:40
CxxTest::ErrorPrinter::~ErrorPrinter
virtual ~ErrorPrinter()
Definition:
ErrorPrinter.h:33
CxxTest::ErrorPrinter::Adapter::operator<<
OutputStream & operator<<(const char *s)
Definition:
ErrorPrinter.h:42
CxxTest::OutputStream::Manipulator
void(* Manipulator)(OutputStream &)
Definition:
ErrorFormatter.h:27
ErrorFormatter.h
CxxTest::OutputStream::operator<<
virtual OutputStream & operator<<(unsigned)
Definition:
ErrorFormatter.h:24
CxxTest::ErrorPrinter::Adapter::flush
void flush()
Definition:
ErrorPrinter.h:41
CxxTest::ErrorPrinter::ErrorPrinter
ErrorPrinter(CXXTEST_STD(ostream) &o=CXXTEST_STD(cout), const char *preLine=":", const char *postLine="")
Definition:
ErrorPrinter.h:31
CxxTest::s
char * s
Definition:
ValueTraits.h:143
i
int i
Definition:
cfEzgcd.cc:125
CxxTest::OutputStream::flush
virtual void flush()
Definition:
ErrorFormatter.h:23
CXXTEST_STD
#define CXXTEST_STD(x)
Definition:
StdValueTraits.h:16
CxxTest::ErrorFormatter
Definition:
ErrorFormatter.h:34
m
int m
Definition:
cfEzgcd.cc:121
CxxTest::ErrorFormatter::outputStream
OutputStream * outputStream() const
Definition:
ErrorFormatter.h:208
CxxTest::ErrorPrinter::Adapter::operator<<
OutputStream & operator<<(Manipulator m)
Definition:
ErrorPrinter.h:43
Flags.h
CxxTest
Definition:
Descriptions.cpp:7
CxxTest::ErrorPrinter::Adapter::operator<<
OutputStream & operator<<(unsigned i)
Definition:
ErrorPrinter.h:44
CxxTest::OutputStream
Definition:
ErrorFormatter.h:20
CxxTest::ErrorFormatter::_o
OutputStream * _o
Definition:
ErrorFormatter.h:275
CxxTest::ErrorPrinter::Adapter::CXXTEST_STD
CXXTEST_STD(ostream) &_o
CxxTest::ErrorPrinter
Definition:
ErrorPrinter.h:29
Generated on Sat Jul 11 2020 00:00:00 for My Project by
doxygen 1.8.18
for
Singular UNKNOWN_GIT_VERSION