| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_I18N_MESSAGE_FORMATTER_H_ | 5 #ifndef BASE_I18N_MESSAGE_FORMATTER_H_ |
| 6 #define BASE_I18N_MESSAGE_FORMATTER_H_ | 6 #define BASE_I18N_MESSAGE_FORMATTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 9 #include <string> | 11 #include <string> |
| 10 | 12 |
| 11 #include "base/i18n/base_i18n_export.h" | 13 #include "base/i18n/base_i18n_export.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 15 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 16 #include "third_party/icu/source/common/unicode/uversion.h" | 17 #include "third_party/icu/source/common/unicode/uversion.h" |
| 17 | 18 |
| 18 U_NAMESPACE_BEGIN | 19 U_NAMESPACE_BEGIN |
| 19 class Formattable; | 20 class Formattable; |
| 20 U_NAMESPACE_END | 21 U_NAMESPACE_END |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 | 24 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 MessageArg(int64_t i); | 40 MessageArg(int64_t i); |
| 40 MessageArg(double d); | 41 MessageArg(double d); |
| 41 MessageArg(const Time& t); | 42 MessageArg(const Time& t); |
| 42 ~MessageArg(); | 43 ~MessageArg(); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 friend class base::i18n::MessageFormatter; | 46 friend class base::i18n::MessageFormatter; |
| 46 MessageArg(); | 47 MessageArg(); |
| 47 // Tests if this argument has a value, and if so increments *count. | 48 // Tests if this argument has a value, and if so increments *count. |
| 48 bool has_value(int* count) const; | 49 bool has_value(int* count) const; |
| 49 scoped_ptr<icu::Formattable> formattable; | 50 std::unique_ptr<icu::Formattable> formattable; |
| 50 DISALLOW_COPY_AND_ASSIGN(MessageArg); | 51 DISALLOW_COPY_AND_ASSIGN(MessageArg); |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace internal | 54 } // namespace internal |
| 54 | 55 |
| 55 // Message Formatter with the ICU message format syntax support. | 56 // Message Formatter with the ICU message format syntax support. |
| 56 // It can format strings (UTF-8 and UTF-16), numbers and base::Time with | 57 // It can format strings (UTF-8 and UTF-16), numbers and base::Time with |
| 57 // plural, gender and other 'selectors' support. This is handy if you | 58 // plural, gender and other 'selectors' support. This is handy if you |
| 58 // have multiple parameters of differnt types and some of them require | 59 // have multiple parameters of differnt types and some of them require |
| 59 // plural or gender/selector support. | 60 // plural or gender/selector support. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 MessageFormatter() {} | 106 MessageFormatter() {} |
| 106 DISALLOW_COPY_AND_ASSIGN(MessageFormatter); | 107 DISALLOW_COPY_AND_ASSIGN(MessageFormatter); |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 } // namespace i18n | 110 } // namespace i18n |
| 110 } // namespace base | 111 } // namespace base |
| 111 | 112 |
| 112 #endif // BASE_I18N_MESSAGE_FORMATTER_H_ | 113 #endif // BASE_I18N_MESSAGE_FORMATTER_H_ |
| OLD | NEW |