14 #include "include/v8config.h" 15 #include "src/base/macros.h" 16 #include "src/globals.h" 30 int_type overflow(int_type c)
override;
31 std::streamsize xsputn(
const char* s, std::streamsize n)
override;
35 class V8_EXPORT_PRIVATE
OFStream :
public std::ostream {
44 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) 45 class V8_EXPORT_PRIVATE AndroidLogStream :
public std::streambuf {
47 virtual ~AndroidLogStream();
50 std::streamsize xsputn(
const char* s, std::streamsize n)
override;
53 std::string line_buffer_;
56 class StdoutStream :
public std::ostream {
58 StdoutStream() :
std::ostream(&stream_) {}
61 AndroidLogStream stream_;
72 explicit AsUC16(uint16_t v) : value(v) {}
78 explicit AsUC32(int32_t v) : value(v) {}
97 explicit AsHex(uint64_t v, uint8_t min_width = 1,
bool with_prefix =
false)
98 : value(v), min_width(min_width), with_prefix(with_prefix) {}
109 enum ByteOrder { kLittleEndian, kBigEndian };
110 explicit AsHexBytes(uint64_t v, uint8_t min_bytes = 1,
111 ByteOrder byte_order = kLittleEndian)
112 : value(v), min_bytes(min_bytes), byte_order(byte_order) {}
115 ByteOrder byte_order;
118 template <
typename T>
128 template <
typename T,
typename Iterator =
typename std::common_type<
129 decltype(std::begin(std::declval<const T&>())),
130 decltype(std::end(std::declval<const T&>()))>
::type>
132 return {std::begin(collection), std::end(collection)};
138 std::ostream& operator<<(std::ostream& os,
const AsReversiblyEscapedUC16& c);
141 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
142 const AsEscapedUC16ForJSON& c);
146 std::ostream& operator<<(std::ostream& os,
const AsUC16& c);
150 std::ostream& operator<<(std::ostream& os,
const AsUC32& c);
152 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const AsHex& v);
153 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
154 const AsHexBytes& v);
156 template <
typename T>
157 std::ostream& operator<<(std::ostream& os, const PrintIteratorRange<T>& range) {
158 const char* comma =
"";
160 for (T it = range.start; it != range.end; ++it, comma =
", ") {
170 #endif // V8_OSTREAMS_H_