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

Side by Side Diff: runtime/vm/json_stream.cc

Issue 23903034: - Disallow copy constructors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « runtime/vm/json_stream.h ('k') | runtime/vm/json_test.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/json_stream.h" 7 #include "vm/json_stream.h"
8 8
9 9
10 namespace dart { 10 namespace dart {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 const char* buffer = buffer_.buf(); 198 const char* buffer = buffer_.buf();
199 intptr_t length = buffer_.length(); 199 intptr_t length = buffer_.length();
200 if (length == 0) { 200 if (length == 0) {
201 return false; 201 return false;
202 } 202 }
203 char ch = buffer[length-1]; 203 char ch = buffer[length-1];
204 return (ch != '[') && (ch != '{') && (ch != ':') && (ch != ','); 204 return (ch != '[') && (ch != '{') && (ch != ':') && (ch != ',');
205 } 205 }
206 206
207 207
208 JSONObject::JSONObject(const JSONArray& arr) : stream_(arr.stream_) { 208 JSONObject::JSONObject(const JSONArray* arr) : stream_(arr->stream_) {
209 stream_->OpenObject(); 209 stream_->OpenObject();
210 } 210 }
211 211
212 212
213 void JSONObject::AddPropertyF(const char* name, 213 void JSONObject::AddPropertyF(const char* name,
214 const char* format, ...) const { 214 const char* format, ...) const {
215 stream_->PrintPropertyName(name); 215 stream_->PrintPropertyName(name);
216 va_list args; 216 va_list args;
217 va_start(args, format); 217 va_start(args, format);
218 intptr_t len = OS::VSNPrint(NULL, 0, format, args); 218 intptr_t len = OS::VSNPrint(NULL, 0, format, args);
(...skipping 22 matching lines...) Expand all
241 va_end(args); 241 va_end(args);
242 ASSERT(len == len2); 242 ASSERT(len == len2);
243 stream_->buffer_.AddChar('"'); 243 stream_->buffer_.AddChar('"');
244 stream_->buffer_.AddEscapedString(p); 244 stream_->buffer_.AddEscapedString(p);
245 stream_->buffer_.AddChar('"'); 245 stream_->buffer_.AddChar('"');
246 free(p); 246 free(p);
247 } 247 }
248 248
249 } // namespace dart 249 } // namespace dart
250 250
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/json_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698