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

Unified Diff: base/mac/foundation_util.h

Issue 8540021: Create a nicer interface for base::mac::GetValueFromDictionary (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: move header definition to be in similar place as body def Created 9 years, 1 month 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
« no previous file with comments | « no previous file | base/mac/foundation_util.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/foundation_util.h
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h
index f7821de08cdb09bca58aaca59da82bd689407e29..c02b9d7d1b2bac2b484e730adfbd4d84420d2dd3 100644
--- a/base/mac/foundation_util.h
+++ b/base/mac/foundation_util.h
@@ -102,6 +102,11 @@ BASE_EXPORT CFTypeRef GetValueFromDictionary(CFDictionaryRef dict,
CFStringRef key,
CFTypeID expected_type);
+// 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.
+BASE_EXPORT template<class T>
+T GetValueFromDictionary(CFDictionaryRef dict, CFStringRef key);
Nico 2011/11/11 23:08:36 I don't understand why this is a template function
KushalP 2011/11/11 23:13:35 I would've thought the template function is a clea
+
// Retain/release calls for memory management in C++.
BASE_EXPORT void NSObjectRetain(void* obj);
BASE_EXPORT void NSObjectRelease(void* obj);
@@ -265,6 +270,12 @@ T* ObjCCastStrict(id objc_val) {
#endif // defined(__OBJC__)
+// 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.
+// Is a cleaner implementation of base::mac::GetValueFromDictionary() above.
+BASE_EXPORT template<class T>
+T GetValueFromDictionary(CFDictionaryRef dict, CFStringRef key);
+
} // namespace mac
} // namespace base
« no previous file with comments | « no previous file | base/mac/foundation_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698