Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
TeeOutStream.h
1 /*
2  * io::TeeOutStream class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2013, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef ELM_IO_TEEOUTSTREAM_H_
23 #define ELM_IO_TEEOUTSTREAM_H_
24 
25 #include <elm/io/OutStream.h>
26 
27 namespace elm { namespace io {
28 
29 class TeeOutStream: public OutStream {
30 public:
31  TeeOutStream(OutStream& out1, OutStream& out2);
32  int write (const char *buffer, int size) override;
33  int flush (void) override;
34  cstring lastErrorMessage(void) override;
35  bool supportsANSI() const override;
36 
37 private:
38  OutStream& _out1;
39  OutStream& _out2;
40  enum {
41  OK = 0,
42  OUT1_ERROR,
43  OUT2_ERROR
44  } state;
45 };
46 
47 } } // elm::io
48 
49 #endif /* TEEOUTSTREAM_H_ */
elm::io::TeeOutStream::write
int write(const char *buffer, int size) override
Definition: io_TeeOutStream.cpp:42
elm::io::TeeOutStream::supportsANSI
bool supportsANSI() const override
Definition: io_TeeOutStream.cpp:87
elm::CString
Definition: CString.h:17
elm::io::TeeOutStream::lastErrorMessage
cstring lastErrorMessage(void) override
Definition: io_TeeOutStream.cpp:76
elm
Definition: adapter.h:26
elm::t::size
uint64 size
Definition: arch.h:35
elm::io::OutStream
Definition: OutStream.h:30
elm::io::TeeOutStream::TeeOutStream
TeeOutStream(OutStream &out1, OutStream &out2)
Definition: io_TeeOutStream.cpp:36
elm::io::TeeOutStream
Definition: TeeOutStream.h:29
elm::io::TeeOutStream::flush
int flush(void) override
Definition: io_TeeOutStream.cpp:59