[mono/mono] caff0556: Provide more public API to inspect MonoTypes, MonoClasses and MonoMethodSignatures.

"Rolf Bjarne Kvinge ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141e736b20b-4a6bcb12-a3b9-4371-a6ad-92467e1876e5-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/0943037e680c...caff05560933

   Commit: caff05560933e12ae34974e63efcdf64a44c19fd
   Author: Rolf Bjarne Kvinge <[email protected]> (rolfbjarne)
     Date: 2013-10-23 21:25:46 GMT
      URL: https://github.com/mono/mono/commit/caff05560933e12ae34974e63efcdf64a44c19fd

Provide more public API to inspect MonoTypes, MonoClasses and MonoMethodSignatures.

Changed paths:
  M mono/metadata/class.c
  M mono/metadata/class.h
  M mono/metadata/metadata.c
  M mono/metadata/metadata.h

Modified: mono/metadata/class.c
===================================================================
@@ -8901,6 +8901,32 @@ class Input<T> {}
 	return NULL;
 }
 
+
+/**
+ * mono_class_is_delegate
+ * @klass: the MonoClass to act on
+ *
+ * Returns: true if the MonoClass represents a System.Delegate.
+ */
+mono_bool
+mono_class_is_delegate (MonoClass *klass)
+{
+	return klass->delegate;
+}
+
+/**
+ * mono_class_implements_interface
+ * @klass: The MonoClass to act on
+ * @interface: The interface to check if @klass implements.
+ *
+ * Returns: true if @klass implements @interface.
+ */
+mono_bool
+mono_class_implements_interface (MonoClass* klass, MonoClass* interface)
+{
+	return mono_class_is_assignable_from (interface, klass);
+}
+
 /**
  * mono_field_get_name:
  * @field: the MonoClassField to act on

Modified: mono/metadata/class.h
===================================================================
@@ -189,6 +189,12 @@
 MONO_API MonoClass*
 mono_class_get_nested_types  (MonoClass* klass, void **iter);
 
+MONO_API mono_bool
+mono_class_is_delegate       (MonoClass* klass);
+
+MONO_API mono_bool
+mono_class_implements_interface (MonoClass* klass, MonoClass* interface);
+
 /* MonoClassField accessors */
 MONO_API const char*
 mono_field_get_name   (MonoClassField *field);

Modified: mono/metadata/metadata.c
===================================================================
@@ -6204,6 +6204,21 @@ guint32 mono_metadata_decode_table_row_col (MonoImage *image, int table, int idx
 }
 
 /**
+ * mono_signature_param_is_out
+ * @sig: the method signature inspected
+ * @param_num: the 0-based index of the inspected parameter
+ * 
+ * Returns: #TRUE if the parameter is an out parameter, #FALSE
+ * otherwise.
+ */
+mono_bool
+mono_signature_param_is_out (MonoMethodSignature *sig, int param_num)
+{
+	g_assert (param_num >= 0 && param_num < sig->param_count);
+	return (sig->params [param_num]->attrs & PARAM_ATTRIBUTE_OUT) != 0;
+}
+
+/**
  * mono_signature_explicit_this:
  * @sig: the method signature inspected
  *

Modified: mono/metadata/metadata.h
===================================================================
@@ -379,6 +379,9 @@ struct _MonoArrayType {
 MONO_API mono_bool
 mono_signature_explicit_this   (MonoMethodSignature *sig);
 
+MONO_API mono_bool
+mono_signature_param_is_out    (MonoMethodSignature *sig, int param_num);
+
 MONO_API uint32_t     mono_metadata_parse_typedef_or_ref (MonoImage      *m,
                                                 const char      *ptr,
                                                 const char     **rptr);


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.