///////////////////////////////////////////////////////////////////////////
// FILE: ostream/ostream.h (ostream class)
//
// =========================================================================
//
//                          Open Watcom Project
//
//    Copyright (c) 2002-2010 Open Watcom Contributors. All Rights Reserved.
//    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
//
//    This file is automatically generated. Do not edit directly.
//
// =========================================================================
//
// Description: This header is part of the C++ standard library. It
//              defines the output stream class and associated
//              parameterless manipulators.
///////////////////////////////////////////////////////////////////////////
#ifndef _OSTREAM_INCLUDED
#define _OSTREAM_INCLUDED

#ifndef _ENABLE_AUTODEPEND
 #pragma read_only_file;
#endif

#ifndef __cplusplus
 #error This header file requires C++
#endif

#ifndef _COMDEF_H_INCLUDED
 #include <_comdef.h>
#endif

#ifndef _IOS_INCLUDED
 #include <ios>
#endif

namespace std {

  // **************************** OSTREAM ************************************
#pragma pack( __push, 8 )
  class _WPRTLINK ostream : virtual public ios {
  public:
    ostream( streambuf *__sb );
    ostream( ostream const &__ostrm );
    virtual ~ostream();

    ostream &operator = ( streambuf *__sb );
    ostream &operator = ( ostream const &__ostrm );
    ostream &operator << (                char  __c );
    ostream &operator << (         signed char  __c );
    ostream &operator << (       unsigned char  __c );
    ostream &operator << (        signed short  __s );
    ostream &operator << (      unsigned short  __s );
    ostream &operator << (          signed int  __i );
    ostream &operator << (        unsigned int  __i );
    ostream &operator << (         signed long  __l );
    ostream &operator << (       unsigned long  __l );
    ostream &operator << (      signed __int64  __l );
    ostream &operator << (    unsigned __int64  __l );
    ostream &operator << (               float  __f );
    ostream &operator << (              double  __f );
    ostream &operator << (         long double  __f );
    ostream &operator << (                void *__p );
    ostream &operator << (           streambuf *__sb );
    ostream &operator << (          char const *__buf );
    ostream &operator << (   signed char const *__buf );
    ostream &operator << ( unsigned char const *__buf );
    ostream &operator << ( _WPRTLINK ostream &(*__f)( ostream & ) );
    ostream &operator << ( _WPRTLINK ios &(*__f)( ios & ) );

    int        opfx();
    void       osfx();
    ostream   &put(          char __c );
    ostream   &put(   signed char __c );
    ostream   &put( unsigned char __c );
    ostream   &write(          char const *__buf, int __len );
    ostream   &write(   signed char const *__buf, int __len );
    ostream   &write( unsigned char const *__buf, int __len );
    ostream   &flush();
    ostream   &seekp( streampos __position );
    ostream   &seekp( streamoff __offset, ios::seekdir __direction );
    streampos  tellp();

  protected:
    ostream();
    ostream &__outfloat( long double const & );
    ostream &do_lshift( char __c);
    int      do_opfx();
  };
#pragma pack( __pop )

#ifdef __BIG_INLINE__
  inline ostream &ostream::operator << ( char __c ) {
    __lock_it( __i_lock );
    if( opfx() ) {
        if( width() == 0 ) {
            if( rdbuf()->sputc( __c ) == EOF ) {
                setstate( ios::failbit );
            }
        } else {
            do_lshift( __c );
        }
        osfx();
    }
    return( *this );
  }
#endif

  inline ostream &ostream::operator << ( signed char __c ) {
    return( *this << (char) __c );
  }

  inline ostream &ostream::operator << ( unsigned char __c ) {
    return( *this << (char) __c );
  }

  inline ostream &ostream::operator << ( signed short __s ) {
    return( *this << (signed long) __s );
  }

  inline ostream &ostream::operator << ( unsigned short __s ) {
    return( *this << (unsigned long) __s );
  }

  inline ostream &ostream::operator << ( signed int __i ) {
    return( *this << (signed long) __i );
  }

  inline ostream &ostream::operator << ( unsigned int __i ) {
    return( *this << (unsigned long) __i );
  }

  inline ostream &ostream::operator << ( float __f ) {
    return( __outfloat( (long double)__f ) );
  }

  inline ostream &ostream::operator << ( double __f ) {
    return( __outfloat( (long double)__f ) );
  }

  inline ostream &ostream::operator << ( long double __f ) {
    return( __outfloat( __f ) );
  }

  inline ostream &ostream::operator << ( signed char const *__buf ) {
    return( *this << (char const *) __buf );
  }

  inline ostream &ostream::operator << ( unsigned char const *__buf ) {
    return( *this << (char const *) __buf );
  }

#ifdef __BIG_INLINE__
  inline ostream &ostream::put( char __c ) {
    __lock_it( __i_lock );
    if( opfx() ) {
        if( rdbuf()->sputc( __c ) == EOF ) {
            setstate( ios::failbit );
        }
        osfx();
    }
    return( *this );
  }
#endif

  inline ostream &ostream::put( signed char __c ) {
    return( put( (char) __c ) );
  }

  inline ostream &ostream::put( unsigned char __c ) {
    return( put( (char) __c ) );
  }

#ifdef __BIG_INLINE__
  inline ostream &ostream::write( char const *__buf, int __len ) {
    __lock_it( __i_lock );
    if( opfx() ) {
        if( __len  ) {
            if( rdbuf()->sputn( __buf, __len ) != __len ) {
                setstate( ios::failbit );
            }
        }
        osfx();
    }
    return( *this );
  }
#endif

  inline ostream &ostream::write( signed char const *__buf, int __len ) {
    return( write( (char const *) __buf, __len ) );
  }

  inline ostream &ostream::write( unsigned char const *__buf, int __len ) {
    return( write( (char const *) __buf, __len ) );
  }

  inline int ostream::opfx() {
    __lock_it( __i_lock );
    if( !good() ) {
        return 0;
    } else if( tie() || ( flags() & ios::stdio ) ) {
        return do_opfx();
    } else {
        return 1;
    }
  }

  inline void ostream::osfx() {
    __lock_it( __i_lock );
    if( flags() & ios::unitbuf ) {
        flush();
    }
  }

  // **************************** MANIPULATORS *******************************
  _WPRTLINK extern ostream & endl( ostream & );
  _WPRTLINK extern ostream & ends( ostream & );
  _WPRTLINK extern ostream &flush( ostream & );

} // namespace std

#endif
