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::basic_writer< Range >::int_writer< Int, Specs > Struct Template Reference

Classes

struct  dec_writer
struct  hex_writer
struct  bin_writer
struct  num_writer

Public Types

enum  { sep_size = 1 }
using unsigned_type = uint32_or_64_or_128_t<Int>

Public Member Functions

string_view get_prefix () const
 int_writer (basic_writer< Range > &w, Int value, const Specs &s)
void on_dec ()
void on_hex ()
void on_bin ()
void on_oct ()
void on_num ()
FMT_NORETURN void on_error (std::string error)

Public Attributes

basic_writer< Range > & writer
const Specs & specs
unsigned_type abs_value
char prefix [4]
unsigned prefix_size

Member Enumeration Documentation

◆ anonymous enum

template<typename Range>
template<typename Int, typename Specs>
anonymous enum
17810{ sep_size = 1 };

Constructor & Destructor Documentation

◆ int_writer()

template<typename Range>
template<typename Int, typename Specs>
internal::basic_writer< Range >::int_writer< Int, Specs >::int_writer ( basic_writer< Range > & w,
Int value,
const Specs & s )
inline
17731 : writer(w),
17732 specs(s),
17733 abs_value(static_cast<unsigned_type>(value)),
17734 prefix_size(0) {
17735 if (is_negative(value)) {
17736 prefix[0] = '-';
17737 ++prefix_size;
17738 abs_value = -abs_value;
17739 } else if (specs.sign != sign::none && specs.sign != sign::minus) {
17740 prefix[0] = specs.sign == sign::plus ? '+' : ' ';
17741 ++prefix_size;
17742 }
17743 }
Definition duckdb.cpp:17649

Member Function Documentation

◆ get_prefix()

template<typename Range>
template<typename Int, typename Specs>
string_view internal::basic_writer< Range >::int_writer< Int, Specs >::get_prefix ( ) const
inline
17728{ return string_view(prefix, prefix_size); }

◆ on_dec()

template<typename Range>
template<typename Int, typename Specs>
void internal::basic_writer< Range >::int_writer< Int, Specs >::on_dec ( )
inline
17754 {
17755 int num_digits = count_digits(abs_value);
17756 writer.write_int(num_digits, get_prefix(), specs,
17757 dec_writer{abs_value, num_digits});
17758 }

◆ on_hex()

template<typename Range>
template<typename Int, typename Specs>
void internal::basic_writer< Range >::int_writer< Int, Specs >::on_hex ( )
inline
17770 {
17771 if (specs.alt) {
17772 prefix[prefix_size++] = '0';
17773 prefix[prefix_size++] = specs.type;
17774 }
17775 int num_digits = count_digits<4>(abs_value);
17776 writer.write_int(num_digits, get_prefix(), specs,
17777 hex_writer{*this, num_digits});
17778 }

◆ on_bin()

template<typename Range>
template<typename Int, typename Specs>
void internal::basic_writer< Range >::int_writer< Int, Specs >::on_bin ( )
inline
17789 {
17790 if (specs.alt) {
17791 prefix[prefix_size++] = '0';
17792 prefix[prefix_size++] = static_cast<char>(specs.type);
17793 }
17794 int num_digits = count_digits<1>(abs_value);
17795 writer.write_int(num_digits, get_prefix(), specs,
17796 bin_writer<1>{abs_value, num_digits});
17797 }

◆ on_oct()

template<typename Range>
template<typename Int, typename Specs>
void internal::basic_writer< Range >::int_writer< Int, Specs >::on_oct ( )
inline
17799 {
17800 int num_digits = count_digits<3>(abs_value);
17801 if (specs.alt && specs.precision <= num_digits && abs_value != 0) {
17802 // Octal prefix '0' is counted as a digit, so only add it if precision
17803 // is not greater than the number of digits.
17804 prefix[prefix_size++] = '0';
17805 }
17806 writer.write_int(num_digits, get_prefix(), specs,
17807 bin_writer<3>{abs_value, num_digits});
17808 }

◆ on_num()

template<typename Range>
template<typename Int, typename Specs>
void internal::basic_writer< Range >::int_writer< Int, Specs >::on_num ( )
inline
17841 {
17842 std::string groups = grouping<char_type>(writer.locale_);
17843 if (groups.empty()) return on_dec();
17844 auto sep = specs.thousands;
17845 if (!sep) return on_dec();
17846 int num_digits = count_digits(abs_value);
17847 int size = num_digits;
17849 while (group != groups.cend() && num_digits > *group && *group > 0 &&
17850 *group != max_value<char>()) {
17851 size += sep_size;
17852 num_digits -= *group;
17853 ++group;
17854 }
17855 if (group == groups.cend())
17856 size += sep_size * ((num_digits - 1) / groups.back());
17857 writer.write_int(size, get_prefix(), specs,
17858 num_writer{abs_value, size, groups, static_cast<char_type>(sep)});
17859 }

◆ on_error()

template<typename Range>
template<typename Int, typename Specs>
FMT_NORETURN void internal::basic_writer< Range >::int_writer< Int, Specs >::on_error ( std::string error)
inline

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