qxLib
Public Member Functions | List of all members
qx::details::string_to_color_converter< char_t > Class Template Referencefinal

Helper class for string -> color conversion. More...

Inheritance diagram for qx::details::string_to_color_converter< char_t >:
singleton< string_to_color_converter< char_t > >

Public Member Functions

void add (basic_string< char_t > sName, color_name_type eColorNameType, color color) noexcept
 Add new color to the mapping. More...
 
std::optional< colorget (const basic_string< char_t > &sName) const noexcept
 Try to get ac olor from a color name. More...
 
std::optional< basic_string_view< char_t > > get (const color &color, color_name_type eColorNameType) const noexcept
 Try to a color name get from a color. More...
 

Detailed Description

template<class char_t>
class qx::details::string_to_color_converter< char_t >

Helper class for string -> color conversion.

The only purpose of this class is to hide the map from a user

Template Parameters
char_t- string char type
Author
Khrapov
Date
5.04.2023

Definition at line 41 of file color.inl.

Member Function Documentation

◆ add()

template<class char_t >
void qx::details::string_to_color_converter< char_t >::add ( basic_string< char_t >  sName,
color_name_type  eColorNameType,
color  color 
)
inlinenoexcept

Add new color to the mapping.

Parameters
sName- color name
color- color

Definition at line 60 of file color.inl.

◆ get() [1/2]

template<class char_t >
std::optional<color> qx::details::string_to_color_converter< char_t >::get ( const basic_string< char_t > &  sName) const
inlinenoexcept

Try to get ac olor from a color name.

Parameters
sName- color name
Return values
-color or nullopt

Definition at line 75 of file color.inl.

◆ get() [2/2]

template<class char_t >
std::optional<basic_string_view<char_t> > qx::details::string_to_color_converter< char_t >::get ( const color color,
color_name_type  eColorNameType 
) const
inlinenoexcept

Try to a color name get from a color.

Parameters
color- color
eColorNameType- color type to get
Return values
-color name or nullopt

Definition at line 89 of file color.inl.


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