1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef CSV_STD_OUTP_HXX
29 #define CSV_STD_OUTP_HXX
34 #include <cosv/csv_ostream.hxx>
43 #ifdef CSV_NO_IOSTREAMS
44 class redirect_out
: public ostream
47 virtual ~redirect_out() {}
49 void re_endl() { do_re_endl(); }
50 void re_flush() { do_re_flush(); }
53 redirect_out
& o_rStdOut
,
54 redirect_out
& o_rStdErr
)
55 { pStdOut_
= &o_rStdOut
;
56 pStdErr_
= &o_rStdErr
; }
59 std_() { return *pStdOut_
; }
61 err_() { return *pStdErr_
; }
62 static bool useme_() { return pStdOut_
!= 0; }
65 virtual void do_re_endl() = 0;
66 virtual void do_re_flush() = 0;
74 #endif // defined(CSV_NO_IOSTREAMS)
81 #ifndef CSV_NO_IOSTREAMS
82 // return redirect_out::useme_()
83 // ? (ostream&)( redirect_out::std_() )
84 // : (ostream&)( std::cout );
85 return (ostream
&)( std::cout
);
87 csv_assert( redirect_out::useme_() );
88 return redirect_out::std_();
95 #ifndef CSV_NO_IOSTREAMS
96 // return redirect_out::useme_()
97 // ? (ostream&)( redirect_out::err_() )
98 // : (ostream&)( std::cerr );
99 return (ostream
&)( std::cerr
);
101 csv_assert( redirect_out::useme_() );
102 return redirect_out::err_();
108 typedef void (*F_FLUSHING_FUNC
)(ostream
&, bool, int*);
110 void Endl( ostream
&, bool, int* );
112 void Flush( ostream
&, bool, int* );
119 inline csv::ostream
&
120 operator<<( csv::ostream
& io_rStream
,
121 csv::F_FLUSHING_FUNC i_fFlushingFunc
)
123 #ifndef CSV_NO_IOSTREAMS
124 // (*i_fFlushingFunc)( io_rStream, csv::redirect_out::useme_(), 0 );
125 (*i_fFlushingFunc
)( io_rStream
, false, 0 );
127 csv_assert( csv::redirect_out::useme_() );
128 (*i_fFlushingFunc
)( io_rStream
, true, 0 );