Defined in header <cparse/Indentation.hh>

std::ostream& operator<<( std::ostream& stream, Indentation const& object );

Writes object.getIndentation() space characters to stream and returns stream. The whole formatting API of Indentation.

Non-member function; not a class member. Lookup finds it via argument-dependent lookup on Indentation's namespace (fedem::parser).

Parameters

ParameterDescription
streamThe output stream to write to.
objectThe Indentation whose current indent to write.

Return value

stream, so the operator chains with other <<.

Exceptions

Not marked noexcept. Whatever the stream may throw via its exception mask propagates out.

Notes

The inserter loops getIndentation() times, writing one space per iteration. For an indent of zero, nothing is written and the stream is returned unchanged.

Example

Indentation indent;
indent.right();
std::cout << indent << "level 1\n";
indent.right();
std::cout << indent << "level 2\n";
indent.left(2);
std::cout << indent << "back to zero\n";

Output with the default step size of 2:

  level 1
    level 2
back to zero

See also