| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OSTREAMS_H_ | 5 #ifndef V8_OSTREAMS_H_ |
| 6 #define V8_OSTREAMS_H_ | 6 #define V8_OSTREAMS_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <cstdio> | 9 #include <cstdio> |
| 10 #include <cstring> | 10 #include <cstring> |
| 11 #include <ostream> // NOLINT | 11 #include <ostream> // NOLINT |
| 12 #include <streambuf> | 12 #include <streambuf> |
| 13 | 13 |
| 14 #include "include/v8config.h" | 14 #include "include/v8config.h" |
| 15 #include "src/base/macros.h" | 15 #include "src/base/macros.h" |
| 16 #include "src/globals.h" | |
| 17 | 16 |
| 18 namespace v8 { | 17 namespace v8 { |
| 19 namespace internal { | 18 namespace internal { |
| 20 | 19 |
| 21 | 20 |
| 22 class OFStreamBase : public std::streambuf { | 21 class OFStreamBase : public std::streambuf { |
| 23 public: | 22 public: |
| 24 explicit OFStreamBase(FILE* f); | 23 explicit OFStreamBase(FILE* f); |
| 25 virtual ~OFStreamBase(); | 24 virtual ~OFStreamBase(); |
| 26 | 25 |
| 27 protected: | 26 protected: |
| 28 FILE* const f_; | 27 FILE* const f_; |
| 29 | 28 |
| 30 virtual int sync(); | 29 virtual int sync(); |
| 31 virtual int_type overflow(int_type c); | 30 virtual int_type overflow(int_type c); |
| 32 virtual std::streamsize xsputn(const char* s, std::streamsize n); | 31 virtual std::streamsize xsputn(const char* s, std::streamsize n); |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 | 34 |
| 36 // An output stream writing to a file. | 35 // An output stream writing to a file. |
| 37 class V8_EXPORT_PRIVATE OFStream : public std::ostream { | 36 class OFStream : public std::ostream { |
| 38 public: | 37 public: |
| 39 explicit OFStream(FILE* f); | 38 explicit OFStream(FILE* f); |
| 40 virtual ~OFStream(); | 39 virtual ~OFStream(); |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 OFStreamBase buf_; | 42 OFStreamBase buf_; |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 | 45 |
| 47 // Wrappers to disambiguate uint16_t and uc16. | 46 // Wrappers to disambiguate uint16_t and uc16. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // of printable ASCII range. | 89 // of printable ASCII range. |
| 91 std::ostream& operator<<(std::ostream& os, const AsUC32& c); | 90 std::ostream& operator<<(std::ostream& os, const AsUC32& c); |
| 92 | 91 |
| 93 // Writes the given number to the output in hexadecimal notation. | 92 // Writes the given number to the output in hexadecimal notation. |
| 94 std::ostream& operator<<(std::ostream& os, const AsHex& v); | 93 std::ostream& operator<<(std::ostream& os, const AsHex& v); |
| 95 | 94 |
| 96 } // namespace internal | 95 } // namespace internal |
| 97 } // namespace v8 | 96 } // namespace v8 |
| 98 | 97 |
| 99 #endif // V8_OSTREAMS_H_ | 98 #endif // V8_OSTREAMS_H_ |
| OLD | NEW |