C# Class Monobjc.ObjectiveCEncoding

Utility class to handle encoding of types and methods.

Exibir arquivo Open project: Monobjc/monobjc

Public Methods

Method Description
GetSelector ( MethodBase methodBase ) : String

Gets the selector for the given method.

The selector for a method is build with the following rules: Selector begins with the method name The first parameter if present is appended by its name with the "With" prefix The other parameters if present are appended by their names

Here are some examples of result: Method Corresponding selector public void DoThis() DoThis public void DoThis(int value) DoThisWithValue: public void DoThis(NSString str, int val) DoThisWithStr:val:

GetSignature ( MethodInfo methodInfo ) : String

Gets the signature for the given method.

Here are some examples of result for methods: Method Corresponding signature (on IA32 architecture) public void DoThis() v8@0:4 public void DoThis(int value) v12@0:4i8 public void DoThis(NSString str, int val) v16@0:4@8i12

GetTypeAlignment ( Type type ) : int

Return the native type alignment size used to build selector signature. The value represents the size of the parameter on the stack.

Here are some examples of sizes: Type Corresponding size (on IA32 architecture) bool or Boolean 1 int or Int32 4 NSString 4 NSRect 16

GetTypeEncoding ( Type type ) : String

Return the Objective-C encoding used to build selector signature.

Here are some examples of encoding: Type Corresponding encoding void v int or Int32 i NSString @ int[] ^i NSRect {NSRect={NSPoint=ff}{NSSize=ff}}

For a full list of the encoding, refer to http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_7.html

GetTypeSize ( Type type ) : int

Return the native type size. The value represents the natural size of the type.

Here are some examples of sizes: Type Corresponding size (on IA32 architecture) bool or Boolean 1 int or Int32 4 NSString 4 NSRect 16

Private Methods

Method Description
GetSignature ( MethodInfo methodInfo, int parametersToSkip ) : String

Gets the signature for the given method.

GetTypeAlignmentInternal ( IntPtr type ) : int
GetTypeEncodingInternal ( IntPtr type ) : String
GetTypeSizeInternal ( IntPtr type ) : int

Method Details

GetSelector() public static method

Gets the selector for the given method.

The selector for a method is build with the following rules: Selector begins with the method name The first parameter if present is appended by its name with the "With" prefix The other parameters if present are appended by their names

Here are some examples of result: Method Corresponding selector public void DoThis() DoThis public void DoThis(int value) DoThisWithValue: public void DoThis(NSString str, int val) DoThisWithStr:val:

public static GetSelector ( MethodBase methodBase ) : String
methodBase System.Reflection.MethodBase The method.
return String

GetSignature() public static method

Gets the signature for the given method.

Here are some examples of result for methods: Method Corresponding signature (on IA32 architecture) public void DoThis() v8@0:4 public void DoThis(int value) v12@0:4i8 public void DoThis(NSString str, int val) v16@0:4@8i12

If the method is null.
public static GetSignature ( MethodInfo methodInfo ) : String
methodInfo System.Reflection.MethodInfo The method.
return String

GetTypeAlignment() public static method

Return the native type alignment size used to build selector signature. The value represents the size of the parameter on the stack.

Here are some examples of sizes: Type Corresponding size (on IA32 architecture) bool or Boolean 1 int or Int32 4 NSString 4 NSRect 16

public static GetTypeAlignment ( Type type ) : int
type System.Type The type to measure.
return int

GetTypeEncoding() public static method

Return the Objective-C encoding used to build selector signature.

Here are some examples of encoding: Type Corresponding encoding void v int or Int32 i NSString @ int[] ^i NSRect {NSRect={NSPoint=ff}{NSSize=ff}}

For a full list of the encoding, refer to http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_7.html

public static GetTypeEncoding ( Type type ) : String
type System.Type The type to encode.
return String

GetTypeSize() public static method

Return the native type size. The value represents the natural size of the type.

Here are some examples of sizes: Type Corresponding size (on IA32 architecture) bool or Boolean 1 int or Int32 4 NSString 4 NSRect 16

public static GetTypeSize ( Type type ) : int
type System.Type The type to measure.
return int