CGAL 6.2 - IO Streams
Loading...
Searching...
No Matches
CGAL::IO::Basic_indenting_stream_guard< StreamT > Class Template Reference

#include <CGAL/IO/Indenting_ostream.h>

Definition

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

RAII helper class for temporarily installing an indenting streambuf on a stream.

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

Template Parameters
StreamTThe stream type (e.g., std::ostream, std::wostream)
See also
Basic_indenting_streambuf
make_indenting_guards
Examples
Stream_support/indenting_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_indenting_streambuf< char_type, traits_type >
 Type of the indenting 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

 Basic_indenting_stream_guard (StreamT &stream, const string &indent_string)
 constructs and installs an indenting streambuf on the given stream.
 
 Basic_indenting_stream_guard (StreamT &stream, int spaces_per_level=2)
 constructs and installs an indenting streambuf on the given stream
 
 ~Basic_indenting_stream_guard ()
 Destructor - restores the original streambuf.
 

Constructor & Destructor Documentation

◆ Basic_indenting_stream_guard() [1/2]

template<typename StreamT >
CGAL::IO::Basic_indenting_stream_guard< StreamT >::Basic_indenting_stream_guard ( StreamT &  stream,
const string indent_string 
)
explicit

constructs and installs an indenting streambuf on the given stream.

Parameters
streamThe stream to modify
indent_stringThe indentation string to use

◆ Basic_indenting_stream_guard() [2/2]

template<typename StreamT >
CGAL::IO::Basic_indenting_stream_guard< StreamT >::Basic_indenting_stream_guard ( StreamT &  stream,
int  spaces_per_level = 2 
)

constructs and installs an indenting streambuf on the given stream

Parameters
streamThe stream to modify
spaces_per_levelNumber of indentation spaces