#ifndef ABSL_RANDOM_INTERNAL_IOSTREAM_STATE_SAVER_H_
#define ABSL_RANDOM_INTERNAL_IOSTREAM_STATE_SAVER_H_
#include <cmath>
#include <iostream>
#include <limits>
#include <type_traits>
#include "absl/meta/type_traits.h"
#include "absl/numeric/int128.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
template <typename T>
class null_state_saver { … };
template <typename OStream>
class ostream_state_saver { … };
#if defined(__NDK_MAJOR__) && __NDK_MAJOR__ < 16
#define ABSL_RANDOM_INTERNAL_IOSTREAM_HEXFLOAT …
#else
#define ABSL_RANDOM_INTERNAL_IOSTREAM_HEXFLOAT …
#endif
template <typename CharT, typename Traits>
ostream_state_saver<std::basic_ostream<CharT, Traits>> make_ostream_state_saver(
std::basic_ostream<CharT, Traits>& os,
std::ios_base::fmtflags flags = std::ios_base::dec | std::ios_base::left |
#if ABSL_RANDOM_INTERNAL_IOSTREAM_HEXFLOAT
std::ios_base::fixed |
#endif
std::ios_base::scientific) { … }
template <typename T>
typename absl::enable_if_t<!std::is_base_of<std::ios_base, T>::value,
null_state_saver<T>>
make_ostream_state_saver(T& is,
std::ios_base::fmtflags flags = std::ios_base::dec) { … }
template <typename T>
struct stream_precision_helper { … };
template <>
struct stream_precision_helper<float> { … };
template <>
struct stream_precision_helper<double> { … };
template <>
struct stream_precision_helper<long double> { … };
template <typename IStream>
class istream_state_saver { … };
template <typename CharT, typename Traits>
istream_state_saver<std::basic_istream<CharT, Traits>> make_istream_state_saver(
std::basic_istream<CharT, Traits>& is,
std::ios_base::fmtflags flags = std::ios_base::dec |
std::ios_base::scientific |
std::ios_base::skipws) { … }
template <typename T>
typename absl::enable_if_t<!std::is_base_of<std::ios_base, T>::value,
null_state_saver<T>>
make_istream_state_saver(T& is,
std::ios_base::fmtflags flags = std::ios_base::dec) { … }
template <typename T>
struct stream_format_type
: public std::conditional<(sizeof(T) == sizeof(char)), int, T> { … };
template <typename T>
struct stream_u128_helper;
template <>
struct stream_u128_helper<absl::uint128> { … };
#ifdef ABSL_HAVE_INTRINSIC_INT128
template <>
struct stream_u128_helper<__uint128_t> { … };
#endif
template <typename FloatType, typename IStream>
inline FloatType read_floating_point(IStream& is) { … }
}
ABSL_NAMESPACE_END
}
#endif