| 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 | 7 |
| 8 #include <CoreFoundation/CoreFoundation.h> | 8 #include <CoreFoundation/CoreFoundation.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 return value_specific; | 367 return value_specific; |
| 368 } | 368 } |
| 369 | 369 |
| 370 // Converts |path| to an autoreleased NSString. Returns nil if |path| is empty. | 370 // Converts |path| to an autoreleased NSString. Returns nil if |path| is empty. |
| 371 BASE_EXPORT NSString* FilePathToNSString(const FilePath& path); | 371 BASE_EXPORT NSString* FilePathToNSString(const FilePath& path); |
| 372 | 372 |
| 373 // Converts |str| to a FilePath. Returns an empty path if |str| is nil. | 373 // Converts |str| to a FilePath. Returns an empty path if |str| is nil. |
| 374 BASE_EXPORT FilePath NSStringToFilePath(NSString* str); | 374 BASE_EXPORT FilePath NSStringToFilePath(NSString* str); |
| 375 | 375 |
| 376 #if defined(__OBJC__) |
| 377 // Converts |range| to an NSRange, returning the new range in |range_out|. |
| 378 // Returns true if conversion was successful, false if the values of |range| |
| 379 // could not be converted to NSUIntegers. |
| 380 BASE_EXPORT bool CFRangeToNSRange(CFRange range, |
| 381 NSRange* range_out) WARN_UNUSED_RESULT; |
| 382 #endif // defined(__OBJC__) |
| 383 |
| 376 } // namespace mac | 384 } // namespace mac |
| 377 } // namespace base | 385 } // namespace base |
| 378 | 386 |
| 379 // Stream operations for CFTypes. They can be used with NSTypes as well | 387 // Stream operations for CFTypes. They can be used with NSTypes as well |
| 380 // by using the NSToCFCast methods above. | 388 // by using the NSToCFCast methods above. |
| 381 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); | 389 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); |
| 382 // Operator << can not be overloaded for ObjectiveC types as the compiler | 390 // Operator << can not be overloaded for ObjectiveC types as the compiler |
| 383 // can not distinguish between overloads for id with overloads for void*. | 391 // can not distinguish between overloads for id with overloads for void*. |
| 384 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 392 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
| 385 const CFErrorRef err); | 393 const CFErrorRef err); |
| 386 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 394 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
| 387 const CFStringRef str); | 395 const CFStringRef str); |
| 388 | 396 |
| 389 #endif // BASE_MAC_FOUNDATION_UTIL_H_ | 397 #endif // BASE_MAC_FOUNDATION_UTIL_H_ |
| OLD | NEW |