[gobject-introspection] [doc] Document GIErrorDomainInfo methods



commit dfd218e4d488a64947fd2ae088cbff055b289599
Author: Johan Dahlin <johan gnome org>
Date:   Fri May 28 20:49:39 2010 -0300

    [doc] Document GIErrorDomainInfo methods

 girepository/ginfo.c |   47 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
index 7d07bac..cad4635 100644
--- a/girepository/ginfo.c
+++ b/girepository/ginfo.c
@@ -1644,7 +1644,7 @@ g_type_info_get_n_error_domains (GITypeInfo *info)
  * must be a #GI_TYPE_TAG_ERROR or -1 will be returned.
  *
  * Returns: (transfer full): the error domain or %NULL if type tag is wrong,
- * free the struct withg_base_info_unref() when done.
+ * free the struct with g_base_info_unref() when done.
  */
 GIErrorDomainInfo *
 g_type_info_get_error_domain (GITypeInfo *info,
@@ -1673,20 +1673,61 @@ g_type_info_get_error_domain (GITypeInfo *info,
 
 
 /* GIErrorDomainInfo functions */
+
+/**
+ * SECTION:gierrordomaininfo
+ * @Short_description: Struct representing an error domain
+ * @Title: GIErrorDomainInfo
+ *
+ * A GIErrorDomainInfo struct represents a domain of a #GError.
+ * An error domain is associated with a #GQuark and contains a pointer
+ * to an enum with all the error codes.
+ */
+
+/**
+ * g_error_domain_info_get_quark:
+ * @info: a #GIErrorDomainInfo
+ *
+ * Obtain a string representing the quark for this error domain.
+ * %NULL will be returned if the type tag is wrong or if a quark is
+ * missing in the typelib.
+ *
+ * Returns: the quark represented as a string or %NULL
+ */
 const gchar *
 g_error_domain_info_get_quark (GIErrorDomainInfo *info)
 {
   GIRealInfo *rinfo = (GIRealInfo *)info;
-  ErrorDomainBlob *blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
+  ErrorDomainBlob *blob;
+
+  g_return_val_if_fail (info != NULL, NULL);
+  g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
+
+  blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
 
   return g_typelib_get_string (rinfo->typelib, blob->get_quark);
 }
 
+/**
+ * g_error_domain_info_get_codes:
+ * @info: a #GIErrorDomainInfo
+ *
+ * Obtain the enum containing all the error codes for this error domain.
+ * The return value will have a #GIInfoType of %GI_INFO_TYPE_ERROR_DOMAIN
+ *
+ * Returns: (transfer full): the error domain or %NULL if type tag is wrong,
+ * free the struct with g_base_info_unref() when done.
+ */
 GIInterfaceInfo *
 g_error_domain_info_get_codes (GIErrorDomainInfo *info)
 {
   GIRealInfo *rinfo = (GIRealInfo *)info;
-  ErrorDomainBlob *blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
+  ErrorDomainBlob *blob;
+
+  g_return_val_if_fail (info != NULL, NULL);
+  g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
+
+  blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
 
   return (GIInterfaceInfo *) g_info_from_entry (rinfo->repository,
 						rinfo->typelib, blob->error_codes);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]