5
5
// Miguel de Icaza (miguel@novell.com)
6
// Rolf Bjarne Kvinge (rolf@xamarin.com)
8
// Copyright 2012 Xamarin Inc
7
10
// The class can be either constructed from a string (from user code)
8
11
// or from a handle (from iphone-sharp.dll internal calls). This
38
41
namespace MonoMac.CoreFoundation {
43
[StructLayout (LayoutKind.Sequential)]
40
44
public struct CFRange {
41
public int Location, Length;
43
public CFRange (int l, int len)
45
IntPtr loc; // defined as 'long' in native code
46
IntPtr len; // defined as 'long' in native code
49
get { return loc.ToInt32 (); }
53
get { return len.ToInt32 (); }
56
public long LongLocation {
57
get { return loc.ToInt64 (); }
60
public long LongLength {
61
get { return len.ToInt64 (); }
64
public CFRange (int loc, int len)
65
: this ((long) loc, (long) len)
69
public CFRange (long l, long len)
71
this.loc = new IntPtr (l);
72
this.len = new IntPtr (len);
75
public override string ToString ()
77
return string.Format ("CFRange [Location: {0} Length: {1}]", loc, len);
50
81
public static class CFObject {
51
[DllImport (Constants.CoreFoundationLibrary, CharSet=CharSet.Unicode)]
52
internal extern static IntPtr CFRelease (IntPtr obj);
82
[DllImport (Constants.CoreFoundationLibrary)]
83
internal extern static void CFRelease (IntPtr obj);
54
[DllImport (Constants.CoreFoundationLibrary, CharSet=CharSet.Unicode)]
85
[DllImport (Constants.CoreFoundationLibrary)]
55
86
internal extern static IntPtr CFRetain (IntPtr obj);