52 #ifndef ABSL_STRINGS_STR_CAT_H_ 53 #define ABSL_STRINGS_STR_CAT_H_ 58 #include <type_traits> 67 namespace strings_internal {
71 template <
size_t max_size>
73 std::array<char, max_size>
data;
137 template <
typename Int>
140 typename std::enable_if<
sizeof(Int) == 1 &&
142 :
Hex(spec, static_cast<uint8_t>(v)) {}
143 template <
typename Int>
146 typename std::enable_if<
sizeof(Int) == 2 &&
148 :
Hex(spec, static_cast<uint16_t>(v)) {}
149 template <
typename Int>
152 typename std::enable_if<
sizeof(Int) == 4 &&
154 :
Hex(spec, static_cast<uint32_t>(v)) {}
155 template <
typename Int>
158 typename std::enable_if<
sizeof(Int) == 8 &&
160 :
Hex(spec, static_cast<uint64_t>(v)) {}
161 template <
typename Po
intee>
163 :
Hex(spec, reinterpret_cast<uintptr_t>(v)) {}
188 template <
typename Int>
190 typename std::enable_if<(
sizeof(Int) <= 8)>::type* =
nullptr)
191 : value(v >= 0 ? static_cast<uint64_t>(v)
192 : uint64_t{0} -
static_cast<uint64_t
>(
v)),
241 template <
size_t size>
249 template <
typename Allocator>
251 const std::basic_string<
char, std::char_traits<char>, Allocator>& str)
261 const char*
data()
const {
return piece_.data(); }
266 template <
typename T,
267 typename =
typename std::enable_if<
268 std::is_enum<T>{} && !std::is_convertible<T, int>{}>::type>
270 :
AlphaNum(static_cast<typename
std::underlying_type<T>::type>(e)) {}
276 typename std::enable_if<
278 (std::is_same<T, std::vector<bool>::reference>
::value ||
279 std::is_same<T, std::vector<bool>::const_reference>
::value)>::type* =
315 namespace strings_internal {
318 std::string
CatPieces(std::initializer_list<absl::string_view> pieces);
320 std::initializer_list<absl::string_view> pieces);
327 return std::string(a.
data(), a.
size());
337 template <
typename... AV>
340 const AlphaNum& e,
const AV&... args) {
343 static_cast<const AlphaNum&
>(args).Piece()...});
382 template <
typename... AV>
388 static_cast<const AlphaNum&
>(args).Piece()...});
404 #endif // ABSL_STRINGS_STR_CAT_H_
absl::string_view::size_type size() const
AlphaNum(const char *c_str)
char * FastIntToBuffer(int32_t, char *)
void StrAppend(std::string *dest, const AlphaNum &a)
Hex(Int v, PadSpec spec=absl::kNoPad, typename std::enable_if< sizeof(Int)==1 &&!std::is_pointer< Int >::value >::type *=nullptr)
size_t SixDigitsToBuffer(double d, char *buffer)
absl::string_view Piece() const
const char * data() const
std::array< char, max_size > data
AlphaNum(const strings_internal::AlphaNumBuffer< size > &buf)
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
std::string CatPieces(std::initializer_list< absl::string_view > pieces)
AlphaNum(unsigned long long x)
AlphaNum(absl::string_view pc)
strings_internal::AlphaNumBuffer< numbers_internal::kSixDigitsToBufferSize > SixDigits(double d)
Dec(Int v, PadSpec spec=absl::kNoPad, typename std::enable_if<(sizeof(Int)<=8)>::type *=nullptr)
Hex(PadSpec spec, uint64_t v)
#define ABSL_MUST_USE_RESULT
Hex(Pointee *v, PadSpec spec=absl::kNoPad)
static const int kSixDigitsToBufferSize
Hex(Int v, PadSpec spec=absl::kNoPad, typename std::enable_if< sizeof(Int)==4 &&!std::is_pointer< Int >::value >::type *=nullptr)
Hex(Int v, PadSpec spec=absl::kNoPad, typename std::enable_if< sizeof(Int)==2 &&!std::is_pointer< Int >::value >::type *=nullptr)
AlphaNum(const std::basic_string< char, std::char_traits< char >, Allocator > &str)
static const int kFastToBufferSize
void AppendPieces(std::string *dest, std::initializer_list< absl::string_view > pieces)
Hex(Int v, PadSpec spec=absl::kNoPad, typename std::enable_if< sizeof(Int)==8 &&!std::is_pointer< Int >::value >::type *=nullptr)
AlphaNum(unsigned long x)