• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_BASE_MACCONVERSION_H_
12 #define WEBRTC_BASE_MACCONVERSION_H_
13 
14 #if defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
15 
16 #include <CoreFoundation/CoreFoundation.h>
17 
18 #include <string>
19 
20 // given a CFStringRef, attempt to convert it to a C++ string.
21 // returns true if it succeeds, false otherwise.
22 // We can safely assume, given our context, that the string is
23 // going to be in ASCII, because it will either be an IP address,
24 // or a domain name, which is guaranteed to be ASCII-representable.
25 bool p_convertHostCFStringRefToCPPString(const CFStringRef cfstr,
26                                          std::string& cppstr);
27 
28 // Convert the CFNumber to an integer, putting the integer in the location
29 // given, and returhing true, if the conversion succeeds.
30 // If given a NULL or a non-CFNumber, returns false.
31 // This is pretty aggresive about trying to convert to int.
32 bool p_convertCFNumberToInt(CFNumberRef cfn, int* i);
33 
34 // given a CFNumberRef, determine if it represents a true value.
35 bool p_isCFNumberTrue(CFNumberRef cfn);
36 
37 #endif  // WEBRTC_MAC || WEBRTC_IOS
38 
39 #endif  // WEBRTC_BASE_MACCONVERSION_H_
40