CGAL 6.2 - IO Streams: CGAL::IO::Basic_color_stream_guard< StreamT > Class Template Reference

CGAL 6.2 - IO Streams

Loading...
Searching...
No Matches
List of all members | Public Types | Public Member Functions
CGAL::IO::Basic_color_stream_guard< StreamT > Class Template Reference
Reference Manual

`#include <CGAL/IO/Color_ostream.h>`

## Definition

template<typename StreamT>
class CGAL::IO::Basic_color_stream_guard< StreamT >

RAII helper class for temporarily installing a color streambuf on a stream.

This class automatically restores the original streambuf when it goes out of scope. It provides a convenient way to add colors to output streams within a specific scope.

Template Parameters

  StreamT | The stream type (e.g., `std::ostream`, `std::wostream`)

See also
  Basic_color_streambuf
  make_color_guards

Examples
  Stream_support/color_ostream.cpp.

## Public Types
using | char_type = typename StreamT::char_type
| Character type.
using | traits_type = typename StreamT::traits_type
| Character traits type.
using | streambuf_type = Basic_color_streambuf< char_type, traits_type >
| Type of the color streambuf.
using | wrapped_streambuf_type = std::basic_streambuf< char_type, traits_type >
| Type of the wrapped streambuf.
using | string = std::basic_string< char_type >
| String type matching character type.

## Public Member Functions
template<typename... AnsiColors>
| Basic_color_stream_guard (StreamT &stream, AnsiColors... colors)
| constructs and installs a color streambuf with one or more colors.
| ~Basic_color_stream_guard ()
| Destructor - restores the original streambuf.

## Constructor & Destructor Documentation

## ◆ Basic_color_stream_guard()

template<typename StreamT >
template<typename... AnsiColors>

CGAL::IO::Basic_color_stream_guard< StreamT >::Basic_color_stream_guard | ( | StreamT & | stream,
|  | AnsiColors... | colors
| ) |  |
| explicit

constructs and installs a color streambuf with one or more colors.

Template Parameters

  AnsiColors | Variadic list of Ansi_color values

Parameters

  stream | The stream to modify
  colors | One or more colors to combine (e.g., `Ansi_color::Bold`, `Ansi_color::Red`)