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 |