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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/mac/foundation_util.mm » ('j') | base/mac/foundation_util.mm » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MAC_FOUNDATION_UTIL_H_ 5 #ifndef BASE_MAC_FOUNDATION_UTIL_H_
6 #define BASE_MAC_FOUNDATION_UTIL_H_ 6 #define BASE_MAC_FOUNDATION_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <CoreFoundation/CoreFoundation.h> 9 #include <CoreFoundation/CoreFoundation.h>
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // |exec_name| - path to the binary 95 // |exec_name| - path to the binary
96 // returns - path to the application bundle, or empty on error 96 // returns - path to the application bundle, or empty on error
97 BASE_EXPORT FilePath GetAppBundlePath(const FilePath& exec_name); 97 BASE_EXPORT FilePath GetAppBundlePath(const FilePath& exec_name);
98 98
99 // Utility function to pull out a value from a dictionary, check its type, and 99 // Utility function to pull out a value from a dictionary, check its type, and
100 // return it. Returns NULL if the key is not present or of the wrong type. 100 // return it. Returns NULL if the key is not present or of the wrong type.
101 BASE_EXPORT CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, 101 BASE_EXPORT CFTypeRef GetValueFromDictionary(CFDictionaryRef dict,
102 CFStringRef key, 102 CFStringRef key,
103 CFTypeID expected_type); 103 CFTypeID expected_type);
104 104
105 BASE_EXPORT template<class T>
Mark Mentovai 2011/11/11 23:20:45 More of a typename than a class. You can fix CFCas
106 T GetValueFromDictionary(CFDictionaryRef dict, CFStringRef key);
107
105 // Retain/release calls for memory management in C++. 108 // Retain/release calls for memory management in C++.
106 BASE_EXPORT void NSObjectRetain(void* obj); 109 BASE_EXPORT void NSObjectRetain(void* obj);
107 BASE_EXPORT void NSObjectRelease(void* obj); 110 BASE_EXPORT void NSObjectRelease(void* obj);
108 111
109 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation 112 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation
110 // object (one derived from CFTypeRef) to the Foundation memory management 113 // object (one derived from CFTypeRef) to the Foundation memory management
111 // system. In a traditional managed-memory environment, cf_object is 114 // system. In a traditional managed-memory environment, cf_object is
112 // autoreleased and returned as an NSObject. In a garbage-collected 115 // autoreleased and returned as an NSObject. In a garbage-collected
113 // environment, cf_object is marked as eligible for garbage collection. 116 // environment, cf_object is marked as eligible for garbage collection.
114 // 117 //
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // by using the NSToCFCast methods above. 275 // by using the NSToCFCast methods above.
273 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); 276 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo");
274 // Operator << can not be overloaded for ObjectiveC types as the compiler 277 // Operator << can not be overloaded for ObjectiveC types as the compiler
275 // can not distinguish between overloads for id with overloads for void*. 278 // can not distinguish between overloads for id with overloads for void*.
276 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, 279 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o,
277 const CFErrorRef err); 280 const CFErrorRef err);
278 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, 281 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o,
279 const CFStringRef str); 282 const CFStringRef str);
280 283
281 #endif // BASE_MAC_FOUNDATION_UTIL_H_ 284 #endif // BASE_MAC_FOUNDATION_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/mac/foundation_util.mm » ('j') | base/mac/foundation_util.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698