diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2004-06-25 11:15:55 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2004-06-25 11:15:55 +0000 |
| commit | 4a003a878cfff870c7b2417c824042af0af60d59 (patch) | |
| tree | 70903843d55ec93e1dae2b775978090002ef1af2 /include/cppunit | |
| parent | 07996b853a4b796ea6867f7c4a1b36a625cc8390 (diff) | |
| download | cppunit-4a003a878cfff870c7b2417c824042af0af60d59.tar.gz | |
Include/cppunit/Portability.
include/cppunit/Portability.h: moved OStringStream alias definition to
Portability/Stream.h. User need to define EVC4 to indicate that
config-evc4.h should be used. (how to we detect this automatically ?).
Notes that this means it might be needed to add #include <string> to some
headers since its no longer included by Portability.h.
* include/cppunit/Portability/Stream.h: define alias OStringStream, stdCOut(),
and OFileStream. If CPPUNIT_NO_STREAM is defined (evc4 config), then provides
our own implementation (based on sprintf and fwrite).
* include/cppunit/config/config-evc4.h: config file for embedded visual c++ 4.
Still need to detect for this platform in Portability.h (currently relying on
EVC4 being defined...)
* *.[cpp/h]: most source files have been impacted with the following change:
#include <iostream> -> #include <cppunit/Portability/Stream.h>
std::ostream -> CPPUNIT_NS::OStream
std::ofstream -> CPPUNIT_NS::OFileStream
std::cout -> CPPUNIT_NS::stdCOut()
std::endl -> "\n"
Also, code using std::cin as been defined out if CPPUNIT_NO_STREAM was defined.
The exact list of impact files can be obtain in CVS using tags:
TG_CPPUNIT_NO_STREAM_BEFORE & TG_CPPUNIT_NO_STREAM_AFTER.
Diffstat (limited to 'include/cppunit')
| -rw-r--r-- | include/cppunit/config/config-evc4.h | 9 | ||||
| -rw-r--r-- | include/cppunit/portability/Stream.h | 12 |
2 files changed, 15 insertions, 6 deletions
diff --git a/include/cppunit/config/config-evc4.h b/include/cppunit/config/config-evc4.h index 4f8c820..cb141b0 100644 --- a/include/cppunit/config/config-evc4.h +++ b/include/cppunit/config/config-evc4.h @@ -1,5 +1,5 @@ -#ifndef _INCLUDE_CPPUNIT_CONFIG_MSVC6_H -#define _INCLUDE_CPPUNIT_CONFIG_MSVC6_H 1 +#ifndef _INCLUDE_CPPUNIT_CONFIG_EVC4_H +#define _INCLUDE_CPPUNIT_CONFIG_EVC4_H 1 #if _MSC_VER > 1000 // VC++ #pragma warning( disable : 4786 ) // disable warning debug symbol > 255... @@ -41,8 +41,9 @@ #endif #define CPPUNIT_NO_STREAM 1 +#define CPPUNIT_NO_ASSERT 1 -#define CPPUNIT_HAVE_SSTREAM 1 +#define CPPUNIT_HAVE_SSTREAM 0 /* Name of package */ #ifndef CPPUNIT_PACKAGE @@ -68,5 +69,5 @@ */ -/* _INCLUDE_CPPUNIT_CONFIG_MSVC6_H */ +/* _INCLUDE_CPPUNIT_CONFIG_EVC4_H */ #endif diff --git a/include/cppunit/portability/Stream.h b/include/cppunit/portability/Stream.h index bc85f55..773fdea 100644 --- a/include/cppunit/portability/Stream.h +++ b/include/cppunit/portability/Stream.h @@ -94,6 +94,13 @@ public: { } + OStream &flush() + { + if ( buffer_ ) + buffer_->flush(); + return *this; + } + void setBuffer( StreamBuffer *buffer ) { buffer_ = buffer; @@ -233,7 +240,7 @@ public: } OFileStream( const char *path ) - : OFileStream( &buffer_ ) + : OStream( &buffer_ ) , buffer_( fopen( path, "wt" ) ) , ownFile_( true ) { @@ -242,11 +249,12 @@ public: virtual ~OFileStream() { if ( ownFile_ && buffer_.file() ) - fclose( file_ ); + fclose( buffer_.file() ); } private: FileStreamBuffer buffer_; + bool ownFile_; }; inline OStream &stdCOut() |
