bump product version to 4.1.6.2
[LibreOffice.git] / include / cosv / std_outp.hxx
blob08fe179e16abd77bfc2d195a98f93d5208f535bc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef CSV_STD_OUTP_HXX
21 #define CSV_STD_OUTP_HXX
23 // USED SERVICES
24 // BASE CLASSES
25 // COMPONENTS
26 #include <cosv/csv_ostream.hxx>
27 // PARAMETERS
32 namespace csv
35 #ifdef CSV_NO_IOSTREAMS
36 class redirect_out : public ostream
38 public:
39 virtual ~redirect_out() {}
41 static void set_(
42 redirect_out & o_rStdOut,
43 redirect_out & o_rStdErr )
44 { pStdOut_ = &o_rStdOut;
45 pStdErr_ = &o_rStdErr; }
47 static redirect_out &
48 std_() { return *pStdOut_; }
49 static redirect_out &
50 err_() { return *pStdErr_; }
51 static bool useme_() { return pStdOut_ != 0; }
53 private:
54 // DATA
55 static redirect_out *
56 pStdOut_;
57 static redirect_out *
58 pStdErr_;
60 #endif // defined(CSV_NO_IOSTREAMS)
63 inline ostream &
64 Cout()
67 #ifndef CSV_NO_IOSTREAMS
68 // return redirect_out::useme_()
69 // ? (ostream&)( redirect_out::std_() )
70 // : (ostream&)( std::cout );
71 return (ostream&)( std::cout );
72 #else
73 csv_assert( redirect_out::useme_() );
74 return redirect_out::std_();
75 #endif
78 inline ostream &
79 Cerr()
81 #ifndef CSV_NO_IOSTREAMS
82 // return redirect_out::useme_()
83 // ? (ostream&)( redirect_out::err_() )
84 // : (ostream&)( std::cerr );
85 return (ostream&)( std::cerr );
86 #else
87 csv_assert( redirect_out::useme_() );
88 return redirect_out::err_();
89 #endif
94 typedef void (*F_FLUSHING_FUNC)(ostream&);
96 void Endl( ostream& );
98 void Flush( ostream& );
101 } // namespace csv
105 inline csv::ostream &
106 operator<<( csv::ostream & io_rStream,
107 csv::F_FLUSHING_FUNC i_fFlushingFunc )
109 #ifndef CSV_NO_IOSTREAMS
110 // (*i_fFlushingFunc)( io_rStream, csv::redirect_out::useme_(), 0 );
111 (*i_fFlushingFunc)( io_rStream );
112 #else
113 csv_assert( csv::redirect_out::useme_() );
114 (*i_fFlushingFunc)( io_rStream, true, 0 );
115 #endif
116 return io_rStream;
120 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */