Simple-Log  alpha-v0.7
sl::log::ConsoleTextStyleTable< TProjection, TTable > Class Template Reference

Convenience class for setting up style policies for a given Record member. More...

#include <ConsoleSink.hpp>

Public Types

using Projection_t = std::remove_cvref_t< TProjection >
 
using Table_t = std::remove_cvref_t< TTable >
 
using Key_t = typename Table_t::key_type
 

Public Member Functions

 ConsoleTextStyleTable (TProjection projection, TTable table)
 Constructor. More...
 
template<Record TRecord>
ConsoleTextStyle operator() (const TRecord &record) const
 Invocation operator. More...
 
void insert (Key_t key, ConsoleTextStyle style)
 Inserts a style policy. More...
 

Detailed Description

template<class TProjection, class TTable>
class sl::log::ConsoleTextStyleTable< TProjection, TTable >

Convenience class for setting up style policies for a given Record member.

Template Parameters
TProjectionThe type of the projection
TTableThe type of the internally used container. Can be either std::map or std::unordered_map

Users have to provide a finally established container, which will then used for determining the appearance of the current Record. If no matching entry is found, defaultConsoleTextStyle will be used instead.

Instead of directly constructing instances of this class, users should use the makeConsoleTextStyleTableFor function.

Version
since alpha-0.6

Member Typedef Documentation

◆ Key_t

template<class TProjection , class TTable >
using sl::log::ConsoleTextStyleTable< TProjection, TTable >::Key_t = typename Table_t::key_type

◆ Projection_t

template<class TProjection , class TTable >
using sl::log::ConsoleTextStyleTable< TProjection, TTable >::Projection_t = std::remove_cvref_t<TProjection>

◆ Table_t

template<class TProjection , class TTable >
using sl::log::ConsoleTextStyleTable< TProjection, TTable >::Table_t = std::remove_cvref_t<TTable>

Constructor & Destructor Documentation

◆ ConsoleTextStyleTable()

template<class TProjection , class TTable >
sl::log::ConsoleTextStyleTable< TProjection, TTable >::ConsoleTextStyleTable ( TProjection  projection,
TTable  table 
)
inline

Constructor.

Parameters
projectionThe projection to a member of the currently used Record type
tableThe finally established container object

Member Function Documentation

◆ insert()

template<class TProjection , class TTable >
void sl::log::ConsoleTextStyleTable< TProjection, TTable >::insert ( Key_t  key,
ConsoleTextStyle  style 
)
inline

Inserts a style policy.

Parameters
keyThe key, on which the style will be applied
styleThe style which will be used, when the key is detected

Inserts or, if key is already present, overrides the style.

◆ operator()()

template<class TProjection , class TTable >
template<Record TRecord>
ConsoleTextStyle sl::log::ConsoleTextStyleTable< TProjection, TTable >::operator() ( const TRecord &  record) const
inline

Invocation operator.

Template Parameters
TRecordThe currently used Record type
Parameters
recordThe actual Record object
Returns
Returns the ConsoleTextStyle which should be applied for this Record

If no matching established is found, defaultConsoleTextStyle will be used instead.


The documentation for this class was generated from the following file: