fluent-tray
Fluent Design-based GUI Library for System Tray Applications
Loading...
Searching...
No Matches
Functions
fluent_tray::util Namespace Reference

Utility namespace. More...

Functions

bool string2wstring (const std::string &str, std::wstring &wstr)
 Converts a UTF-8 encoded string to a wide string.
 
bool wstring2string (const std::wstring &wstr, std::string &str)
 Converts a wide string to a UTF-8 encoded string.
 
constexpr std::size_t bit2mask (std::size_t bits) noexcept
 Generates a mask with the specified number of lower bits set to 1.
 
template<typename Type >
constexpr int type2bit () noexcept
 Calculate the number of bits of type.
 
template<typename InType , typename OutType >
void split_bits (InType input, OutType &upper, OutType &lower) noexcept
 Divides the input value into upper and lower bits.
 
template<typename InType , typename OutType >
void concatenate_bits (InType upper, InType lower, OutType &out) noexcept
 Generates a variable that combines the bits of two variables.
 
unsigned char rgb2gray (const COLORREF &rgb)
 Calculate grayscale value from RGB.
 
bool exists (const std::wstring &path)
 Checks if the file exists.
 

Detailed Description

Utility namespace.

Function Documentation

◆ bit2mask()

constexpr std::size_t fluent_tray::util::bit2mask ( std::size_t bits)
inlineconstexprnoexcept

Generates a mask with the specified number of lower bits set to 1.

Parameters
[in]bitsNumber of bits
Returns
A generated bit mask.

◆ concatenate_bits()

void fluent_tray::util::concatenate_bits ( InType upper,
InType lower,
OutType & out )
inlinenoexcept

Generates a variable that combines the bits of two variables.

Parameters
[in]upperA input upper bits.
[in]lowerA input lower bits.
[out]outA output value.
See also
split_bits

◆ exists()

bool fluent_tray::util::exists ( const std::wstring & path)
inline

Checks if the file exists.

Parameters
[in]pathA input wide string of path.
Returns
Returns true if the file exists, false if it does not.

◆ rgb2gray()

unsigned char fluent_tray::util::rgb2gray ( const COLORREF & rgb)
inline

Calculate grayscale value from RGB.

Parameters
[in]rgbA input rgb value.
Returns
The grayscale value.

◆ split_bits()

void fluent_tray::util::split_bits ( InType input,
OutType & upper,
OutType & lower )
inlinenoexcept

Divides the input value into upper and lower bits.

Parameters
[in]inputA input value.
[out]upperA output upper bits.
[out]lowerA outputs lower bits.

The splits is performed by storing the lower bits of number of bits of OutType in lower and the remaining bits in upper.

See also
concatenate_bits

◆ string2wstring()

bool fluent_tray::util::string2wstring ( const std::string & str,
std::wstring & wstr )

Converts a UTF-8 encoded string to a wide string.

Parameters
[in]stra UTF-8 encoded string object.
[out]wstra output wide string object.
Returns
Returns true on success, false on failure.
See also
wstring2string

◆ type2bit()

template<typename Type >
constexpr int fluent_tray::util::type2bit ( )
inlineconstexprnoexcept

Calculate the number of bits of type.

Returns
The number of bits.

◆ wstring2string()

bool fluent_tray::util::wstring2string ( const std::wstring & wstr,
std::string & str )

Converts a wide string to a UTF-8 encoded string.

Parameters
[in]wstra output wide string object.
[out]stra UTF-8 encoded string object.
Returns
Returns true on success, false on failure.
See also
string2wstring