proxygen
folly::detail::SignedValueHandler< T, true > Class Template Reference

Public Member Functions

ConversionCode init (const char *&b)
 
ConversionCode overflow ()
 
template<typename U >
Expected< T, ConversionCodefinalize (U value)
 

Private Attributes

bool negative_
 

Detailed Description

template<typename T>
class folly::detail::SignedValueHandler< T, true >

Definition at line 467 of file Conv.cpp.

Member Function Documentation

template<typename T >
template<typename U >
Expected<T, ConversionCode> folly::detail::SignedValueHandler< T, true >::finalize ( value)
inline

Definition at line 488 of file Conv.cpp.

References folly::makeUnexpected(), folly::NEGATIVE_OVERFLOW, folly::POSITIVE_OVERFLOW, folly::T, and UNLIKELY.

488  {
489  T rv;
490  if (negative_) {
491  rv = T(-value);
492  if (UNLIKELY(rv > 0)) {
494  }
495  } else {
496  rv = T(value);
497  if (UNLIKELY(rv < 0)) {
499  }
500  }
501  return rv;
502  }
folly::std T
constexpr Unexpected< typename std::decay< Error >::type > makeUnexpected(Error &&)
Definition: Expected.h:785
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
#define UNLIKELY(x)
Definition: Likely.h:48
template<typename T >
ConversionCode folly::detail::SignedValueHandler< T, true >::init ( const char *&  b)
inline

Definition at line 469 of file Conv.cpp.

References b, folly::INVALID_LEADING_CHAR, folly::SUCCESS, and UNLIKELY.

469  {
470  negative_ = false;
471  if (!std::isdigit(*b)) {
472  if (*b == '-') {
473  negative_ = true;
474  } else if (UNLIKELY(*b != '+')) {
476  }
477  ++b;
478  }
480  }
char b
#define UNLIKELY(x)
Definition: Likely.h:48

Member Data Documentation

template<typename T >
bool folly::detail::SignedValueHandler< T, true >::negative_
private

Definition at line 505 of file Conv.cpp.


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