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

Side by Side Diff: pkg/intl/lib/date_format_field.dart

Issue 10829442: Rename i18n to intl (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 // 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 4
5 /** 5 /**
6 * This is a private class internal to DateFormat which is used for formatting 6 * This is a private class internal to DateFormat which is used for formatting
7 * particular fields in a template. e.g. if the format is hh:mm:ss then the 7 * particular fields in a template. e.g. if the format is hh:mm:ss then the
8 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows 8 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows
9 * how to format that portion of a date. 9 * how to format that portion of a date.
10 */ 10 */
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 * We are given [input] as a stream from which we want to read a date. We 196 * We are given [input] as a stream from which we want to read a date. We
197 * can't dynamically build up a date, so we are given a list [dateFields] of 197 * can't dynamically build up a date, so we are given a list [dateFields] of
198 * the constructor arguments and an [position] at which to set it 198 * the constructor arguments and an [position] at which to set it
199 * (year,month,day,hour,minute,second,fractionalSecond) 199 * (year,month,day,hour,minute,second,fractionalSecond)
200 * then after all parsing is done we construct a date from the arguments. 200 * then after all parsing is done we construct a date from the arguments.
201 * This method handles reading any of the numeric fields. The [offset] 201 * This method handles reading any of the numeric fields. The [offset]
202 * argument allows us to compensate for zero-based versus one-based values. 202 * argument allows us to compensate for zero-based versus one-based values.
203 */ 203 */
204 void handleNumericField(_Stream input, Function setter, [int offset = 0]) { 204 void handleNumericField(_Stream input, Function setter, [int offset = 0]) {
205 var result = input.nextInteger(); 205 var result = input.nextInteger();
206 if (result == null) throwFormatException(input);
206 setter(result + offset); 207 setter(result + offset);
207 } 208 }
208 209
209 /** 210 /**
210 * We are given [input] as a stream from which we want to read a date. We 211 * We are given [input] as a stream from which we want to read a date. We
211 * can't dynamically build up a date, so we are given a list [dateFields] of 212 * can't dynamically build up a date, so we are given a list [dateFields] of
212 * the constructor arguments and an [position] at which to set it 213 * the constructor arguments and an [position] at which to set it
213 * (year,month,day,hour,minute,second,fractionalSecond) 214 * (year,month,day,hour,minute,second,fractionalSecond)
214 * then after all parsing is done we construct a date from the arguments. 215 * then after all parsing is done we construct a date from the arguments.
215 * This method handles reading any of string fields from an enumerated set. 216 * This method handles reading any of string fields from an enumerated set.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 var basicString = toBePrinted.toString(); 394 var basicString = toBePrinted.toString();
394 if (basicString.length >= width) return basicString; 395 if (basicString.length >= width) return basicString;
395 var buffer = new StringBuffer(); 396 var buffer = new StringBuffer();
396 for (var i = 0; i < width - basicString.length; i++) { 397 for (var i = 0; i < width - basicString.length; i++) {
397 buffer.add('0'); 398 buffer.add('0');
398 } 399 }
399 buffer.add(basicString); 400 buffer.add(basicString);
400 return buffer.toString(); 401 return buffer.toString();
401 } 402 }
402 } 403 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698