Mir
Public Types | Public Member Functions | Protected Attributes | List of all members
mir::geometry::generic::Value< T, Tag > Struct Template Reference

Wraps a geometry value and prevents it from being accidentally used for invalid operations (such as setting a width to a height or adding two x positions together). Of course, explicit casts are possible to get around these restrictions (see the as_*() functions). More...

#include <dimensions.h>

Public Types

using ValueType = T
 
using TagType = Tag
 

Public Member Functions

template<typename Q = T>
constexpr std::enable_if< std::is_integral< Q >::value, int >::type as_int () const
 
template<typename Q = T>
constexpr std::enable_if< std::is_integral< Q >::value, uint32_t >::type as_uint32_t () const
 
constexpr T as_value () const noexcept
 
constexpr Value () noexcept
 
Valueoperator= (Value const &that) noexcept
 
constexpr Value (Value const &that) noexcept
 
template<typename U >
constexpr Value (Value< U, Tag > const &value) noexcept
 
template<typename U , typename std::enable_if< std::is_scalar< U >::value, bool >::type = true>
constexpr Value (U const &value) noexcept
 
constexpr auto operator== (Value< T, Tag > const &rhs) const -> bool
 
constexpr auto operator!= (Value< T, Tag > const &rhs) const -> bool
 
constexpr auto operator<= (Value< T, Tag > const &rhs) const -> bool
 
constexpr auto operator>= (Value< T, Tag > const &rhs) const -> bool
 
constexpr auto operator< (Value< T, Tag > const &rhs) const -> bool
 
constexpr auto operator> (Value< T, Tag > const &rhs) const -> bool
 

Protected Attributes

value
 

Detailed Description

template<typename T, typename Tag>
struct mir::geometry::generic::Value< T, Tag >

Wraps a geometry value and prevents it from being accidentally used for invalid operations (such as setting a width to a height or adding two x positions together). Of course, explicit casts are possible to get around these restrictions (see the as_*() functions).

Member Typedef Documentation

◆ TagType

template<typename T , typename Tag >
using mir::geometry::generic::Value< T, Tag >::TagType = Tag

◆ ValueType

template<typename T , typename Tag >
using mir::geometry::generic::Value< T, Tag >::ValueType = T

Constructor & Destructor Documentation

◆ Value() [1/4]

template<typename T , typename Tag >
constexpr mir::geometry::generic::Value< T, Tag >::Value ( )
inlineconstexprnoexcept

◆ Value() [2/4]

template<typename T , typename Tag >
constexpr mir::geometry::generic::Value< T, Tag >::Value ( Value< T, Tag > const &  that)
inlineconstexprnoexcept

◆ Value() [3/4]

template<typename T , typename Tag >
template<typename U >
constexpr mir::geometry::generic::Value< T, Tag >::Value ( Value< U, Tag > const &  value)
inlineexplicitconstexprnoexcept

◆ Value() [4/4]

template<typename T , typename Tag >
template<typename U , typename std::enable_if< std::is_scalar< U >::value, bool >::type = true>
constexpr mir::geometry::generic::Value< T, Tag >::Value ( U const &  value)
inlineexplicitconstexprnoexcept

Member Function Documentation

◆ as_int()

template<typename T , typename Tag >
template<typename Q = T>
constexpr std::enable_if< std::is_integral< Q >::value, int >::type mir::geometry::generic::Value< T, Tag >::as_int ( ) const
inlineconstexpr

◆ as_uint32_t()

template<typename T , typename Tag >
template<typename Q = T>
constexpr std::enable_if< std::is_integral< Q >::value, uint32_t >::type mir::geometry::generic::Value< T, Tag >::as_uint32_t ( ) const
inlineconstexpr

◆ as_value()

template<typename T , typename Tag >
constexpr T mir::geometry::generic::Value< T, Tag >::as_value ( ) const
inlineconstexprnoexcept

◆ operator!=()

template<typename T , typename Tag >
constexpr auto mir::geometry::generic::Value< T, Tag >::operator!= ( Value< T, Tag > const &  rhs) const -> bool
inlineconstexpr

◆ operator<()

template<typename T , typename Tag >
constexpr auto mir::geometry::generic::Value< T, Tag >::operator< ( Value< T, Tag > const &  rhs) const -> bool
inlineconstexpr

◆ operator<=()

template<typename T , typename Tag >
constexpr auto mir::geometry::generic::Value< T, Tag >::operator<= ( Value< T, Tag > const &  rhs) const -> bool
inlineconstexpr

◆ operator=()

template<typename T , typename Tag >
Value & mir::geometry::generic::Value< T, Tag >::operator= ( Value< T, Tag > const &  that)
inlinenoexcept

◆ operator==()

template<typename T , typename Tag >
constexpr auto mir::geometry::generic::Value< T, Tag >::operator== ( Value< T, Tag > const &  rhs) const -> bool
inlineconstexpr

◆ operator>()

template<typename T , typename Tag >
constexpr auto mir::geometry::generic::Value< T, Tag >::operator> ( Value< T, Tag > const &  rhs) const -> bool
inlineconstexpr

◆ operator>=()

template<typename T , typename Tag >
constexpr auto mir::geometry::generic::Value< T, Tag >::operator>= ( Value< T, Tag > const &  rhs) const -> bool
inlineconstexpr

Member Data Documentation

◆ value

template<typename T , typename Tag >
T mir::geometry::generic::Value< T, Tag >::value
protected

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

Copyright © 2012-2023 Canonical Ltd.
Generated on Tue 2 May 10:01:24 UTC 2023
This documentation is licensed under the GPL version 2 or 3.