25#ifndef STREAMWRAPPER_H
26#define STREAMWRAPPER_H
31#if defined( _WIN32 ) && defined( __GNUC__ )
32#include <ext/stdio_filebuf.h>
34#define OSTREAM std::ostream
36#define OPEN_OSTREAM( var, name ) \
37 kicad::stream var##_BUF_; \
38 std::ostream& var = *var##_BUF_.Open( name, std::ios_base::out | std::ios_base::trunc \
39 | std::ios_base::binary )
41#define OPEN_ISTREAM( var, name ) \
42 kicad::stream var##_BUF_; \
43 std::istream& var = *var##_BUF_.Open( name, std::ios_base::in | std::ios_base::binary )
45#define OPEN_IOSTREAM( var, name ) \
46 kicad::stream var##_BUF_; \
47 std::iostream& var = *var##_BUF_.Open( name, std::ios_base::out | std::ios_base::in \
48 | std::ios_base::binary )
50#define CLOSE_STREAM( var ) var##_BUF_.Close()
63 __gnu_cxx::stdio_filebuf<char>* m_buf;
64 std::iostream* m_stream;
70 std::iostream* Open(
const char* aFileName, std::ios_base::openmode aMode );
73 std::iostream* GetStream(
void );
78#elif defined( _MSC_VER )
80#define OSTREAM std::ofstream
82#define OPEN_OSTREAM( var, name ) \
84 var.open( wxString::FromUTF8Unchecked( name ).wc_str(), \
85 std::ios_base::out | std::ios_base::trunc | std::ios_base::binary )
87#define OPEN_ISTREAM( var, name ) \
89 var.open( wxString::FromUTF8Unchecked( name ).wc_str(), \
90 std::ios_base::in | std::ios_base::binary )
92#define OPEN_IOSTREAM( var, name ) \
94 var.open( wxString::FromUTF8Unchecked( name ).wc_str(), \
95 std::ios_base::out | std::ios_base::in | std::ios_base::binary )
97#define CLOSE_STREAM( var ) var.close()
101#define OSTREAM std::ofstream
103#define OPEN_OSTREAM( var, name ) \
105 var.open( name, std::ios_base::out | std::ios_base::trunc )
107#define OPEN_ISTREAM( var, name ) \
109 var.open( name, std::ios_base::in )
111#define OPEN_IOSTREAM( var, name ) \
113 var.open( name, std::ios_base::out | std::ios_base::in )
115#define CLOSE_STREAM( var ) var.close()