Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 #library("date_symbols"); | 4 #library("date_symbols"); |
| 5 | 5 |
|
Emily Fortuna
2012/09/04 20:14:42
warning warning extra newline insertion detected
Alan Knight
2012/09/04 23:39:03
Done.
| |
| 6 | |
| 6 /** | 7 /** |
| 7 * This holds onto information about how a particular locale formats dates. It | 8 * This holds onto information about how a particular locale formats dates. It |
| 8 * contains mostly strings, e.g. what the names of months or weekdays are, | 9 * contains mostly strings, e.g. what the names of months or weekdays are, |
| 9 * but also indicates things like the first day of the week. We expect the data | 10 * but also indicates things like the first day of the week. We expect the data |
| 10 * for instances of these to be generated out of ICU or a similar reference | 11 * for instances of these to be generated out of ICU or a similar reference |
| 11 * source. This is used in conjunction with the date_time_patterns, which | 12 * source. This is used in conjunction with the date_time_patterns, which |
| 12 * defines for a particular locale the different named formats that will | 13 * defines for a particular locale the different named formats that will |
| 13 * make use of this data. | 14 * make use of this data. |
| 14 */ | 15 */ |
| 15 class DateSymbols { | 16 class DateSymbols { |
| 16 final String NAME; | 17 String NAME; |
| 17 final List<String> ERAS, ERANAMES, NARROWMONTHS, STANDALONENARROWMONTHS, | 18 List<String> ERAS, ERANAMES, NARROWMONTHS, STANDALONENARROWMONTHS, |
| 18 MONTHS, STANDALONEMONTHS, SHORTMONTHS, STANDALONESHORTMONTHS, WEEKDAYS, | 19 MONTHS, STANDALONEMONTHS, SHORTMONTHS, STANDALONESHORTMONTHS, WEEKDAYS, |
| 19 STANDALONEWEEKDAYS, SHORTWEEKDAYS, STANDALONESHORTWEEKDAYS, | 20 STANDALONEWEEKDAYS, SHORTWEEKDAYS, STANDALONESHORTWEEKDAYS, |
| 20 NARROWWEEKDAYS, STANDALONENARROWWEEKDAYS, SHORTQUARTERS, | 21 NARROWWEEKDAYS, STANDALONENARROWWEEKDAYS, SHORTQUARTERS, |
| 21 QUARTERS, AMPMS, DATEFORMATS, TIMEFORMATS; | 22 QUARTERS, AMPMS, DATEFORMATS, TIMEFORMATS; |
| 22 final Map<String, String> AVAILABLEFORMATS; | 23 Map<String, String> AVAILABLEFORMATS; |
| 23 final int FIRSTDAYOFWEEK; | 24 int FIRSTDAYOFWEEK; |
| 24 final List<int> WEEKENDRANGE; | 25 List<int> WEEKENDRANGE; |
| 25 final int FIRSTWEEKCUTOFFDAY; | 26 int FIRSTWEEKCUTOFFDAY; |
| 26 | 27 |
| 27 const DateSymbols([this.NAME, | 28 DateSymbols([this.NAME, |
| 28 this.ERAS, | 29 this.ERAS, |
| 29 this.ERANAMES, | 30 this.ERANAMES, |
| 30 this.NARROWMONTHS, | 31 this.NARROWMONTHS, |
| 31 this.STANDALONENARROWMONTHS, | 32 this.STANDALONENARROWMONTHS, |
| 32 this.MONTHS, | 33 this.MONTHS, |
| 33 this.STANDALONEMONTHS, | 34 this.STANDALONEMONTHS, |
| 34 this.SHORTMONTHS, | 35 this.SHORTMONTHS, |
| 35 this.STANDALONESHORTMONTHS, | 36 this.STANDALONESHORTMONTHS, |
| 36 this.WEEKDAYS, | 37 this.WEEKDAYS, |
| 37 this.STANDALONEWEEKDAYS, | 38 this.STANDALONEWEEKDAYS, |
| 38 this.SHORTWEEKDAYS, | 39 this.SHORTWEEKDAYS, |
| 39 this.STANDALONESHORTWEEKDAYS, | 40 this.STANDALONESHORTWEEKDAYS, |
| 40 this.NARROWWEEKDAYS, | 41 this.NARROWWEEKDAYS, |
| 41 this.STANDALONENARROWWEEKDAYS, | 42 this.STANDALONENARROWWEEKDAYS, |
| 42 this.SHORTQUARTERS, | 43 this.SHORTQUARTERS, |
| 43 this.QUARTERS, | 44 this.QUARTERS, |
| 44 this.AMPMS, | 45 this.AMPMS, |
| 45 this.DATEFORMATS, | 46 this.DATEFORMATS, |
| 46 this.TIMEFORMATS, | 47 this.TIMEFORMATS, |
| 47 this.AVAILABLEFORMATS, | 48 this.AVAILABLEFORMATS, |
| 48 this.FIRSTDAYOFWEEK, | 49 this.FIRSTDAYOFWEEK, |
| 49 this.WEEKENDRANGE, | 50 this.WEEKENDRANGE, |
| 50 this.FIRSTWEEKCUTOFFDAY]); | 51 this.FIRSTWEEKCUTOFFDAY]); |
| 51 | 52 |
| 53 DateSymbols.deserializeFromMap(Map map) { | |
|
Emily Fortuna
2012/09/04 20:14:42
Add a TODO saying replace with the proper Dart ser
Alan Knight
2012/09/04 23:39:03
Done.
| |
| 54 NAME = map["NAME"]; | |
| 55 ERAS = map["ERAS"]; | |
| 56 ERANAMES = map["ERANAMES"]; | |
| 57 NARROWMONTHS = map["NARROWMONTHS"]; | |
| 58 STANDALONENARROWMONTHS = map["STANDALONENARROWMONTHS"]; | |
| 59 MONTHS = map["MONTHS"]; | |
| 60 STANDALONEMONTHS = map["STANDALONEMONTHS"]; | |
| 61 SHORTMONTHS = map["SHORTMONTHS"]; | |
| 62 STANDALONESHORTMONTHS = map["STANDALONESHORTMONTHS"]; | |
| 63 WEEKDAYS = map["WEEKDAYS"]; | |
| 64 STANDALONEWEEKDAYS = map["STANDALONEWEEKDAYS"]; | |
| 65 SHORTWEEKDAYS = map["SHORTWEEKDAYS"]; | |
| 66 STANDALONESHORTWEEKDAYS = map["STANDALONESHORTWEEKDAYS"]; | |
| 67 NARROWWEEKDAYS = map["NARROWWEEKDAYS"]; | |
| 68 STANDALONENARROWWEEKDAYS = map["STANDALONENARROWWEEKDAYS"]; | |
| 69 SHORTQUARTERS = map["SHORTQUARTERS"]; | |
| 70 QUARTERS = map["QUARTERS"]; | |
| 71 AMPMS = map["AMPMS"]; | |
| 72 DATEFORMATS = map["DATEFORMATS"]; | |
| 73 TIMEFORMATS = map["TIMEFORMATS"]; | |
| 74 AVAILABLEFORMATS = map["AVAILABLEFORMATS"]; | |
| 75 FIRSTDAYOFWEEK = map["FIRSTDAYOFWEEK"]; | |
| 76 WEEKENDRANGE = map["WEEKENDRANGE"]; | |
| 77 FIRSTWEEKCUTOFFDAY = map["FIRSTWEEKCUTOFFDAY"]; | |
| 78 } | |
| 79 | |
| 80 Map serializeToMap() { | |
| 81 var map = new Map(); | |
| 82 map["NAME"] = NAME; | |
| 83 map["ERAS"] = ERAS; | |
| 84 map["ERANAMES"] = ERANAMES; | |
| 85 map["NARROWMONTHS"] = NARROWMONTHS; | |
| 86 map["STANDALONENARROWMONTHS"] = STANDALONENARROWMONTHS; | |
| 87 map["MONTHS"] = MONTHS; | |
| 88 map["STANDALONEMONTHS"] = STANDALONEMONTHS; | |
| 89 map["SHORTMONTHS"] = SHORTMONTHS; | |
| 90 map["STANDALONESHORTMONTHS"] = STANDALONESHORTMONTHS; | |
| 91 map["WEEKDAYS"] = WEEKDAYS; | |
| 92 map["STANDALONEWEEKDAYS"] = STANDALONEWEEKDAYS; | |
| 93 map["SHORTWEEKDAYS"] = SHORTWEEKDAYS; | |
| 94 map["STANDALONESHORTWEEKDAYS"] = STANDALONESHORTWEEKDAYS; | |
| 95 map["NARROWWEEKDAYS"] = NARROWWEEKDAYS; | |
| 96 map["STANDALONENARROWWEEKDAYS"] = STANDALONENARROWWEEKDAYS; | |
| 97 map["SHORTQUARTERS"] = SHORTQUARTERS; | |
| 98 map["QUARTERS"] = QUARTERS; | |
| 99 map["AMPMS"] = AMPMS; | |
| 100 map["DATEFORMATS"] = DATEFORMATS; | |
| 101 map["TIMEFORMATS"] = TIMEFORMATS; | |
| 102 map["AVAILABLEFORMATS"] = AVAILABLEFORMATS; | |
| 103 map["FIRSTDAYOFWEEK"] = FIRSTDAYOFWEEK; | |
| 104 map["WEEKENDRANGE"] = WEEKENDRANGE; | |
| 105 map["FIRSTWEEKCUTOFFDAY"] = FIRSTWEEKCUTOFFDAY; | |
| 106 return map; | |
| 107 } | |
| 108 | |
| 52 toString() => NAME; | 109 toString() => NAME; |
| 53 } | 110 } |
| OLD | NEW |