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

Unified Diff: app/l10n_util.cc

Issue 5990008: Remove wstring from l10n_util. Part 1.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 side-by-side diff with in-line comments
Download patch
Index: app/l10n_util.cc
===================================================================
--- app/l10n_util.cc (revision 70069)
+++ app/l10n_util.cc (working copy)
@@ -568,9 +568,11 @@
return true;
}
+#if CRBUG_9911_OBSOLETE_GOING_AWAY
std::wstring GetString(int message_id) {
return UTF16ToWide(GetStringUTF16(message_id));
}
+#endif
std::string GetStringUTF8(int message_id) {
return UTF16ToUTF8(GetStringUTF16(message_id));
@@ -628,6 +630,7 @@
return formatted;
}
+#if CRBUG_9911_OBSOLETE_GOING_AWAY
#if !defined(WCHAR_T_IS_UTF16)
std::wstring GetStringF(int message_id, const std::wstring& a) {
return UTF16ToWide(GetStringFUTF16(message_id, WideToUTF16(a)));
@@ -657,6 +660,7 @@
WideToUTF16(c), WideToUTF16(d)));
}
#endif
+#endif
std::string GetStringFUTF8(int message_id,
const string16& a) {
@@ -721,6 +725,7 @@
return GetStringF(message_id, replacements, NULL);
}
+#if CRBUG_9911_OBSOLETE_GOING_AWAY
std::wstring GetStringF(int message_id, const std::wstring& a, size_t* offset) {
DCHECK(offset);
std::vector<size_t> offsets;
@@ -741,6 +746,7 @@
replacements.push_back(WideToUTF16(b));
return UTF16ToWide(GetStringF(message_id, replacements, offsets));
}
+#endif
string16 GetStringFUTF16(int message_id, const string16& a, size_t* offset) {
DCHECK(offset);
@@ -763,6 +769,7 @@
return GetStringF(message_id, replacements, offsets);
}
+#if CRBUG_9911_OBSOLETE_GOING_AWAY
std::wstring GetStringF(int message_id, int a) {
return GetStringF(message_id, UTF8ToWide(base::IntToString(a)));
}
@@ -770,7 +777,16 @@
std::wstring GetStringF(int message_id, int64 a) {
return GetStringF(message_id, UTF8ToWide(base::Int64ToString(a)));
}
+#endif
+string16 GetStringFUTF16(int message_id, int a) {
+ return GetStringFUTF16(message_id, UTF8ToUTF16(base::IntToString(a)));
+}
+
+string16 GetStringFUTF16(int message_id, int64 a) {
+ return GetStringFUTF16(message_id, UTF8ToUTF16(base::Int64ToString(a)));
+}
+
string16 TruncateString(const string16& string, size_t length) {
if (string.size() <= length)
// String fits, return it.
@@ -887,18 +903,6 @@
return result;
}
-// Specialization of operator() method for std::wstring version.
-template <>
-bool StringComparator<std::wstring>::operator()(const std::wstring& lhs,
- const std::wstring& rhs) {
- // If we can not get collator instance for specified locale, just do simple
- // string compare.
- if (!collator_)
- return lhs < rhs;
- return CompareStringWithCollator(collator_, lhs, rhs) == UCOL_LESS;
-};
-
-#if !defined(WCHAR_T_IS_UTF16)
// Specialization of operator() method for string16 version.
template <>
bool StringComparator<string16>::operator()(const string16& lhs,
@@ -909,13 +913,7 @@
return lhs < rhs;
return CompareString16WithCollator(collator_, lhs, rhs) == UCOL_LESS;
};
-#endif // !defined(WCHAR_T_IS_UTF16)
-void SortStrings(const std::string& locale,
- std::vector<std::wstring>* strings) {
- SortVectorWithStringKey(locale, strings, false);
-}
-
void SortStrings16(const std::string& locale,
std::vector<string16>* strings) {
SortVectorWithStringKey(locale, strings, false);

Powered by Google App Engine
This is Rietveld 408576698