From ff4c1d8cd62bad8351b44ee39145e5a6dc8fdf7f Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Wed, 4 Aug 2010 16:58:12 +0000 Subject: Rename DictionaryValue's SetStringFromUTF16() to SetString() (and overload). Also do a bunch of drive-by changes while I'm at it. Still to do: rename GetStringAsUTF16() to GetString(). BUG=none TEST=builds everywhere, tests pass Review URL: http://codereview.chromium.org/3033050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54915 0039d316-1c4b-4281-b951-d872f2087c98 --- base/values.cc | 12 +++++++----- base/values.h | 8 +++++--- base/values_unittest.cc | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'base') diff --git a/base/values.cc b/base/values.cc index 8fdd4ea..af801bc 100644 --- a/base/values.cc +++ b/base/values.cc @@ -448,8 +448,8 @@ void DictionaryValue::SetString(const std::string& path, Set(path, CreateStringValue(in_value)); } -void DictionaryValue::SetStringFromUTF16(const std::string& path, - const string16& in_value) { +void DictionaryValue::SetString(const std::string& path, + const string16& in_value) { Set(path, CreateStringValue(in_value)); } @@ -476,15 +476,17 @@ void DictionaryValue::SetString(const std::wstring& path, // TODO(viettrungluu): Deprecated and to be removed: void DictionaryValue::SetString(const std::wstring& path, - const std::wstring& in_value) { + const string16& in_value) { Set(path, CreateStringValue(in_value)); } +#if !defined(WCHAR_T_IS_UTF16) // TODO(viettrungluu): Deprecated and to be removed: -void DictionaryValue::SetStringFromUTF16(const std::wstring& path, - const string16& in_value) { +void DictionaryValue::SetString(const std::wstring& path, + const std::wstring& in_value) { Set(path, CreateStringValue(in_value)); } +#endif void DictionaryValue::SetWithoutPathExpansion(const std::string& key, Value* in_value) { diff --git a/base/values.h b/base/values.h index 57139d8..39683a6 100644 --- a/base/values.h +++ b/base/values.h @@ -253,16 +253,18 @@ class DictionaryValue : public Value { void SetInteger(const std::string& path, int in_value); void SetReal(const std::string& path, double in_value); void SetString(const std::string& path, const std::string& in_value); - void SetStringFromUTF16(const std::string& path, const string16& in_value); + void SetString(const std::string& path, const string16& in_value); /*DEPRECATED*/void SetBoolean(const std::wstring& path, bool in_value); /*DEPRECATED*/void SetInteger(const std::wstring& path, int in_value); /*DEPRECATED*/void SetReal(const std::wstring& path, double in_value); /*DEPRECATED*/void SetString(const std::wstring& path, const std::string& in_value); /*DEPRECATED*/void SetString(const std::wstring& path, + const string16& in_value); +#if !defined(WCHAR_T_IS_UTF16) + /*DEPRECATED*/void SetString(const std::wstring& path, const std::wstring& in_value); - /*DEPRECATED*/void SetStringFromUTF16(const std::wstring& path, - const string16& in_value); +#endif // Like Set(), but without special treatment of '.'. This allows e.g. URLs to // be used as paths. diff --git a/base/values_unittest.cc b/base/values_unittest.cc index 688e42b..d71280d 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -804,7 +804,7 @@ TEST_F(ValuesTest, Equals) { dv.SetInteger("b", 2); dv.SetReal("c", 2.5); dv.SetString("d1", "string"); - dv.SetStringFromUTF16("d2", ASCIIToUTF16("http://google.com")); + dv.SetString("d2", ASCIIToUTF16("http://google.com")); dv.Set("e", Value::CreateNullValue()); DictionaryValue* copy = static_cast(dv.DeepCopy()); -- cgit v1.1