LibCXXW 0.32.1
LibCXX Widget Toolkit
Public Types | Public Member Functions | List of all members
x::w::dim_arg Struct Reference

A dimension specification. More...

#include <dim_arg.H>

Public Types

typedef std::variant< std::string, double > variant_t
 Alias.
 

Public Member Functions

template<typename T , std::size_t n = is_numeric_or_string <std::remove_cv_t<std::remove_reference_t<T>>>::index>
 dim_arg (T &&t)
 Constructor.
 
 dim_arg ()
 Default constructor.
 
template<typename T , std::size_t n = is_numeric_or_string <std::remove_cv_t<std::remove_reference_t<T>>>::index>
dim_argoperator= (T &&t)
 Assignment operator.
 
variant_tvariant ()
 Helper to return the underlying variant type.
 
const variant_tvariant () const
 Helper to return the underlying variant type.
 

Detailed Description

A dimension specification.

Certain parameters may be specified either as a numeric value, or as a text string. A numerical value specifies a size expressed in millimeters. A text string references a size specified by the current display theme (this is mostly for the library's internal use).

The numeric value must be positive. The actual number of pixels gets computed based on the current theme's scaling factor. A non-0 dimension is always at least one pixel.

This is a tiny subclass of std::variant, providing a helping hand in constructing it.

Member Typedef Documentation

◆ variant_t

typedef std::variant<std::string, double> x::w::dim_arg::variant_t

Alias.

Constructor & Destructor Documentation

◆ dim_arg() [1/2]

template<typename T , std::size_t n = is_numeric_or_string <std::remove_cv_t<std::remove_reference_t<T>>>::index>
x::w::dim_arg::dim_arg ( T &&  t)
inline

Constructor.

Determine the appropriate variant_t constructor based on the parameter, to avoid some ambigous edge cases.

◆ dim_arg() [2/2]

x::w::dim_arg::dim_arg ( )
inline

Default constructor.

Member Function Documentation

◆ operator=()

template<typename T , std::size_t n = is_numeric_or_string <std::remove_cv_t<std::remove_reference_t<T>>>::index>
dim_arg & x::w::dim_arg::operator= ( T &&  t)
inline

Assignment operator.

Determine the appropriate variant_t alternative to assign based on the parameter, to avoid some ambigous edge cases.

◆ variant() [1/2]

variant_t & x::w::dim_arg::variant ( )
inline

Helper to return the underlying variant type.

◆ variant() [2/2]

const variant_t & x::w::dim_arg::variant ( ) const
inline

Helper to return the underlying variant type.


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