public int hash() { Contract.Requires(!m_deallocated, "ref count is zero"); int hash = 0; if (m_instance != IntPtr.Zero) { IntPtr exception = IntPtr.Zero; hash = DirectCalls.Calli(this, Selector.Hash, ref exception); if (exception != IntPtr.Zero) { CocoaException.Raise(exception); } } return(hash); }
/// <exclude/> public uint retainCount() { Contract.Requires(!m_deallocated, "ref count is zero"); uint count = uint.MaxValue; if (m_instance != IntPtr.Zero) { IntPtr exception = IntPtr.Zero; count = unchecked ((uint)DirectCalls.Calli(m_instance, Selector.RetainCount, ref exception)); if (exception != IntPtr.Zero) { CocoaException.Raise(exception); } } return(count); }
public SignatureInfo(IntPtr sig) { Contract.Requires(sig != IntPtr.Zero, "sig is nil"); // Get the return encoding. IntPtr exception = IntPtr.Zero; IntPtr buffer = DirectCalls.Callp(sig, methodReturnType, ref exception); if (exception != IntPtr.Zero) { CocoaException.Raise(exception); } m_return = Marshal.PtrToStringAnsi(buffer); // Get the number of arguments. int count = DirectCalls.Calli(sig, numberOfArguments, ref exception); if (exception != IntPtr.Zero) { CocoaException.Raise(exception); } // Get the encodings for each argument. m_args = new string[count]; for (int i = 0; i < count; ++i) { buffer = DirectCalls.Callpi(sig, getArgumentTypeAtIndex, i, ref exception); if (exception != IntPtr.Zero) { CocoaException.Raise(exception); } m_args[i] = Marshal.PtrToStringAnsi(buffer); } }