Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Side by Side Diff: src/ostreams.h

Issue 526223002: Use Chrome compatible naming for compiler specifics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: mips Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 ~OStringStream() { deallocate(data_, capacity_); } 77 ~OStringStream() { deallocate(data_, capacity_); }
78 78
79 size_t size() const { return size_; } 79 size_t size() const { return size_; }
80 size_t capacity() const { return capacity_; } 80 size_t capacity() const { return capacity_; }
81 const char* data() const { return data_; } 81 const char* data() const { return data_; }
82 82
83 // Internally, our character data is always 0-terminated. 83 // Internally, our character data is always 0-terminated.
84 const char* c_str() const { return data(); } 84 const char* c_str() const { return data(); }
85 85
86 virtual OStringStream& write(const char* s, size_t n) V8_OVERRIDE; 86 virtual OStringStream& write(const char* s, size_t n) OVERRIDE;
87 virtual OStringStream& flush() V8_OVERRIDE; 87 virtual OStringStream& flush() OVERRIDE;
88 88
89 private: 89 private:
90 // Primitive allocator interface, can be extracted if needed. 90 // Primitive allocator interface, can be extracted if needed.
91 static char* allocate (size_t n) { return new char[n]; } 91 static char* allocate (size_t n) { return new char[n]; }
92 static void deallocate (char* s, size_t n) { delete[] s; } 92 static void deallocate (char* s, size_t n) { delete[] s; }
93 93
94 void reserve(size_t requested_capacity); 94 void reserve(size_t requested_capacity);
95 95
96 size_t size_; 96 size_t size_;
97 size_t capacity_; 97 size_t capacity_;
98 char* data_; 98 char* data_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(OStringStream); 100 DISALLOW_COPY_AND_ASSIGN(OStringStream);
101 }; 101 };
102 102
103 103
104 // An output stream writing to a file. 104 // An output stream writing to a file.
105 class OFStream: public OStream { 105 class OFStream: public OStream {
106 public: 106 public:
107 explicit OFStream(FILE* f) : f_(f) { } 107 explicit OFStream(FILE* f) : f_(f) { }
108 virtual ~OFStream() { } 108 virtual ~OFStream() { }
109 109
110 virtual OFStream& write(const char* s, size_t n) V8_OVERRIDE; 110 virtual OFStream& write(const char* s, size_t n) OVERRIDE;
111 virtual OFStream& flush() V8_OVERRIDE; 111 virtual OFStream& flush() OVERRIDE;
112 112
113 private: 113 private:
114 FILE* const f_; 114 FILE* const f_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(OFStream); 116 DISALLOW_COPY_AND_ASSIGN(OFStream);
117 }; 117 };
118 118
119 119
120 // Wrappers to disambiguate uint16_t and uc16. 120 // Wrappers to disambiguate uint16_t and uc16.
121 struct AsUC16 { 121 struct AsUC16 {
(...skipping 12 matching lines...) Expand all
134 // of printable ASCII range. Additionally escapes '\' making escaping 134 // of printable ASCII range. Additionally escapes '\' making escaping
135 // reversible. 135 // reversible.
136 OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c); 136 OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c);
137 137
138 // Writes the given character to the output escaping everything outside 138 // Writes the given character to the output escaping everything outside
139 // of printable ASCII range. 139 // of printable ASCII range.
140 OStream& operator<<(OStream& os, const AsUC16& c); 140 OStream& operator<<(OStream& os, const AsUC16& c);
141 } } // namespace v8::internal 141 } } // namespace v8::internal
142 142
143 #endif // V8_OSTREAMS_H_ 143 #endif // V8_OSTREAMS_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698