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

Side by Side Diff: sdk/lib/web_sql/dartium/web_sql_dartium.dart

Issue 14036014: Updating DOM code to use list mixins (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « sdk/lib/web_sql/dart2js/web_sql_dart2js.dart ('k') | tools/dom/scripts/htmldartgenerator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * An API for storing data in the browser that can be queried with SQL. 2 * An API for storing data in the browser that can be queried with SQL.
3 * 3 *
4 * **Caution:** this specification is no longer actively maintained by the Web 4 * **Caution:** this specification is no longer actively maintained by the Web
5 * Applications Working Group and may be removed at any time. 5 * Applications Working Group and may be removed at any time.
6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /) 6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /)
7 * for more information. 7 * for more information.
8 * 8 *
9 * The [dart:indexed_db] APIs is a recommended alternatives. 9 * The [dart:indexed_db] APIs is a recommended alternatives.
10 */ 10 */
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 204 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
205 // for details. All rights reserved. Use of this source code is governed by a 205 // for details. All rights reserved. Use of this source code is governed by a
206 // BSD-style license that can be found in the LICENSE file. 206 // BSD-style license that can be found in the LICENSE file.
207 207
208 // WARNING: Do not edit - generated code. 208 // WARNING: Do not edit - generated code.
209 209
210 210
211 @DocsEditable 211 @DocsEditable
212 @DomName('SQLResultSetRowList') 212 @DomName('SQLResultSetRowList')
213 class SqlResultSetRowList extends NativeFieldWrapperClass1 implements List<Map> { 213 class SqlResultSetRowList extends NativeFieldWrapperClass1 with ListMixin<Map>, ImmutableListMixin<Map> implements List<Map> {
214 SqlResultSetRowList.internal(); 214 SqlResultSetRowList.internal();
215 215
216 @DomName('SQLResultSetRowList.length') 216 @DomName('SQLResultSetRowList.length')
217 @DocsEditable 217 @DocsEditable
218 int get length native "SQLResultSetRowList_length_Getter"; 218 int get length native "SQLResultSetRowList_length_Getter";
219 219
220 Map operator[](int index) native "SQLResultSetRowList_item_Callback"; 220 Map operator[](int index) native "SQLResultSetRowList_item_Callback";
221 221
222 void operator[]=(int index, Map value) { 222 void operator[]=(int index, Map value) {
223 throw new UnsupportedError("Cannot assign element of immutable List."); 223 throw new UnsupportedError("Cannot assign element of immutable List.");
224 } 224 }
225 // -- start List<Map> mixins. 225 // -- start List<Map> mixins.
226 // Map is the element type. 226 // Map is the element type.
227 227
228 // From Iterable<Map>:
229 228
230 Iterator<Map> get iterator {
231 // Note: NodeLists are not fixed size. And most probably length shouldn't
232 // be cached in both iterator _and_ forEach method. For now caching it
233 // for consistency.
234 return new FixedSizeListIterator<Map>(this);
235 }
236
237 Map reduce(Map combine(Map value, Map element)) {
238 return IterableMixinWorkaround.reduce(this, combine);
239 }
240
241 dynamic fold(dynamic initialValue,
242 dynamic combine(dynamic previousValue, Map element)) {
243 return IterableMixinWorkaround.fold(this, initialValue, combine);
244 }
245
246 bool contains(Map element) => IterableMixinWorkaround.contains(this, element);
247
248 void forEach(void f(Map element)) => IterableMixinWorkaround.forEach(this, f);
249
250 String join([String separator = ""]) =>
251 IterableMixinWorkaround.joinList(this, separator);
252
253 Iterable map(f(Map element)) =>
254 IterableMixinWorkaround.mapList(this, f);
255
256 Iterable<Map> where(bool f(Map element)) =>
257 IterableMixinWorkaround.where(this, f);
258
259 Iterable expand(Iterable f(Map element)) =>
260 IterableMixinWorkaround.expand(this, f);
261
262 bool every(bool f(Map element)) => IterableMixinWorkaround.every(this, f);
263
264 bool any(bool f(Map element)) => IterableMixinWorkaround.any(this, f);
265
266 List<Map> toList({ bool growable: true }) =>
267 new List<Map>.from(this, growable: growable);
268
269 Set<Map> toSet() => new Set<Map>.from(this);
270
271 bool get isEmpty => this.length == 0;
272
273 Iterable<Map> take(int n) => IterableMixinWorkaround.takeList(this, n);
274
275 Iterable<Map> takeWhile(bool test(Map value)) {
276 return IterableMixinWorkaround.takeWhile(this, test);
277 }
278
279 Iterable<Map> skip(int n) => IterableMixinWorkaround.skipList(this, n);
280
281 Iterable<Map> skipWhile(bool test(Map value)) {
282 return IterableMixinWorkaround.skipWhile(this, test);
283 }
284
285 Map firstWhere(bool test(Map value), { Map orElse() }) {
286 return IterableMixinWorkaround.firstWhere(this, test, orElse);
287 }
288
289 Map lastWhere(bool test(Map value), {Map orElse()}) {
290 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
291 }
292
293 Map singleWhere(bool test(Map value)) {
294 return IterableMixinWorkaround.singleWhere(this, test);
295 }
296
297 Map elementAt(int index) {
298 return this[index];
299 }
300
301 // From Collection<Map>:
302
303 void add(Map value) {
304 throw new UnsupportedError("Cannot add to immutable List.");
305 }
306
307 void addAll(Iterable<Map> iterable) {
308 throw new UnsupportedError("Cannot add to immutable List.");
309 }
310
311 // From List<Map>:
312 void set length(int value) { 229 void set length(int value) {
313 throw new UnsupportedError("Cannot resize immutable List."); 230 throw new UnsupportedError("Cannot resize immutable List.");
314 } 231 }
315 232
316 void clear() {
317 throw new UnsupportedError("Cannot clear immutable List.");
318 }
319
320 Iterable<Map> get reversed {
321 return IterableMixinWorkaround.reversedList(this);
322 }
323
324 void sort([int compare(Map a, Map b)]) {
325 throw new UnsupportedError("Cannot sort immutable List.");
326 }
327
328 int indexOf(Map element, [int start = 0]) =>
329 Lists.indexOf(this, element, start, this.length);
330
331 int lastIndexOf(Map element, [int start]) {
332 if (start == null) start = length - 1;
333 return Lists.lastIndexOf(this, element, start);
334 }
335
336 Map get first {
337 if (this.length > 0) return this[0];
338 throw new StateError("No elements");
339 }
340
341 Map get last {
342 if (this.length > 0) return this[this.length - 1];
343 throw new StateError("No elements");
344 }
345
346 Map get single {
347 if (length == 1) return this[0];
348 if (length == 0) throw new StateError("No elements");
349 throw new StateError("More than one element");
350 }
351
352 void insert(int index, Map element) {
353 throw new UnsupportedError("Cannot add to immutable List.");
354 }
355
356 void insertAll(int index, Iterable<Map> iterable) {
357 throw new UnsupportedError("Cannot add to immutable List.");
358 }
359
360 void setAll(int index, Iterable<Map> iterable) {
361 throw new UnsupportedError("Cannot modify an immutable List.");
362 }
363
364 Map removeAt(int pos) {
365 throw new UnsupportedError("Cannot remove from immutable List.");
366 }
367
368 Map removeLast() {
369 throw new UnsupportedError("Cannot remove from immutable List.");
370 }
371
372 bool remove(Object object) {
373 throw new UnsupportedError("Cannot remove from immutable List.");
374 }
375
376 void removeWhere(bool test(Map element)) {
377 throw new UnsupportedError("Cannot remove from immutable List.");
378 }
379
380 void retainWhere(bool test(Map element)) {
381 throw new UnsupportedError("Cannot remove from immutable List.");
382 }
383
384 void setRange(int start, int end, Iterable<Map> iterable, [int skipCount=0]) {
385 throw new UnsupportedError("Cannot setRange on immutable List.");
386 }
387
388 void removeRange(int start, int end) {
389 throw new UnsupportedError("Cannot removeRange on immutable List.");
390 }
391
392 void replaceRange(int start, int end, Iterable<Map> iterable) {
393 throw new UnsupportedError("Cannot modify an immutable List.");
394 }
395
396 void fillRange(int start, int end, [Map fillValue]) {
397 throw new UnsupportedError("Cannot modify an immutable List.");
398 }
399
400 Iterable<Map> getRange(int start, int end) =>
401 IterableMixinWorkaround.getRangeList(this, start, end);
402
403 List<Map> sublist(int start, [int end]) {
404 if (end == null) end = length;
405 return Lists.getRange(this, start, end, <Map>[]);
406 }
407
408 Map<int, Map> asMap() =>
409 IterableMixinWorkaround.asMapList(this);
410
411 String toString() {
412 StringBuffer buffer = new StringBuffer('[');
413 buffer.writeAll(this, ', ');
414 buffer.write(']');
415 return buffer.toString();
416 }
417
418 // -- end List<Map> mixins. 233 // -- end List<Map> mixins.
419 234
420 @DomName('SQLResultSetRowList.item') 235 @DomName('SQLResultSetRowList.item')
421 @DocsEditable 236 @DocsEditable
422 Map item(int index) native "SQLResultSetRowList_item_Callback"; 237 Map item(int index) native "SQLResultSetRowList_item_Callback";
423 238
424 } 239 }
425 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 240 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
426 // for details. All rights reserved. Use of this source code is governed by a 241 // for details. All rights reserved. Use of this source code is governed by a
427 // BSD-style license that can be found in the LICENSE file. 242 // BSD-style license that can be found in the LICENSE file.
(...skipping 23 matching lines...) Expand all
451 266
452 @DocsEditable 267 @DocsEditable
453 @DomName('SQLTransactionSync') 268 @DomName('SQLTransactionSync')
454 @SupportedBrowser(SupportedBrowser.CHROME) 269 @SupportedBrowser(SupportedBrowser.CHROME)
455 @SupportedBrowser(SupportedBrowser.SAFARI) 270 @SupportedBrowser(SupportedBrowser.SAFARI)
456 @Experimental 271 @Experimental
457 abstract class _SQLTransactionSync extends NativeFieldWrapperClass1 { 272 abstract class _SQLTransactionSync extends NativeFieldWrapperClass1 {
458 _SQLTransactionSync.internal(); 273 _SQLTransactionSync.internal();
459 274
460 } 275 }
OLDNEW
« no previous file with comments | « sdk/lib/web_sql/dart2js/web_sql_dart2js.dart ('k') | tools/dom/scripts/htmldartgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698