SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::helper::console Namespace Reference

Namespaces

 internal
 

Classes

struct  Background
 
struct  Foreground
 

Typedefs

template<typename T >
using enableStd = typename std::enable_if< std::is_same< T, sofa::helper::console::Style >::value||std::is_same< T, sofa::helper::console::Foreground::Normal >::value||std::is_same< T, sofa::helper::console::Foreground::Bright >::value||std::is_same< T, sofa::helper::console::Background::Normal >::value||std::is_same< T, sofa::helper::console::Background::Bright >::value, std::ostream & >::type
 

Enumerations

enum  Status { Status::Auto = 0, Status::On = 1, Status::Off = 2 }
 
enum  Style {
  Style::Reset = 0, Style::Bold = 1, Style::Dim = 2, Style::Italic = 3,
  Style::Underline = 4, Style::Blink = 5, Style::Rblink = 6, Style::Reversed = 7,
  Style::Conceal = 8, Style::Crossed = 9
}
 

Functions

void setStatus (Status status) noexcept
 
Status getStatus () noexcept
 
size_t getColumnCount ()
 
template<typename T >
enableStd< T > operator<< (std::ostream &os, const T &value)
 to use stream operator with a styled output on any system More...
 

Detailed Description

Utility that manages the output style of a stream into a terminal. It is based heavily on the work of https://github.com/agauniyal/rang

Typedef Documentation

template<typename T >
using sofa::helper::console::enableStd = typedef typename std::enable_if< std::is_same<T, sofa::helper::console::Style>::value || std::is_same<T, sofa::helper::console::Foreground::Normal>::value || std::is_same<T, sofa::helper::console::Foreground::Bright>::value || std::is_same<T, sofa::helper::console::Background::Normal>::value || std::is_same<T, sofa::helper::console::Background::Bright>::value, std::ostream &>::type

Enumeration Type Documentation

Enumerator
Auto 
On 
Off 
Enumerator
Reset 
Bold 
Dim 
Italic 
Underline 
Blink 
Rblink 
Reversed 
Conceal 
Crossed 

Function Documentation

SOFA_HELPER_API size_t sofa::helper::console::getColumnCount ( )
SOFA_HELPER_API Status sofa::helper::console::getStatus ( )
noexcept
template<typename T >
enableStd<T> sofa::helper::console::operator<< ( std::ostream &  os,
const T &  value 
)
inline

to use stream operator with a styled output on any system

SOFA_HELPER_API void sofa::helper::console::setStatus ( Status  status)
noexcept

Enable or disable colors in stdout / stderr.

This controls whether using styled values in streams will actually do anything. Passing Auto means that styled output will be used for the stream only if it hasn't been redirected (on Unix only). By default, colors are enabled if supported (auto).