Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 /** | |
| 6 * A library for general helper code associated with the intl library | |
| 7 * rather than confined to specific parts of it. | |
| 8 */ | |
| 9 | |
| 10 #library("intl_helpers"); | |
| 11 | |
| 12 /** | |
| 13 * This is used as a marker for a locale data map that hasn't been initialized, | |
| 14 * and will throw an exception on any usage. | |
| 15 */ | |
| 16 class UninitializedLocaleData { | |
| 17 final String message; | |
| 18 const UninitializedLocaleData(this.message); | |
| 19 | |
| 20 operator [](String key) { | |
| 21 _throwException(); | |
| 22 } | |
| 23 List getKeys() => _throwException(); | |
| 24 bool containsKey(String key) => _throwException(); | |
| 25 | |
| 26 _throwException() { | |
| 27 throw new LocaleDataException("Locale data has not been initialized" | |
| 28 ", call $message."); | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 class LocaleDataException implements Exception { | |
| 33 final String message; | |
| 34 LocaleDataException(this.message); | |
| 35 toString() => "LocaleDataException: $message"; | |
| 36 } | |
| 37 | |
| 38 /// An abstract superclass for data readers to keep the type system happy. | |
|
Emily Fortuna
2012/09/04 20:14:42
Style nit: I'd say have consistent commenting styl
Alan Knight
2012/09/04 23:39:03
Done.
| |
| 39 abstract class LocaleDataReader { | |
| 40 abstract Future read(String locale); | |
| 41 } | |
| OLD | NEW |