File indexing completed on 2025-01-18 09:27:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef ABSL_STRINGS_INTERNAL_STRINGIFY_SINK_H_
0016 #define ABSL_STRINGS_INTERNAL_STRINGIFY_SINK_H_
0017
0018 #include <string>
0019 #include <type_traits>
0020 #include <utility>
0021
0022 #include "absl/strings/string_view.h"
0023
0024 namespace absl {
0025 ABSL_NAMESPACE_BEGIN
0026
0027 namespace strings_internal {
0028 class StringifySink {
0029 public:
0030 void Append(size_t count, char ch);
0031
0032 void Append(string_view v);
0033
0034
0035 friend void AbslFormatFlush(StringifySink* sink, absl::string_view v) {
0036 sink->Append(v);
0037 }
0038
0039 private:
0040 template <typename T>
0041 friend string_view ExtractStringification(StringifySink& sink, const T& v);
0042
0043 std::string buffer_;
0044 };
0045
0046 template <typename T>
0047 string_view ExtractStringification(StringifySink& sink, const T& v) {
0048 AbslStringify(sink, v);
0049 return sink.buffer_;
0050 }
0051
0052 }
0053
0054 ABSL_NAMESPACE_END
0055 }
0056
0057 #endif