summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/file_version_info_mac.mm2
-rw-r--r--base/mac/foundation_util.h69
-rw-r--r--base/mac/mac_util.h69
3 files changed, 70 insertions, 70 deletions
diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm
index 293d904..b87dbcb 100644
--- a/base/file_version_info_mac.mm
+++ b/base/file_version_info_mac.mm
@@ -8,7 +8,7 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/mac/mac_util.h"
+#include "base/mac/foundation_util.h"
#include "base/sys_string_conversions.h"
FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle)
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h
index 24a301e..dc7d4e7 100644
--- a/base/mac/foundation_util.h
+++ b/base/mac/foundation_util.h
@@ -134,4 +134,73 @@ void SetBaseBundleID(const char* new_base_bundle_id);
} // namespace mac
} // namespace base
+#if !defined(__OBJC__)
+#define OBJC_CPP_CLASS_DECL(x) class x;
+#else // __OBJC__
+#define OBJC_CPP_CLASS_DECL(x)
+#endif // __OBJC__
+
+// Convert toll-free bridged CFTypes to NSTypes and vice-versa. This does not
+// autorelease |cf_val|. This is useful for the case where there is a CFType in
+// a call that expects an NSType and the compiler is complaining about const
+// casting problems.
+// The calls are used like this:
+// NSString *foo = CFToNSCast(CFSTR("Hello"));
+// CFStringRef foo2 = NSToCFCast(@"Hello");
+// The macro magic below is to enforce safe casting. It could possibly have
+// been done using template function specialization, but template function
+// specialization doesn't always work intuitively,
+// (http://www.gotw.ca/publications/mill17.htm) so the trusty combination
+// of macros and function overloading is used instead.
+
+#define CF_TO_NS_CAST_DECL(TypeCF, TypeNS) \
+OBJC_CPP_CLASS_DECL(TypeNS) \
+\
+namespace base { \
+namespace mac { \
+TypeNS* CFToNSCast(TypeCF##Ref cf_val); \
+TypeCF##Ref NSToCFCast(TypeNS* ns_val); \
+} \
+} \
+
+#define CF_TO_NS_MUTABLE_CAST_DECL(name) \
+CF_TO_NS_CAST_DECL(CF##name, NS##name) \
+OBJC_CPP_CLASS_DECL(NSMutable##name) \
+\
+namespace base { \
+namespace mac { \
+NSMutable##name* CFToNSCast(CFMutable##name##Ref cf_val); \
+CFMutable##name##Ref NSToCFCast(NSMutable##name* ns_val); \
+} \
+} \
+
+// List of toll-free bridged types taken from:
+// http://www.cocoadev.com/index.pl?TollFreeBridged
+
+CF_TO_NS_MUTABLE_CAST_DECL(Array);
+CF_TO_NS_MUTABLE_CAST_DECL(AttributedString);
+CF_TO_NS_CAST_DECL(CFCalendar, NSCalendar);
+CF_TO_NS_MUTABLE_CAST_DECL(CharacterSet);
+CF_TO_NS_MUTABLE_CAST_DECL(Data);
+CF_TO_NS_CAST_DECL(CFDate, NSDate);
+CF_TO_NS_MUTABLE_CAST_DECL(Dictionary);
+CF_TO_NS_CAST_DECL(CFError, NSError);
+CF_TO_NS_CAST_DECL(CFLocale, NSLocale);
+CF_TO_NS_CAST_DECL(CFNumber, NSNumber);
+CF_TO_NS_CAST_DECL(CFRunLoopTimer, NSTimer);
+CF_TO_NS_CAST_DECL(CFTimeZone, NSTimeZone);
+CF_TO_NS_MUTABLE_CAST_DECL(Set);
+CF_TO_NS_CAST_DECL(CFReadStream, NSInputStream);
+CF_TO_NS_CAST_DECL(CFWriteStream, NSOutputStream);
+CF_TO_NS_MUTABLE_CAST_DECL(String);
+CF_TO_NS_CAST_DECL(CFURL, NSURL);
+
+// Stream operations for CFTypes. They can be used with NSTypes as well
+// by using the NSToCFCast methods above.
+// e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo");
+// Operator << can not be overloaded for ObjectiveC types as the compiler
+// can not distinguish between overloads for id with overloads for void*.
+extern std::ostream& operator<<(std::ostream& o, const CFErrorRef err);
+extern std::ostream& operator<<(std::ostream& o, const CFStringRef str);
+
#endif // BASE_MAC_FOUNDATION_UTIL_H_
diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h
index 990197d..1bd936d 100644
--- a/base/mac/mac_util.h
+++ b/base/mac/mac_util.h
@@ -113,73 +113,4 @@ bool WasLaunchedAsHiddenLoginItem();
} // namespace mac
} // namespace base
-#if !defined(__OBJC__)
-#define OBJC_CPP_CLASS_DECL(x) class x;
-#else // __OBJC__
-#define OBJC_CPP_CLASS_DECL(x)
-#endif // __OBJC__
-
-// Convert toll-free bridged CFTypes to NSTypes and vice-versa. This does not
-// autorelease |cf_val|. This is useful for the case where there is a CFType in
-// a call that expects an NSType and the compiler is complaining about const
-// casting problems.
-// The calls are used like this:
-// NSString *foo = CFToNSCast(CFSTR("Hello"));
-// CFStringRef foo2 = NSToCFCast(@"Hello");
-// The macro magic below is to enforce safe casting. It could possibly have
-// been done using template function specialization, but template function
-// specialization doesn't always work intuitively,
-// (http://www.gotw.ca/publications/mill17.htm) so the trusty combination
-// of macros and function overloading is used instead.
-
-#define CF_TO_NS_CAST_DECL(TypeCF, TypeNS) \
-OBJC_CPP_CLASS_DECL(TypeNS) \
-\
-namespace base { \
-namespace mac { \
-TypeNS* CFToNSCast(TypeCF##Ref cf_val); \
-TypeCF##Ref NSToCFCast(TypeNS* ns_val); \
-} \
-} \
-
-#define CF_TO_NS_MUTABLE_CAST_DECL(name) \
-CF_TO_NS_CAST_DECL(CF##name, NS##name) \
-OBJC_CPP_CLASS_DECL(NSMutable##name) \
-\
-namespace base { \
-namespace mac { \
-NSMutable##name* CFToNSCast(CFMutable##name##Ref cf_val); \
-CFMutable##name##Ref NSToCFCast(NSMutable##name* ns_val); \
-} \
-} \
-
-// List of toll-free bridged types taken from:
-// http://www.cocoadev.com/index.pl?TollFreeBridged
-
-CF_TO_NS_MUTABLE_CAST_DECL(Array);
-CF_TO_NS_MUTABLE_CAST_DECL(AttributedString);
-CF_TO_NS_CAST_DECL(CFCalendar, NSCalendar);
-CF_TO_NS_MUTABLE_CAST_DECL(CharacterSet);
-CF_TO_NS_MUTABLE_CAST_DECL(Data);
-CF_TO_NS_CAST_DECL(CFDate, NSDate);
-CF_TO_NS_MUTABLE_CAST_DECL(Dictionary);
-CF_TO_NS_CAST_DECL(CFError, NSError);
-CF_TO_NS_CAST_DECL(CFLocale, NSLocale);
-CF_TO_NS_CAST_DECL(CFNumber, NSNumber);
-CF_TO_NS_CAST_DECL(CFRunLoopTimer, NSTimer);
-CF_TO_NS_CAST_DECL(CFTimeZone, NSTimeZone);
-CF_TO_NS_MUTABLE_CAST_DECL(Set);
-CF_TO_NS_CAST_DECL(CFReadStream, NSInputStream);
-CF_TO_NS_CAST_DECL(CFWriteStream, NSOutputStream);
-CF_TO_NS_MUTABLE_CAST_DECL(String);
-CF_TO_NS_CAST_DECL(CFURL, NSURL);
-
-// Stream operations for CFTypes. They can be used with NSTypes as well
-// by using the NSToCFCast methods above.
-// e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo");
-// Operator << can not be overloaded for ObjectiveC types as the compiler
-// can not distinguish between overloads for id with overloads for void*.
-extern std::ostream& operator<<(std::ostream& o, const CFErrorRef err);
-extern std::ostream& operator<<(std::ostream& o, const CFStringRef str);
-
#endif // BASE_MAC_MAC_UTIL_H_