~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/maccore/src/CoreFoundation/CFString.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
//
4
4
// Authors:
5
5
//    Miguel de Icaza (miguel@novell.com)
 
6
//    Rolf Bjarne Kvinge (rolf@xamarin.com)
 
7
//
 
8
// Copyright 2012 Xamarin Inc
6
9
//
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
37
40
 
38
41
namespace MonoMac.CoreFoundation {
39
42
 
 
43
        [StructLayout (LayoutKind.Sequential)]
40
44
        public struct CFRange {
41
 
                public int Location, Length;
42
 
                
43
 
                public CFRange (int l, int len)
44
 
                {
45
 
                        Location = l;
46
 
                        Length = len;
 
45
                IntPtr loc; // defined as 'long' in native code
 
46
                IntPtr len; // defined as 'long' in native code
 
47
 
 
48
                public int Location {
 
49
                        get { return loc.ToInt32 (); }
 
50
                }
 
51
                
 
52
                public int Length {
 
53
                        get { return len.ToInt32 (); }
 
54
                }
 
55
                
 
56
                public long LongLocation {
 
57
                        get { return loc.ToInt64 (); }
 
58
                }
 
59
                
 
60
                public long LongLength {
 
61
                        get { return len.ToInt64 (); }
 
62
                }
 
63
 
 
64
                public CFRange (int loc, int len)
 
65
                        : this ((long) loc, (long) len)
 
66
                {
 
67
                }
 
68
 
 
69
                public CFRange (long l, long len)
 
70
                {
 
71
                        this.loc = new IntPtr (l);
 
72
                        this.len = new IntPtr (len);
 
73
                }
 
74
                
 
75
                public override string ToString ()
 
76
                {
 
77
                        return string.Format ("CFRange [Location: {0} Length: {1}]", loc, len);
47
78
                }
48
79
        }
49
80
 
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);
53
84
 
54
 
                [DllImport (Constants.CoreFoundationLibrary, CharSet=CharSet.Unicode)]
 
85
                [DllImport (Constants.CoreFoundationLibrary)]
55
86
                internal extern static IntPtr CFRetain (IntPtr obj);
56
87
        }
57
88