OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 TYPE_NAME_FOR_CF_TYPE_DECL(CFArray); | 92 TYPE_NAME_FOR_CF_TYPE_DECL(CFArray); |
93 TYPE_NAME_FOR_CF_TYPE_DECL(CFBag); | 93 TYPE_NAME_FOR_CF_TYPE_DECL(CFBag); |
94 TYPE_NAME_FOR_CF_TYPE_DECL(CFBoolean); | 94 TYPE_NAME_FOR_CF_TYPE_DECL(CFBoolean); |
95 TYPE_NAME_FOR_CF_TYPE_DECL(CFData); | 95 TYPE_NAME_FOR_CF_TYPE_DECL(CFData); |
96 TYPE_NAME_FOR_CF_TYPE_DECL(CFDate); | 96 TYPE_NAME_FOR_CF_TYPE_DECL(CFDate); |
97 TYPE_NAME_FOR_CF_TYPE_DECL(CFDictionary); | 97 TYPE_NAME_FOR_CF_TYPE_DECL(CFDictionary); |
98 TYPE_NAME_FOR_CF_TYPE_DECL(CFNull); | 98 TYPE_NAME_FOR_CF_TYPE_DECL(CFNull); |
99 TYPE_NAME_FOR_CF_TYPE_DECL(CFNumber); | 99 TYPE_NAME_FOR_CF_TYPE_DECL(CFNumber); |
100 TYPE_NAME_FOR_CF_TYPE_DECL(CFSet); | 100 TYPE_NAME_FOR_CF_TYPE_DECL(CFSet); |
101 TYPE_NAME_FOR_CF_TYPE_DECL(CFString); | 101 TYPE_NAME_FOR_CF_TYPE_DECL(CFString); |
102 TYPE_NAME_FOR_CF_TYPE_DECL(CFURL); | |
103 | 102 |
104 #undef TYPE_NAME_FOR_CF_TYPE_DECL | 103 #undef TYPE_NAME_FOR_CF_TYPE_DECL |
105 | 104 |
106 // Retain/release calls for memory management in C++. | 105 // Retain/release calls for memory management in C++. |
107 BASE_EXPORT void NSObjectRetain(void* obj); | 106 BASE_EXPORT void NSObjectRetain(void* obj); |
108 BASE_EXPORT void NSObjectRelease(void* obj); | 107 BASE_EXPORT void NSObjectRelease(void* obj); |
109 | 108 |
110 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation | 109 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation |
111 // object (one derived from CFTypeRef) to the Foundation memory management | 110 // object (one derived from CFTypeRef) to the Foundation memory management |
112 // system. In a traditional managed-memory environment, cf_object is | 111 // system. In a traditional managed-memory environment, cf_object is |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 CF_CAST_DECL(CFArray); | 237 CF_CAST_DECL(CFArray); |
239 CF_CAST_DECL(CFBag); | 238 CF_CAST_DECL(CFBag); |
240 CF_CAST_DECL(CFBoolean); | 239 CF_CAST_DECL(CFBoolean); |
241 CF_CAST_DECL(CFData); | 240 CF_CAST_DECL(CFData); |
242 CF_CAST_DECL(CFDate); | 241 CF_CAST_DECL(CFDate); |
243 CF_CAST_DECL(CFDictionary); | 242 CF_CAST_DECL(CFDictionary); |
244 CF_CAST_DECL(CFNull); | 243 CF_CAST_DECL(CFNull); |
245 CF_CAST_DECL(CFNumber); | 244 CF_CAST_DECL(CFNumber); |
246 CF_CAST_DECL(CFSet); | 245 CF_CAST_DECL(CFSet); |
247 CF_CAST_DECL(CFString); | 246 CF_CAST_DECL(CFString); |
248 CF_CAST_DECL(CFURL); | |
249 | 247 |
250 #undef CF_CAST_DEFN | 248 #undef CF_CAST_DEFN |
251 | 249 |
252 #if defined(__OBJC__) | 250 #if defined(__OBJC__) |
253 | 251 |
254 // ObjCCast<>() and ObjCCastStrict<>() cast a basic id to a more | 252 // ObjCCast<>() and ObjCCastStrict<>() cast a basic id to a more |
255 // specific (NSObject-derived) type. The compatibility of the passed | 253 // specific (NSObject-derived) type. The compatibility of the passed |
256 // object is found by checking if it's a kind of the requested type | 254 // object is found by checking if it's a kind of the requested type |
257 // identifier. If the supplied object is not compatible with the | 255 // identifier. If the supplied object is not compatible with the |
258 // requested return type, ObjCCast<>() returns nil and | 256 // requested return type, ObjCCast<>() returns nil and |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // by using the NSToCFCast methods above. | 323 // by using the NSToCFCast methods above. |
326 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); | 324 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); |
327 // Operator << can not be overloaded for ObjectiveC types as the compiler | 325 // Operator << can not be overloaded for ObjectiveC types as the compiler |
328 // can not distinguish between overloads for id with overloads for void*. | 326 // can not distinguish between overloads for id with overloads for void*. |
329 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 327 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
330 const CFErrorRef err); | 328 const CFErrorRef err); |
331 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 329 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
332 const CFStringRef str); | 330 const CFStringRef str); |
333 | 331 |
334 #endif // BASE_MAC_FOUNDATION_UTIL_H_ | 332 #endif // BASE_MAC_FOUNDATION_UTIL_H_ |
OLD | NEW |