OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011,2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011,2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 WTF_MAKE_NONCOPYABLE(DateTimeStringBuilder); | 42 WTF_MAKE_NONCOPYABLE(DateTimeStringBuilder); |
43 public: | 43 public: |
44 // The argument objects must be alive until this object dies. | 44 // The argument objects must be alive until this object dies. |
45 DateTimeStringBuilder(Locale&, const DateComponents&); | 45 DateTimeStringBuilder(Locale&, const DateComponents&); |
46 | 46 |
47 bool build(const String&); | 47 bool build(const String&); |
48 String toString(); | 48 String toString(); |
49 | 49 |
50 private: | 50 private: |
51 // DateTimeFormat::TokenHandler functions. | 51 // DateTimeFormat::TokenHandler functions. |
52 virtual void visitField(DateTimeFormat::FieldType, int) override final; | 52 void visitField(DateTimeFormat::FieldType, int) final; |
53 virtual void visitLiteral(const String&) override final; | 53 void visitLiteral(const String&) final; |
54 | 54 |
55 String zeroPadString(const String&, size_t width); | 55 String zeroPadString(const String&, size_t width); |
56 void appendNumber(int number, size_t width); | 56 void appendNumber(int number, size_t width); |
57 | 57 |
58 StringBuilder m_builder; | 58 StringBuilder m_builder; |
59 Locale& m_localizer; | 59 Locale& m_localizer; |
60 const DateComponents& m_date; | 60 const DateComponents& m_date; |
61 }; | 61 }; |
62 | 62 |
63 DateTimeStringBuilder::DateTimeStringBuilder(Locale& localizer, const DateCompon
ents& date) | 63 DateTimeStringBuilder::DateTimeStringBuilder(Locale& localizer, const DateCompon
ents& date) |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon
ds() : dateTimeFormatWithSeconds()); | 439 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon
ds() : dateTimeFormatWithSeconds()); |
440 break; | 440 break; |
441 case DateComponents::Invalid: | 441 case DateComponents::Invalid: |
442 ASSERT_NOT_REACHED(); | 442 ASSERT_NOT_REACHED(); |
443 break; | 443 break; |
444 } | 444 } |
445 return builder.toString(); | 445 return builder.toString(); |
446 } | 446 } |
447 | 447 |
448 } // namespace blink | 448 } // namespace blink |
OLD | NEW |