diff options
author | kushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-01 22:12:57 +0000 |
---|---|---|
committer | kushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-01 22:12:57 +0000 |
commit | f54596d9b7db5831fd0df6f54a492d8cb1c74979 (patch) | |
tree | a0ffd34a4a13215b13df16159e98734e48bbef77 /base/mac/foundation_util.h | |
parent | 3276041925cec5ad27ab6b57d86715c259f4a5ca (diff) | |
download | chromium_src-f54596d9b7db5831fd0df6f54a492d8cb1c74979.zip chromium_src-f54596d9b7db5831fd0df6f54a492d8cb1c74979.tar.gz chromium_src-f54596d9b7db5831fd0df6f54a492d8cb1c74979.tar.bz2 |
Use the new base::mac::GetValueFromDictionary<>() method.
Remove all cases of the old method signature (and related tests) and
use the new form.
BUG=104200
Review URL: http://codereview.chromium.org/8769016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac/foundation_util.h')
-rw-r--r-- | base/mac/foundation_util.h | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h index a36ad75..1a87470 100644 --- a/base/mac/foundation_util.h +++ b/base/mac/foundation_util.h @@ -113,20 +113,6 @@ TYPE_NAME_FOR_CF_TYPE_DECL(CFString); #undef TYPE_NAME_FOR_CF_TYPE_DECL -// Helper function for GetValueFromDictionary to create the error message -// that appears when a type mismatch is encountered. -std::string GetValueFromDictionaryErrorMessage( - CFStringRef key, const std::string& expected_type, CFTypeRef value); - -// Utility function to pull out a value from a dictionary, check its type, and -// return it. Returns NULL if the key is not present or of the wrong type. -// This is now deprecated in favor of the two-argument form below. -// TODO(kushi.p): Remove this function once all cases of it have been -// replaced with the two-argument form below. See: crbug.com/104200. -BASE_EXPORT CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, - CFStringRef key, - CFTypeID expected_type); - // Retain/release calls for memory management in C++. BASE_EXPORT void NSObjectRetain(void* obj); BASE_EXPORT void NSObjectRelease(void* obj); @@ -243,10 +229,8 @@ namespace mac { // CFNumberRef some_number = base::mac::CFCast<CFNumberRef>( // CFArrayGetValueAtIndex(array, index)); // -// CFStringRef some_string = base::mac::CFCastStrict<CFStringRef>( -// base::mac::GetValueFromDictionary(some_dict, -// CFSTR("a_key"), -// CFStringGetTypeID())); +// CFTypeRef hello = CFSTR("hello world"); +// CFStringRef some_string = base::mac::CFCastStrict<CFStringRef>(hello); BASE_EXPORT template<typename T> T CFCast(const CFTypeRef& cf_val); @@ -294,8 +278,13 @@ T* ObjCCastStrict(id objc_val) { #endif // defined(__OBJC__) +// Helper function for GetValueFromDictionary to create the error message +// that appears when a type mismatch is encountered. +std::string GetValueFromDictionaryErrorMessage( + CFStringRef key, const std::string& expected_type, CFTypeRef value); + // Utility function to pull out a value from a dictionary, check its type, and -// return it. Returns NULL if the key is not present or of the wrong type. +// return it. Returns NULL if the key is not present or of the wrong type. BASE_EXPORT template<typename T> T GetValueFromDictionary(CFDictionaryRef dict, CFStringRef key) { CFTypeRef value = CFDictionaryGetValue(dict, key); |