25#if !defined( _WIN32 ) || !defined( __GNUC__ ) 
   26    #error streamwrapper.cpp should not be included in this build 
   38kicad::stream::stream()
 
   45kicad::stream::~stream()
 
   47    if( 
nullptr != m_stream )
 
   50    if( 
nullptr != m_buf )
 
   58std::iostream* kicad::stream::Open( 
const char* aFileName, std::ios_base::openmode aMode )
 
   60    if( 
nullptr != m_stream )
 
   66    if( 
nullptr != m_buf )
 
   74    if( aMode & std::ios_base::app )
 
   77    if( aMode & std::ios_base::out && aMode & std::ios_base::in )
 
   79    else if( aMode & std::ios_base::out )
 
   81    else if( aMode & std::ios_base::in )
 
   84    if( aMode & std::ios_base::binary )
 
   87    if( aMode & std::ios_base::out && aMode & std::ios_base::trunc
 
   88        && !( aMode & std::ios_base::app ) && !( aMode & std::ios_base::ate ) )
 
   91    if( aMode & std::ios_base::out )
 
   95    wxString lstr( wxString::FromUTF8Unchecked( aFileName ) );
 
   96    int fd = _wopen( lstr.wc_str(), flags, _S_IREAD | _S_IWRITE );
 
   98    if( fd >= 0 && aMode & std::ios_base::ate )
 
   99        lseek( fd, 0, SEEK_END );
 
  102    m_buf = 
new __gnu_cxx::stdio_filebuf<char>( fd, aMode );
 
  104    m_stream = 
new std::iostream( m_buf );
 
  110void kicad::stream::Close( 
void )
 
  117std::iostream* kicad::stream::GetStream( 
void )