Sequoia
Loading...
Searching...
No Matches
Classes | Functions | Variables
Indent.hpp File Reference

A collection of functions for formatting test output. More...

#include <algorithm>
#include <string>
#include <utility>

Go to the source code of this file.

Classes

class  sequoia::indentation
 Type-safe mechanism for indentations. More...
 

Functions

std::string sequoia::indent (std::string_view sv, indentation ind)
 For a non-empty string_view prepends with an indentation; otherwise returns an empty string.
 
std::string & sequoia::append_indented (std::string &s1, std::string_view s2, indentation ind)
 
std::string sequoia::append_indented (std::string_view sv1, std::string_view sv2, indentation ind)
 
template<class... Ts, std::size_t... I>
std::string & sequoia::impl::append_indented (std::string &s, std::tuple< Ts... > strs, std::index_sequence< I... >)
 
template<class... Ts>
std::string & sequoia::impl::append_indented (std::string &s, const std::tuple< Ts... > &strs)
 
template<class... Ts>
std::string sequoia::impl::indent (std::string_view sv, const std::tuple< Ts... > &strs)
 
template<class... Ts>
requires (sizeof...(Ts) > 2)
std::string & sequoia::append_indented (std::string &s, Ts... strs)
 
template<class... Ts>
requires (sizeof...(Ts) > 2)
std::string sequoia::append_indented (std::string_view sv, Ts... strs)
 
template<class... Ts>
requires (sizeof...(Ts) > 1)
std::string sequoia::indent (std::string_view sv, Ts &&... strs)
 
template<class... Ts>
requires (sizeof...(Ts) > 0)
std::string & sequoia::append_lines (std::string &s, Ts &&... strs)
 
template<class... Ts>
requires (sizeof...(Ts) > 0)
std::string sequoia::append_lines (std::string_view sv, Ts &&... strs)
 
std::string & sequoia::tabs_to_spacing (std::string &text, std::string_view spacing)
 

Variables

const indentation sequoia::tab {"\t"}
 
const indentation sequoia::no_indent {""}
 

Detailed Description

A collection of functions for formatting test output.

Function Documentation

◆ append_indented()

std::string & sequoia::append_indented ( std::string &  s1,
std::string_view  s2,
indentation  ind 
)
Parameters
s1The target for appending
s2The text to append
indentationThe absolute (not relative) indentation of s2

If s1 and s2 are both non-empty, a new line is appended to s1, followed by the indentation and then s2.

If s1 is empty, then s1 is set equal to s2, with no indentation.

If s2 is empty, no action is taken.