| 3762 | ANSIColourImpl( IStream* stream ): ColourImpl( stream ) {} |
| 3763 | |
| 3764 | static bool useImplementationForStream(IStream const& stream) { |
| 3765 | // This is kinda messy due to trying to support a bunch of |
| 3766 | // different platforms at once. |
| 3767 | // The basic idea is that if we are asked to do autodetection (as |
| 3768 | // opposed to being told to use posixy colours outright), then we |
| 3769 | // only want to use the colours if we are writing to console. |
| 3770 | // However, console might be redirected, so we make an attempt at |
| 3771 | // checking for that on platforms where we know how to do that. |
| 3772 | bool useColour = stream.isConsole(); |
| 3773 | #if defined( CATCH_INTERNAL_HAS_ISATTY ) && \ |
| 3774 | !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) ) |
| 3775 | ErrnoGuard _; // for isatty |
| 3776 | useColour = useColour && isatty( STDOUT_FILENO ); |
| 3777 | # endif |
| 3778 | # if defined( CATCH_PLATFORM_MAC ) || defined( CATCH_PLATFORM_IPHONE ) |
| 3779 | useColour = useColour && !isDebuggerActive(); |
| 3780 | # endif |
| 3781 | |
| 3782 | return useColour; |
| 3783 | } |
| 3784 | |
| 3785 | private: |
| 3786 | void use( Colour::Code _colourCode ) const override { |
nothing calls this directly
no test coverage detected