summaryrefslogtreecommitdiffstats
path: root/base/i18n/icu_string_conversions.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-10 20:40:50 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-10 20:40:50 +0000
commitd6e58c6ef48f52cce6cdf781c5a507e254322425 (patch)
tree274e82d3fa22052761a146eaed25d862744633af /base/i18n/icu_string_conversions.h
parent3522bda4050a25b9020d9c224e9dfc89439e2f5e (diff)
downloadchromium_src-d6e58c6ef48f52cce6cdf781c5a507e254322425.zip
chromium_src-d6e58c6ef48f52cce6cdf781c5a507e254322425.tar.gz
chromium_src-d6e58c6ef48f52cce6cdf781c5a507e254322425.tar.bz2
Remove the dependency on i18n/icu_string_conversions from base/string_util.h.
Fix up all files requireing this header to include it directly. Split out the ICU-dependent string util unit tests into a new file base/i18n/icu_string_util_unittest.cc TEST=none BUG=none Review URL: http://codereview.chromium.org/269034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n/icu_string_conversions.h')
-rw-r--r--base/i18n/icu_string_conversions.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/base/i18n/icu_string_conversions.h b/base/i18n/icu_string_conversions.h
index d849c71..e7dac605 100644
--- a/base/i18n/icu_string_conversions.h
+++ b/base/i18n/icu_string_conversions.h
@@ -10,9 +10,11 @@
#include "base/string16.h"
#include "base/string_piece.h"
+namespace base {
+
// Defines the error handling modes of UTF16ToCodepage, CodepageToUTF16,
// WideToCodepage and CodepageToWide.
-class OnStringUtilConversionError {
+class OnStringConversionError {
public:
enum Type {
// The function will return failure. The output buffer will be empty.
@@ -29,20 +31,26 @@ class OnStringUtilConversionError {
};
private:
- OnStringUtilConversionError();
+ OnStringConversionError();
};
+// Names of codepages (charsets) understood by icu.
+extern const char kCodepageLatin1[]; // a.k.a. ISO 8859-1
+extern const char kCodepageUTF8[];
+extern const char kCodepageUTF16BE[];
+extern const char kCodepageUTF16LE[];
+
// Converts between UTF-16 strings and the encoding specified. If the
// encoding doesn't exist or the encoding fails (when on_error is FAIL),
// returns false.
bool UTF16ToCodepage(const string16& utf16,
const char* codepage_name,
- OnStringUtilConversionError::Type on_error,
+ OnStringConversionError::Type on_error,
std::string* encoded);
bool CodepageToUTF16(const std::string& encoded,
const char* codepage_name,
- OnStringUtilConversionError::Type on_error,
+ OnStringConversionError::Type on_error,
string16* utf16);
// Converts between wide strings and the encoding specified. If the
@@ -50,11 +58,13 @@ bool CodepageToUTF16(const std::string& encoded,
// returns false.
bool WideToCodepage(const std::wstring& wide,
const char* codepage_name,
- OnStringUtilConversionError::Type on_error,
+ OnStringConversionError::Type on_error,
std::string* encoded);
bool CodepageToWide(const std::string& encoded,
const char* codepage_name,
- OnStringUtilConversionError::Type on_error,
+ OnStringConversionError::Type on_error,
std::wstring* wide);
+} // namespace base
+
#endif // BASE_I18N_ICU_STRING_CONVERSIONS_H_