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

Side by Side Diff: base/mac/foundation_util.h

Issue 13455004: Forward-declare enums in a way that is compatible with NS_ENUM (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Don't check objc_fixed_enum Created 7 years, 8 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 10 matching lines...) Expand all
21 class NSBundle; 21 class NSBundle;
22 class NSString; 22 class NSString;
23 #endif // __OBJC__ 23 #endif // __OBJC__
24 24
25 #if defined(OS_IOS) 25 #if defined(OS_IOS)
26 #include <CoreText/CoreText.h> 26 #include <CoreText/CoreText.h>
27 #else 27 #else
28 #include <ApplicationServices/ApplicationServices.h> 28 #include <ApplicationServices/ApplicationServices.h>
29 #endif 29 #endif
30 30
31 // Adapted from NSObjCRuntime.h NS_ENUM definition (used in Foundation starting
32 // with the OS X 10.8 SDK and the iOS 6.0 SDK).
33 #if __has_extension(cxx_strong_enums) && \
34 (defined(OS_IOS) || (defined(MAC_OS_X_VERSION_10_8) && \
35 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8))
36 #define CR_FORWARD_ENUM(_type, _name) enum _name : _type _name
37 #else
38 #define CR_FORWARD_ENUM(_type, _name) _type _name
39 #endif
40
31 // Adapted from NSPathUtilities.h and NSObjCRuntime.h. 41 // Adapted from NSPathUtilities.h and NSObjCRuntime.h.
32 #if __LP64__ || NS_BUILD_32_LIKE_64 42 #if __LP64__ || NS_BUILD_32_LIKE_64
33 typedef unsigned long NSSearchPathDirectory; 43 typedef CR_FORWARD_ENUM(unsigned long, NSSearchPathDirectory);
34 typedef unsigned long NSSearchPathDomainMask; 44 typedef unsigned long NSSearchPathDomainMask;
35 #else 45 #else
36 typedef unsigned int NSSearchPathDirectory; 46 typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory);
37 typedef unsigned int NSSearchPathDomainMask; 47 typedef unsigned int NSSearchPathDomainMask;
38 #endif 48 #endif
39 49
40 typedef struct OpaqueSecTrustRef* SecACLRef; 50 typedef struct OpaqueSecTrustRef* SecACLRef;
41 typedef struct OpaqueSecTrustedApplicationRef* SecTrustedApplicationRef; 51 typedef struct OpaqueSecTrustedApplicationRef* SecTrustedApplicationRef;
42 52
43 namespace base { 53 namespace base {
44 54
45 class FilePath; 55 class FilePath;
46 56
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // by using the NSToCFCast methods above. 360 // by using the NSToCFCast methods above.
351 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); 361 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo");
352 // Operator << can not be overloaded for ObjectiveC types as the compiler 362 // Operator << can not be overloaded for ObjectiveC types as the compiler
353 // can not distinguish between overloads for id with overloads for void*. 363 // can not distinguish between overloads for id with overloads for void*.
354 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, 364 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o,
355 const CFErrorRef err); 365 const CFErrorRef err);
356 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, 366 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o,
357 const CFStringRef str); 367 const CFStringRef str);
358 368
359 #endif // BASE_MAC_FOUNDATION_UTIL_H_ 369 #endif // BASE_MAC_FOUNDATION_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698