OTest2
A C++ testing framework
teeostream.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Ondrej Starek
3  *
4  * This file is part of OTest2.
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OTest2__INCLUDE_OTEST2_TEEOSTREAM_H_
21 #define OTest2__INCLUDE_OTEST2_TEEOSTREAM_H_
22 
23 #include <initializer_list>
24 #include <ostream>
25 
26 namespace OTest2 {
27 
31 class TeeOStream : public std::ostream {
32  private:
33  class Buffer;
34  Buffer* buffer;
35 
36  public:
40  TeeOStream();
41 
47  explicit TeeOStream(
48  std::initializer_list<std::ostream*> sinks_);
49 
53  virtual ~TeeOStream();
54 
55  /* -- avoid copying */
56  TeeOStream(
57  const TeeOStream&) = delete;
59  const TeeOStream&) = delete;
60 
66  void appendSink(
67  std::ostream* sink_);
68 };
69 
70 } /* -- namespace OTest2 */
71 
72 #endif /* -- OTest2__INCLUDE_OTEST2_TEEOSTREAM_H_ */
OTest2::TeeOStream::operator=
TeeOStream & operator=(const TeeOStream &)=delete
OTest2
Definition: assertbean.h:25
OTest2::TeeOStream
An output stream working as the tee unix utility.
Definition: teeostream.h:31
OTest2::TeeOStream::Buffer
Definition: teeostream.cpp:30
OTest2::TeeOStream::appendSink
void appendSink(std::ostream *sink_)
Append another sink stream.
Definition: teeostream.cpp:94
OTest2::TeeOStream::TeeOStream
TeeOStream()
Ctor - no sinks.
Definition: teeostream.cpp:79
OTest2::TeeOStream::~TeeOStream
virtual ~TeeOStream()
Ctor.
Definition: teeostream.cpp:90