|
||||
File indexing completed on 2025-01-18 09:54:05
0001 0002 // Copyright Catch2 Authors 0003 // Distributed under the Boost Software License, Version 1.0. 0004 // (See accompanying file LICENSE.txt or copy at 0005 // https://www.boost.org/LICENSE_1_0.txt) 0006 0007 // SPDX-License-Identifier: BSL-1.0 0008 #ifndef CATCH_ISTREAM_HPP_INCLUDED 0009 #define CATCH_ISTREAM_HPP_INCLUDED 0010 0011 #include <catch2/internal/catch_noncopyable.hpp> 0012 #include <catch2/internal/catch_unique_ptr.hpp> 0013 0014 #include <iosfwd> 0015 #include <cstddef> 0016 #include <ostream> 0017 #include <string> 0018 0019 namespace Catch { 0020 0021 class IStream { 0022 public: 0023 virtual ~IStream(); // = default 0024 virtual std::ostream& stream() = 0; 0025 /** 0026 * Best guess on whether the instance is writing to a console (e.g. via stdout/stderr) 0027 * 0028 * This is useful for e.g. Win32 colour support, because the Win32 0029 * API manipulates console directly, unlike POSIX escape codes, 0030 * that can be written anywhere. 0031 * 0032 * Due to variety of ways to change where the stdout/stderr is 0033 * _actually_ being written, users should always assume that 0034 * the answer might be wrong. 0035 */ 0036 virtual bool isConsole() const { return false; } 0037 }; 0038 0039 /** 0040 * Creates a stream wrapper that writes to specific file. 0041 * 0042 * Also recognizes 4 special filenames 0043 * * `-` for stdout 0044 * * `%stdout` for stdout 0045 * * `%stderr` for stderr 0046 * * `%debug` for platform specific debugging output 0047 * 0048 * \throws if passed an unrecognized %-prefixed stream 0049 */ 0050 auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream>; 0051 0052 } 0053 0054 #endif // CATCH_STREAM_HPP_INCLUDED
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |