cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Stream_support: add indenting and coloring stream wrappers

Open lrineau opened this issue 2 months ago • 12 comments

Summary of Changes

Stream_support: add indenting and coloring stream wrappers

See the test examples.

Indenting

Example:

=== Basic Indenting Usage ===

1. Basic indentation with std::cout:
  This line is indented
  So is this one
  Multi-line output:
  Line 1
  Line 2
  Line 3
Back to normal indentation

2. Nested indentation levels:
| Level 1 indentation
| | Level 2 indentation
| | | Level 3 indentation
| | Back to level 2
| Back to level 1
Back to normal

3. Custom indentation string:
>>> Custom prefix on each line
>>> Works with multiple lines too
Normal output again

Coloring

Example: Screenshot_20251029_143948

Todo

  • [ ] Write a paragraph in the User Manual

Release Management

  • Affected package(s): Stream_support
  • Feature/Small Feature (if any): TODO
  • Link to compiled documentation (obligatory for small feature) wrong link name to be changed
  • License and copyright ownership: unchanged

lrineau avatar Oct 29 '25 13:10 lrineau

/build:v1

lrineau avatar Oct 29 '25 13:10 lrineau

There was an error while building the doc:

/home/runner/work/cgal/cgal/Stream_support/include/CGAL/IO/Color_ostream.h:298: warning: argument 'string' of command @param is not found in the argument list of CGAL::IO::Basic_color_streambuf< CharT, Traits >::set_color_code(const string &color_code)
/home/runner/work/cgal/cgal/Stream_support/include/CGAL/IO/Color_ostream.h:298: warning: The following parameter of CGAL::IO::Basic_color_streambuf::set_color_code(const string &color_code) is not documented:
  parameter 'color_code'

https://github.com/CGAL/cgal/actions/runs/18909983163

github-actions[bot] avatar Oct 29 '25 13:10 github-actions[bot]

/force-build:v1

lrineau avatar Oct 29 '25 15:10 lrineau

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/9115/v1/Manual/index.html

github-actions[bot] avatar Oct 29 '25 15:10 github-actions[bot]

/force-build:v1

lrineau avatar Oct 29 '25 16:10 lrineau

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/9115/v1/Manual/index.html

github-actions[bot] avatar Oct 29 '25 16:10 github-actions[bot]

Maybe even manipulators would be practical, but one then has the problem to distinguish from a color information to write.

afabri avatar Nov 03 '25 15:11 afabri

Warning in testsuite CGAL-6.2-Ic-48CGAL-6.2-Ic-48

Color_ostream.h(149,30): warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

afabri avatar Nov 25 '25 07:11 afabri

Is it necessary to document all classes? Isn't Basic_indenting_streambuf juxst an implementation detail?

afabri avatar Nov 26 '25 07:11 afabri

Is it necessary to document all classes? Isn't Basic_indenting_streambuf juxst an implementation detail?

That is right. I documented as the STL documented the stream classes. Should I hide the streambuf?

lrineau avatar Nov 26 '25 08:11 lrineau

I would document what is needed from a user perspective, and I think as a user I would not need the stream buffer class.

afabri avatar Nov 26 '25 09:11 afabri

Successfully tested in CGAL-6.2-Ic-53

sloriot avatar Dec 03 '25 10:12 sloriot