Embedded Template Library 1.0
to_arithmetic.h File Reference
#include "platform.h"
#include "type_traits.h"
#include "integral_limits.h"
#include "limits.h"
#include "string_view.h"
#include "basic_string.h"
#include "format_spec.h"
#include "radix.h"
#include "string_utilities.h"
#include "iterator.h"
#include "bit.h"
#include "smallest.h"
#include "absolute.h"
#include "expected.h"

Go to the source code of this file.

Classes

struct  etl::to_arithmetic_status
 Status values for to_arithmetic. More...
 
class  etl::to_arithmetic_result< TValue >
 Status values for to_arithmetic. More...
 
struct  etl::private_to_arithmetic::char_statics< T >
 
struct  etl::private_to_arithmetic::char_constant
 
struct  etl::private_to_arithmetic::integral_accumulator< TValue >
 Accumulate integrals. More...
 
struct  etl::private_to_arithmetic::floating_point_accumulator
 Accumulate floating point. More...
 
struct  etl::private_to_arithmetic::accumulator_type_select< 8U >
 
struct  etl::private_to_arithmetic::accumulator_type_select< 16U >
 
struct  etl::private_to_arithmetic::accumulator_type_select< 32U >
 
struct  etl::private_to_arithmetic::accumulator_type_select< 64U >
 

Namespaces

namespace  etl
 bitset_ext
 

Functions

ETL_NODISCARD ETL_CONSTEXPR14 bool etl::private_to_arithmetic::is_valid (char c, etl::radix::value_type radix)
 
ETL_NODISCARD ETL_CONSTEXPR14 char etl::private_to_arithmetic::digit_value (char c, etl::radix::value_type radix)
 
ETL_NODISCARD ETL_CONSTEXPR14 char etl::private_to_arithmetic::to_lower (char c)
 
template<typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 char etl::private_to_arithmetic::convert (TChar c)
 
template<typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 bool etl::private_to_arithmetic::check_and_remove_sign_prefix (etl::basic_string_view< TChar > &view)
 
ETL_NODISCARD ETL_CONSTEXPR14 bool etl::private_to_arithmetic::is_valid_radix (const etl::radix::value_type radix)
 Checks to see if the radix is valid.
 
template<typename TChar , typename TAccumulatorType >
ETL_NODISCARD ETL_CONSTEXPR14 etl::to_arithmetic_result< TAccumulatorType > etl::private_to_arithmetic::to_arithmetic_integral (const etl::basic_string_view< TChar > &view, const etl::radix::value_type radix, const TAccumulatorType maximum)
 Text to integral from view, radix value and maximum.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (etl::basic_string_view< TChar > view, const etl::radix::value_type radix)
 Text to integral from view and radix value type.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const etl::basic_string_view< TChar > &view)
 Text to integral from view and default decimal radix.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const etl::basic_string_view< TChar > &view, const typename etl::private_basic_format_spec::base_spec &spec)
 Text to integral from view and radix format spec.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const TChar *cp, size_t length, const etl::radix::value_type radix)
 Text to integral from pointer, length and radix value type.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const TChar *cp, size_t length)
 Text to integral from pointer, length and default decimal radix.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const TChar *cp, size_t length, const typename etl::private_basic_format_spec::base_spec &spec)
 Text to integral from pointer, length and radix format spec.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const etl::ibasic_string< TChar > &str, const etl::radix::value_type radix)
 Text to integral from string and radix value type.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const etl::ibasic_string< TChar > &str)
 Text to integral from string and default decimal radix.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const etl::ibasic_string< TChar > &str, const typename etl::private_basic_format_spec::base_spec &spec)
 Text to integral from string and radix format spec.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_floating_point< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (etl::basic_string_view< TChar > view)
 Floating point from view.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_floating_point< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const TChar *cp, size_t length)
 Floating point from pointer and length.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_floating_point< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const TChar *cp)
 Floating point from pointer.
 
template<typename TValue , typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 etl::enable_if< etl::is_floating_point< TValue >::value, etl::to_arithmetic_result< TValue > >::type etl::to_arithmetic (const etl::ibasic_string< TChar > &str)
 Floating point from string.
 
template<typename T >
ETL_CONSTEXPR14 bool operator== (const etl::to_arithmetic_result< T > &lhs, const etl::to_arithmetic_result< T > &rhs)
 Equality test for etl::to_arithmetic_result.
 
template<typename T , typename U >
ETL_CONSTEXPR14 bool operator== (const etl::to_arithmetic_result< T > &lhs, const U &rhs)
 Equality test for etl::to_arithmetic_result.
 
template<typename T , typename U >
ETL_CONSTEXPR14 bool operator== (const T &lhs, const etl::to_arithmetic_result< U > &rhs)
 Equality test for etl::to_arithmetic_result.
 
template<typename T >
ETL_CONSTEXPR14 bool operator!= (const etl::to_arithmetic_result< T > &lhs, const etl::to_arithmetic_result< T > &rhs)
 Inequality test for etl::to_arithmetic_result.
 
template<typename T , typename U >
ETL_CONSTEXPR14 bool operator!= (const etl::to_arithmetic_result< T > &lhs, const U &rhs)
 Inequality test for etl::to_arithmetic_result.
 
template<typename T , typename U >
ETL_CONSTEXPR14 bool operator!= (const T &lhs, const etl::to_arithmetic_result< T > &rhs)
 Inequality test for etl::to_arithmetic_result.
 

Function Documentation

◆ check_and_remove_sign_prefix()

template<typename TChar >
ETL_NODISCARD ETL_CONSTEXPR14 bool etl::private_to_arithmetic::check_and_remove_sign_prefix ( etl::basic_string_view< TChar > &  view)

Checks to see if the text starts with a '+' or '-' prefix, and modifies the view to remove it. Returns true if the text has a '-' prefix.