Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
internal::arg_converter< T, Context > Class Template Reference

Public Member Functions

 arg_converter (basic_format_arg< Context > &arg, char_type type)
void operator() (bool value)
template<typename U, FMT_ENABLE_IF(is_integral< U >::value)>
void operator() (U value)
template<typename U, FMT_ENABLE_IF(!is_integral< U >::value)>
void operator() (U)

Private Types

using char_type = typename Context::char_type

Private Member Functions

bool is_unsigned_type (internal::type t)
template<typename To, typename From>
To Cast (From x)
template<typename To, typename From>
std::enable_if< std::is_constructible< To, From >::value, To >::type UnsafeCast (From x)
template<typename To, typename From>
std::enable_if<!std::is_constructible< To, From >::value, To >::type UnsafeCast (From x)

Private Attributes

basic_format_arg< Context > & arg_
char_type type_

Constructor & Destructor Documentation

◆ arg_converter()

template<typename T, typename Context>
internal::arg_converter< T, Context >::arg_converter ( basic_format_arg< Context > & arg,
char_type type )
inline
71233 : arg_(arg), type_(type) {
71234 if ((type_ == 'd' || type_ == 'i') && is_unsigned_type(arg_.type())) {
71235 type_ = 'u';
71236 }
71237 }
Definition duckdb.cpp:71206

Member Function Documentation

◆ is_unsigned_type()

template<typename T, typename Context>
bool internal::arg_converter< T, Context >::is_unsigned_type ( internal::type t)
inlineprivate
71213 {
71214 return t == uint_type || t == ulong_long_type || t == uint128_type;
71215 }

◆ Cast()

template<typename T, typename Context>
template<typename To, typename From>
To internal::arg_converter< T, Context >::Cast ( From x)
inlineprivate
71218 {
71220 }

◆ UnsafeCast() [1/2]

template<typename T, typename Context>
template<typename To, typename From>
std::enable_if< std::is_constructible< To, From >::value, To >::type internal::arg_converter< T, Context >::UnsafeCast ( From x)
inlineprivate
71222 {
71223 return static_cast<To>(x);
71224 }

◆ UnsafeCast() [2/2]

template<typename T, typename Context>
template<typename To, typename From>
std::enable_if<!std::is_constructible< To, From >::value, To >::type internal::arg_converter< T, Context >::UnsafeCast ( From x)
inlineprivate
71227 {
71228 return static_cast<To>(x.lower);
71229 }

◆ operator()() [1/3]

template<typename T, typename Context>
void internal::arg_converter< T, Context >::operator() ( bool value)
inline
71239 {
71240 if (type_ != 's') operator()<bool>(value);
71241 }

◆ operator()() [2/3]

template<typename T, typename Context>
template<typename U, FMT_ENABLE_IF(is_integral< U >::value)>
void internal::arg_converter< T, Context >::operator() ( U value)
inline
71244 {
71245 bool is_signed = type_ == 'd' || type_ == 'i';
71247 if (const_check(sizeof(target_type) <= sizeof(int))) {
71248 // Extra casts are used to silence warnings.
71249 if (is_signed) {
71250 arg_ = internal::make_arg<Context>(UnsafeCast<int32_t>(UnsafeCast<target_type>(value)));
71251 } else {
71253 arg_ = internal::make_arg<Context>(UnsafeCast<uint32_t>(UnsafeCast<unsigned_type>(value)));
71254 }
71255 } else {
71256 if (is_signed) {
71257 // glibc's printf doesn't sign extend arguments of smaller types:
71258 // std::printf("%lld", -42); // prints "4294967254"
71259 // but we don't have to do the same because it's a UB.
71260 if (sizeof(target_type) > sizeof(int64_t)) {
71261 arg_ = internal::make_arg<Context>(Cast<int128_t>(value));
71262 } else {
71263 arg_ = internal::make_arg<Context>(UnsafeCast<int64_t>(value));
71264 }
71265 } else {
71267 }
71268 }
71269 }

◆ operator()() [3/3]

template<typename T, typename Context>
template<typename U, FMT_ENABLE_IF(!is_integral< U >::value)>
void internal::arg_converter< T, Context >::operator() ( U )
inline
71272{} // No conversion needed for non-integral types.

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