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

Side by Side Diff: src/string-stream.h

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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/simulator-arm.cc ('k') | src/string-stream.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 char* grow(unsigned* bytes); 66 char* grow(unsigned* bytes);
67 private: 67 private:
68 unsigned size_; 68 unsigned size_;
69 char* space_; 69 char* space_;
70 }; 70 };
71 71
72 72
73 class FmtElm { 73 class FmtElm {
74 public: 74 public:
75 FmtElm(int value) : type_(INT) { data_.u_int_ = value; } // NOLINT 75 FmtElm(int value) : type_(INT) { data_.u_int_ = value; } // NOLINT
76 explicit FmtElm(double value) : type_(DOUBLE) { data_.u_double_ = value; } // NOLINT
76 FmtElm(const char* value) : type_(C_STR) { data_.u_c_str_ = value; } // NOLIN T 77 FmtElm(const char* value) : type_(C_STR) { data_.u_c_str_ = value; } // NOLIN T
77 FmtElm(const Vector<const uc16>& value) : type_(LC_STR) { data_.u_lc_str_ = &v alue; } // NOLINT 78 FmtElm(const Vector<const uc16>& value) : type_(LC_STR) { data_.u_lc_str_ = &v alue; } // NOLINT
78 FmtElm(Object* value) : type_(OBJ) { data_.u_obj_ = value; } // NOLINT 79 FmtElm(Object* value) : type_(OBJ) { data_.u_obj_ = value; } // NOLINT
79 FmtElm(Handle<Object> value) : type_(HANDLE) { data_.u_handle_ = value.locatio n(); } // NOLINT 80 FmtElm(Handle<Object> value) : type_(HANDLE) { data_.u_handle_ = value.locatio n(); } // NOLINT
80 FmtElm(void* value) : type_(INT) { data_.u_int_ = reinterpret_cast<int>(value) ; } // NOLINT 81 FmtElm(void* value) : type_(INT) { data_.u_int_ = reinterpret_cast<int>(value) ; } // NOLINT
81 private: 82 private:
82 friend class StringStream; 83 friend class StringStream;
83 enum Type { INT, C_STR, LC_STR, OBJ, HANDLE }; 84 enum Type { INT, DOUBLE, C_STR, LC_STR, OBJ, HANDLE };
84 Type type_; 85 Type type_;
85 union { 86 union {
86 int u_int_; 87 int u_int_;
88 double u_double_;
87 const char* u_c_str_; 89 const char* u_c_str_;
88 const Vector<const uc16>* u_lc_str_; 90 const Vector<const uc16>* u_lc_str_;
89 Object* u_obj_; 91 Object* u_obj_;
90 Object** u_handle_; 92 Object** u_handle_;
91 } data_; 93 } data_;
92 }; 94 };
93 95
94 96
95 class StringStream { 97 class StringStream {
96 public: 98 public:
(...skipping 15 matching lines...) Expand all
112 void Add(const char* format); 114 void Add(const char* format);
113 void Add(Vector<const char> format); 115 void Add(Vector<const char> format);
114 void Add(const char* format, FmtElm arg0); 116 void Add(const char* format, FmtElm arg0);
115 void Add(const char* format, FmtElm arg0, FmtElm arg1); 117 void Add(const char* format, FmtElm arg0, FmtElm arg1);
116 void Add(const char* format, FmtElm arg0, FmtElm arg1, FmtElm arg2); 118 void Add(const char* format, FmtElm arg0, FmtElm arg1, FmtElm arg2);
117 119
118 // Getting the message out. 120 // Getting the message out.
119 void OutputToStdOut(); 121 void OutputToStdOut();
120 void Log(); 122 void Log();
121 Handle<String> ToString(); 123 Handle<String> ToString();
122 SmartPointer<char> ToCString(); 124 SmartPointer<const char> ToCString();
123 125
124 // Object printing support. 126 // Object printing support.
125 void PrintName(Object* o); 127 void PrintName(Object* o);
126 void PrintFixedArray(FixedArray* array, unsigned int limit); 128 void PrintFixedArray(FixedArray* array, unsigned int limit);
127 void PrintByteArray(ByteArray* ba); 129 void PrintByteArray(ByteArray* ba);
128 void PrintUsingMap(JSObject* js_object); 130 void PrintUsingMap(JSObject* js_object);
129 void PrintPrototype(JSFunction* fun, Object* receiver); 131 void PrintPrototype(JSFunction* fun, Object* receiver);
130 void PrintSecurityTokenIfChanged(Object* function); 132 void PrintSecurityTokenIfChanged(Object* function);
131 // NOTE: Returns the code in the output parameter. 133 // NOTE: Returns the code in the output parameter.
132 void PrintFunction(Object* function, Object* receiver, Code** code); 134 void PrintFunction(Object* function, Object* receiver, Code** code);
(...skipping 25 matching lines...) Expand all
158 int space() const { return capacity_ - length_; } 160 int space() const { return capacity_ - length_; }
159 char* cursor() const { return buffer_ + length_; } 161 char* cursor() const { return buffer_ + length_; }
160 162
161 DISALLOW_IMPLICIT_CONSTRUCTORS(StringStream); 163 DISALLOW_IMPLICIT_CONSTRUCTORS(StringStream);
162 }; 164 };
163 165
164 166
165 } } // namespace v8::internal 167 } } // namespace v8::internal
166 168
167 #endif // V8_STRING_STREAM_H_ 169 #endif // V8_STRING_STREAM_H_
OLDNEW
« no previous file with comments | « src/simulator-arm.cc ('k') | src/string-stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698