/*
 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
 *
 * Copyright (c) 1999
 * Silicon Graphics Computer Systems, Inc.
 *
 * Copyright (c) 1999
 * Boris Fomitchev
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */

#ifndef _STLP_IOSTREAM
#define _STLP_IOSTREAM

# ifndef _STLP_OUTERMOST_HEADER_ID
#  define _STLP_OUTERMOST_HEADER_ID 0x1037
#  include <stl/_prolog.h>
# endif

# ifdef _STLP_PRAGMA_ONCE
#  pragma once
# endif

#include <stl/_ioserr.h>

#ifdef _STLP_REDIRECT_STDSTREAMS
// for ofstream redirection
# include <fstream>
#endif

#include <stl/_iosfwd.h>
#include <stl/_istream.h>

_STLP_BEGIN_NAMESPACE

#ifndef _STLP_USE_NAMESPACES
// in case of SGI iostreams, we have to rename our streams not to clash with those
// provided in native lib
# define cin _STLP_cin
# define cout _STLP_cout
# define cerr _STLP_cerr
# define clog _STLP_clog
#endif

// Note: cin and wcin are both associated with stdio.  The C standard
// (Amendment 1, section 4.6.2.1) says that it is an error to mix
// wide- and narrow-oriented I/O on the same stream.  This implies
// that it is an error to use both cin and wcin in the same C++
// program; the same applies to cout and wcout, and cerr/clog and
// wcerr/wclog.

# ifdef _STLP_REDIRECT_STDSTREAMS
extern _STLP_DECLSPEC istream cin;
extern _STLP_DECLSPEC ofstream cout;
extern _STLP_DECLSPEC ofstream cerr;
extern _STLP_DECLSPEC ofstream clog;
# elif defined(__SYMBIAN32__WSD__) || defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
_STLP_DECLSPEC ostream& get_cerr();
_STLP_DECLSPEC ostream& get_cout();
_STLP_DECLSPEC ostream& get_clog();
_STLP_DECLSPEC istream& get_cin(); 
#   if defined (__SYMBIAN32__WSD__) || !defined(_STLP_DESIGNATED_DLL)
/* For the emulator, these definitions are used by the user as well as the STLPort library*/
/* For ARM platforms, user gets references to streams via function calls while the library uses the 
   objects internally.
*/
#define cerr get_cerr()
#define cin  get_cin()
#define cout get_cout()
#define clog get_clog()
#   endif //__SYMBIAN32__WSD__ || _STLP_DESIGNATED_DLL
#else
extern _STLP_DECLSPEC istream cin;
extern _STLP_DECLSPEC ostream cout;
extern _STLP_DECLSPEC ostream cerr; 
extern _STLP_DECLSPEC ostream clog;
# endif //_STLP_REDIRECT_STDSTREAMS

# ifndef _STLP_NO_WCHAR_T
# if defined(__SYMBIAN32__WSD__) || defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
_STLP_DECLSPEC wostream& get_wcerr();
_STLP_DECLSPEC wostream& get_wcout();
_STLP_DECLSPEC wostream& get_wclog();
_STLP_DECLSPEC wistream& get_wcin(); 

#   if defined (__SYMBIAN32__WSD__) || !defined(_STLP_DESIGNATED_DLL)
/* For the emulator, these definitions are used by the user as well as the STLPort library*/
/* For ARM platforms, user gets references to streams via function calls while the library uses the 
   objects internally.
*/
#define wcerr 	get_wcerr()
#define wcin 	get_wcin()
#define wcout	get_wcout()
#define wclog 	get_wclog()
#   endif //__SYMBIAN32__WSD__ || _STLP_DESIGNATED_DLL
#else //__SYMBIAN32__WSD__
extern _STLP_DECLSPEC wistream wcin;
extern _STLP_DECLSPEC wostream wcout;
extern _STLP_DECLSPEC wostream wcerr;
extern _STLP_DECLSPEC wostream wclog;
#endif //__SYMBIAN32__WSD__ || __SYMBIAN32__NO_STATIC_IMPORTS__
# endif  //_STLP_NO_WCHAR_T

_STLP_END_NAMESPACE

//# elif defined ( _STLP_USE_NO_IOSTREAMS )
//#  include <stl/_null_stream.h>

# if (_STLP_OUTERMOST_HEADER_ID == 0x1037)
#  include <stl/_epilog.h>
#  undef _STLP_OUTERMOST_HEADER_ID
# endif

#endif /* _STLP_IOSTREAM */

// Local Variables:
// mode:C++
// End:
