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> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 }; | 43 }; |
44 | 44 |
45 | 45 |
46 // Wrappers to disambiguate uint16_t and uc16. | 46 // Wrappers to disambiguate uint16_t and uc16. |
47 struct AsUC16 { | 47 struct AsUC16 { |
48 explicit AsUC16(uint16_t v) : value(v) {} | 48 explicit AsUC16(uint16_t v) : value(v) {} |
49 uint16_t value; | 49 uint16_t value; |
50 }; | 50 }; |
51 | 51 |
52 | 52 |
| 53 struct AsUC32 { |
| 54 explicit AsUC32(int32_t v) : value(v) {} |
| 55 int32_t value; |
| 56 }; |
| 57 |
| 58 |
53 struct AsReversiblyEscapedUC16 { | 59 struct AsReversiblyEscapedUC16 { |
54 explicit AsReversiblyEscapedUC16(uint16_t v) : value(v) {} | 60 explicit AsReversiblyEscapedUC16(uint16_t v) : value(v) {} |
55 uint16_t value; | 61 uint16_t value; |
56 }; | 62 }; |
57 | 63 |
58 struct AsEscapedUC16ForJSON { | 64 struct AsEscapedUC16ForJSON { |
59 explicit AsEscapedUC16ForJSON(uint16_t v) : value(v) {} | 65 explicit AsEscapedUC16ForJSON(uint16_t v) : value(v) {} |
60 uint16_t value; | 66 uint16_t value; |
61 }; | 67 }; |
62 | 68 |
63 | 69 |
64 // Writes the given character to the output escaping everything outside of | 70 // Writes the given character to the output escaping everything outside of |
65 // printable/space ASCII range. Additionally escapes '\' making escaping | 71 // printable/space ASCII range. Additionally escapes '\' making escaping |
66 // reversible. | 72 // reversible. |
67 std::ostream& operator<<(std::ostream& os, const AsReversiblyEscapedUC16& c); | 73 std::ostream& operator<<(std::ostream& os, const AsReversiblyEscapedUC16& c); |
68 | 74 |
69 // Same as AsReversiblyEscapedUC16 with additional escaping of \n, \r, " and '. | 75 // Same as AsReversiblyEscapedUC16 with additional escaping of \n, \r, " and '. |
70 std::ostream& operator<<(std::ostream& os, const AsEscapedUC16ForJSON& c); | 76 std::ostream& operator<<(std::ostream& os, const AsEscapedUC16ForJSON& c); |
71 | 77 |
72 // Writes the given character to the output escaping everything outside | 78 // Writes the given character to the output escaping everything outside |
73 // of printable ASCII range. | 79 // of printable ASCII range. |
74 std::ostream& operator<<(std::ostream& os, const AsUC16& c); | 80 std::ostream& operator<<(std::ostream& os, const AsUC16& c); |
75 | 81 |
| 82 // Writes the given character to the output escaping everything outside |
| 83 // of printable ASCII range. |
| 84 std::ostream& operator<<(std::ostream& os, const AsUC32& c); |
| 85 |
76 } // namespace internal | 86 } // namespace internal |
77 } // namespace v8 | 87 } // namespace v8 |
78 | 88 |
79 #endif // V8_OSTREAMS_H_ | 89 #endif // V8_OSTREAMS_H_ |
OLD | NEW |