#ifndef FOLLY_FORMAT_H_
#error This file may only be included from Format.h.
#endif
#include <array>
#include <cinttypes>
#include <deque>
#include <map>
#include <unordered_map>
#include <vector>
#include <folly/Exception.h>
#include <folly/FormatTraits.h>
#include <folly/MapUtil.h>
#include <folly/Portability.h>
#include <folly/Traits.h>
#include <folly/lang/Exception.h>
#include <folly/lang/ToAscii.h>
#include <folly/portability/Windows.h>
FOLLY_PUSH_WARNING
FOLLY_GNU_DISABLE_WARNING(…)
FOLLY_GNU_DISABLE_WARNING(…)
namespace folly {
namespace detail {
void insertThousandsGroupingUnsafe(char* start_buffer, char** end_buffer);
extern const std::array<std::array<char, 2>, 256> formatHexUpper;
extern const std::array<std::array<char, 2>, 256> formatHexLower;
extern const std::array<std::array<char, 3>, 512> formatOctal;
extern const std::array<std::array<char, 8>, 256> formatBinary;
const size_t kMaxHexLength = …;
const size_t kMaxOctalLength = …;
const size_t kMaxBinaryLength = …;
template <class Uint>
size_t uintToHex(
char* buffer,
size_t bufLen,
Uint v,
std::array<std::array<char, 2>, 256> const& repr) { … }
template <class Uint>
inline size_t uintToHexLower(char* buffer, size_t bufLen, Uint v) { … }
template <class Uint>
inline size_t uintToHexUpper(char* buffer, size_t bufLen, Uint v) { … }
template <class Uint>
size_t uintToOctal(char* buffer, size_t bufLen, Uint v) { … }
template <class Uint>
size_t uintToBinary(char* buffer, size_t bufLen, Uint v) { … }
template <bool containerMode, bool RecordUsedArg, class Output>
void baseFormatterCallImpl(
Output& out,
size_t nargs,
const int widths[],
std::bool_constant<RecordUsedArg>(used)(const BaseFormatterBase&, size_t),
BaseFormatterBase::DoFormatFn<Output>* const funs[],
const BaseFormatterBase& base) { … }
}
template <class Derived, bool containerMode, size_t... I, class... Args>
template <class Output>
void BaseFormatterImpl<
Derived,
containerMode,
std::index_sequence<I...>,
Args...>::operator()(Output& out) const { … }
namespace format_value {
template <class FormatCallback>
void formatString(StringPiece val, FormatArg& arg, FormatCallback& cb) { … }
template <class FormatCallback>
void formatNumber(
StringPiece val, int prefixLen, FormatArg& arg, FormatCallback& cb) { … }
template <typename FormatCallback>
struct FormatFormatterFn { … };
template <class FormatCallback, bool containerMode, class... Args>
void formatFormatter(
const Formatter<containerMode, Args...>& formatter,
FormatArg& arg,
FormatCallback& cb) { … }
}
FormatValue<T, typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value>::type>;
template <>
class FormatValue<bool> { … };
template <>
class FormatValue<double> { … };
template <>
class FormatValue<float> { … };
FormatValue<T, typename std::enable_if<(!std::is_pointer<T>::value || !std::is_same<char, typename std::decay<typename std::remove_pointer<T>::type>::type>::value) && std::is_convertible<T, StringPiece>::value>::type>;
template <>
class FormatValue<std::nullptr_t> { … };
FormatValue<T *, typename std::enable_if<std::is_same<char, typename std::decay<T>::type>::value>::type>;
FormatValue<T *, typename std::enable_if<std::is_same<void, typename std::decay<T>::type>::value>::type>;
template <class T, class = void>
class TryFormatValue { … };
TryFormatValue<T, typename std::enable_if<0 < sizeof(FormatValue<typename std::decay<T>::type>)>::type>;
FormatValue<T *, typename std::enable_if<!std::is_same<char, typename std::decay<T>::type>::value && !std::is_same<void, typename std::decay<T>::type>::value>::type>;
namespace detail {
IndexableTraits<std::array<T, N>>;
IndexableTraits<std::vector<T, A>>;
IndexableTraits<std::deque<T, A>>;
IndexableTraits<std::map<K, T, C, A>, typename std::enable_if<std::is_integral<K>::value>::type>;
IndexableTraits<std::unordered_map<K, T, H, E, A>, typename std::enable_if<std::is_integral<K>::value>::type>;
}
FormatValue<T, typename detail::IndexableTraits<T>::enabled>;
FormatValue<detail::DefaultValueWrapper<Container, Value>, typename detail::IndexableTraits<Container>::enabled>;
namespace detail {
template <class T>
struct KeyFromStringPiece;
template <>
struct KeyFromStringPiece<std::string> : public FormatTraitsBase { … };
template <>
struct KeyFromStringPiece<fbstring> : public FormatTraitsBase { … };
template <>
struct KeyFromStringPiece<StringPiece> : public FormatTraitsBase { … };
template <class T>
struct KeyableTraitsAssoc : public FormatTraitsBase { … };
template <class T, class Enabled = void>
struct KeyableTraits;
KeyableTraits<std::map<K, T, C, A>, typename KeyFromStringPiece<K>::enabled>;
KeyableTraits<std::unordered_map<K, T, H, E, A>, typename KeyFromStringPiece<K>::enabled>;
}
FormatValue<T, typename detail::KeyableTraits<T>::enabled>;
FormatValue<detail::DefaultValueWrapper<Container, Value>, typename detail::KeyableTraits<Container>::enabled>;
FormatValue<std::pair<A, B>>;
FormatValue<std::tuple<Args...>>;
FormatValue<F<containerMode, Args...>, typename std::enable_if<detail::IsFormatter<F<containerMode, Args...>>::value>::type>;
template <class Tgt, bool containerMode, class... Args>
typename std::enable_if<IsSomeString<Tgt>::value>::type toAppend(
const Formatter<containerMode, Args...>& value, Tgt* result) { … }
}
FOLLY_POP_WARNING