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

Side by Side Diff: lib/html/frog/html_frog.dart

Issue 9956076: Make Storage implement Map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
OLDNEW
1 #library('html'); 1 #library('html');
2 2
3 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 6
7 // DO NOT EDIT 7 // DO NOT EDIT
8 // Auto-generated dart:html library. 8 // Auto-generated dart:html library.
9 9
10 10
(...skipping 13621 matching lines...) Expand 10 before | Expand all | Expand 10 after
13632 13632
13633 _SpeechRecognitionAlternativeImpl item(int index) native; 13633 _SpeechRecognitionAlternativeImpl item(int index) native;
13634 } 13634 }
13635 13635
13636 class _SpeechRecognitionResultListImpl implements SpeechRecognitionResultList na tive "*SpeechRecognitionResultList" { 13636 class _SpeechRecognitionResultListImpl implements SpeechRecognitionResultList na tive "*SpeechRecognitionResultList" {
13637 13637
13638 final int length; 13638 final int length;
13639 13639
13640 _SpeechRecognitionResultImpl item(int index) native; 13640 _SpeechRecognitionResultImpl item(int index) native;
13641 } 13641 }
13642 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
13643 // for details. All rights reserved. Use of this source code is governed by a
13644 // BSD-style license that can be found in the LICENSE file.
13642 13645
13643 class _StorageImpl implements Storage native "*Storage" { 13646 class _StorageImpl implements Storage native "*Storage" {
13644 13647
13648 // TODO(nweiz): update this when maps support lazy iteration
13649 bool containsValue(String value) => getValues().some((e) => e == value);
13650
13651 bool containsKey(String key) => getItem(key) != null;
13652
13653 String operator [](String key) => getItem(key);
13654
13655 void operator []=(String key, String value) => setItem(key, value);
13656
13657 String putIfAbsent(String key, String ifAbsent()) {
13658 if (!containsKey(key)) this[key] = ifAbsent();
13659 return this[key];
13660 }
13661
13662 String remove(String key) {
13663 final value = this[key];
13664 removeItem(key);
13665 return value;
13666 }
13667
13668 void forEach(void f(String key, String value)) {
13669 for (var i = 0; true; i++) {
13670 final key = key(i);
13671 if (key == null) return;
13672
13673 f(key, this[key]);
13674 }
13675 }
13676
13677 Collection<String> getKeys() {
13678 final keys = [];
13679 forEach((k, v) => keys.add(k));
13680 return keys;
13681 }
13682
13683 Collection<String> getValues() {
13684 final values = [];
13685 forEach((k, v) => values.add(v));
13686 return values;
13687 }
13688
13689 bool isEmpty() => key(0) == null;
13690
13645 final int length; 13691 final int length;
13646 13692
13647 void clear() native; 13693 void clear() native;
13648 13694
13649 String getItem(String key) native; 13695 String getItem(String key) native;
13650 13696
13651 String key(int index) native; 13697 String key(int index) native;
13652 13698
13653 void removeItem(String key) native; 13699 void removeItem(String key) native;
13654 13700
13655 void setItem(String key, String data) native; 13701 void setItem(String key, String data) native;
13702
13656 } 13703 }
13657 13704
13658 class _StorageEventImpl extends _EventImpl implements StorageEvent native "*Stor ageEvent" { 13705 class _StorageEventImpl extends _EventImpl implements StorageEvent native "*Stor ageEvent" {
13659 13706
13660 final String key; 13707 final String key;
13661 13708
13662 final String newValue; 13709 final String newValue;
13663 13710
13664 final String oldValue; 13711 final String oldValue;
13665 13712
(...skipping 14433 matching lines...) Expand 10 before | Expand all | Expand 10 after
28099 interface SpeechRecognitionResultList { 28146 interface SpeechRecognitionResultList {
28100 28147
28101 final int length; 28148 final int length;
28102 28149
28103 SpeechRecognitionResult item(int index); 28150 SpeechRecognitionResult item(int index);
28104 } 28151 }
28105 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 28152 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
28106 // for details. All rights reserved. Use of this source code is governed by a 28153 // for details. All rights reserved. Use of this source code is governed by a
28107 // BSD-style license that can be found in the LICENSE file. 28154 // BSD-style license that can be found in the LICENSE file.
28108 28155
28109 // WARNING: Do not edit - generated code. 28156 interface Storage extends Map<String, String> {
28110 28157 /*
28111 interface Storage {
28112 28158
28113 final int length; 28159 final int length;
Jacob 2012/04/02 21:06:41 mark these 3 fields as private in systemhtml.py an
nweiz 2012/04/02 22:32:14 Done.
28114 28160
28115 void clear(); 28161 void clear();
28116 28162
28117 String getItem(String key); 28163 String getItem(String key);
28118 28164
28119 String key(int index); 28165 String key(int index);
28120 28166
28121 void removeItem(String key); 28167 void removeItem(String key);
28122 28168
28123 void setItem(String key, String data); 28169 void setItem(String key, String data);
28170
28171 */
28124 } 28172 }
28125 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 28173 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
28126 // for details. All rights reserved. Use of this source code is governed by a 28174 // for details. All rights reserved. Use of this source code is governed by a
28127 // BSD-style license that can be found in the LICENSE file. 28175 // BSD-style license that can be found in the LICENSE file.
28128 28176
28129 // WARNING: Do not edit - generated code. 28177 // WARNING: Do not edit - generated code.
28130 28178
28131 interface StorageEvent extends Event { 28179 interface StorageEvent extends Event {
28132 28180
28133 final String key; 28181 final String key;
(...skipping 3954 matching lines...) Expand 10 before | Expand all | Expand 10 after
32088 if (length < 0) throw new IllegalArgumentException('length'); 32136 if (length < 0) throw new IllegalArgumentException('length');
32089 if (start < 0) throw new IndexOutOfRangeException(start); 32137 if (start < 0) throw new IndexOutOfRangeException(start);
32090 int end = start + length; 32138 int end = start + length;
32091 if (end > a.length) throw new IndexOutOfRangeException(end); 32139 if (end > a.length) throw new IndexOutOfRangeException(end);
32092 for (int i = start; i < end; i++) { 32140 for (int i = start; i < end; i++) {
32093 accumulator.add(a[i]); 32141 accumulator.add(a[i]);
32094 } 32142 }
32095 return accumulator; 32143 return accumulator;
32096 } 32144 }
32097 } 32145 }
OLDNEW
« lib/dom/templates/html/impl/impl_Storage.darttemplate ('K') | « lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698