Add atk-bridge
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_hyperlink.c
index a49f5ab..1eae6ba 100644 (file)
@@ -1,3 +1,26 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
 #include <cspi/spi-private.h>
 
 /**
  * @obj: a pointer to the #AccessibleHyperlink object on which to operate.
  *
  * Increment the reference count for an #AccessibleHyperlink object.
- *
- * Returns: (no return code implemented yet).
- *
  **/
-int
+void
 AccessibleHyperlink_ref (AccessibleHyperlink *obj)
 {
   cspi_object_ref (obj);
-  return 0;
 }
 
-
-
 /**
  * AccessibleHyperlink_unref:
  * @obj: a pointer to the #AccessibleHyperlink object on which to operate.
  *
  * Decrement the reference count for an #AccessibleHyperlink object.
- *
- * Returns: (no return code implemented yet).
- *
  **/
-int
+void
 AccessibleHyperlink_unref (AccessibleHyperlink *obj)
 {
   cspi_object_ref (obj);
-  return 0;
 }
 
 /**
@@ -45,15 +58,21 @@ AccessibleHyperlink_unref (AccessibleHyperlink *obj)
  * @see AccessibleHyperlink_getURI() and AccessibleHyperlink_getObject().
  *
  * Returns: a #long indicating the number of anchors in this hyperlink.
- *
  **/
 long
 AccessibleHyperlink_getNAnchors (AccessibleHyperlink *obj)
 {
-  return (long)
+  long retval;
+
+  cspi_return_val_if_fail (obj != NULL, -1);
+
+  retval =
     Accessibility_Hyperlink__get_nAnchors (CSPI_OBJREF (obj), cspi_ev ());
-}
 
+  cspi_return_val_if_ev ("getNAnchors", -1);
+
+  return retval;
+}
 
 /**
  * AccessibleHyperlink_getURI:
@@ -63,15 +82,22 @@ AccessibleHyperlink_getNAnchors (AccessibleHyperlink *obj)
  * Get the URI associated with a particular hyperlink anchor.  
  *
  * Returns: a UTF-8 string giving the URI of the @ith hyperlink anchor.
- *
  **/
 char *
 AccessibleHyperlink_getURI (AccessibleHyperlink *obj,
-                            long int i)
+                            long int             i)
 {
-  return (char *)
+  char *retval;
+
+  cspi_return_val_if_fail (obj != NULL, NULL);
+
+  retval =
     Accessibility_Hyperlink_getURI (CSPI_OBJREF (obj),
-                                   (CORBA_long) i, cspi_ev ());
+                                   i, cspi_ev ());
+
+  cspi_return_val_if_ev ("getURI", NULL);
+
+  return retval;
 }
 
 /**
@@ -83,15 +109,16 @@ AccessibleHyperlink_getURI (AccessibleHyperlink *obj,
  *
  * Returns: an #Accessible that represents the object associated with the @ith anchor
  *        of the specified #AccessibleHyperlink.
- *
  **/
 Accessible*
 AccessibleHyperlink_getObject (AccessibleHyperlink *obj,
-                               long int i)
+                               long int             i)
 {
+  cspi_return_val_if_fail (obj != NULL, NULL);
+
   return cspi_object_add (
     Accessibility_Hyperlink_getObject (CSPI_OBJREF (obj),
-                                      (CORBA_long) i, cspi_ev ()));
+                                      i, cspi_ev ()));
 }
 
 /**
@@ -105,20 +132,24 @@ AccessibleHyperlink_getObject (AccessibleHyperlink *obj,
  *
  * Get the starting and ending character offsets of the text range associated with
  *       a #AccessibleHyperlink, in its originating #AccessibleHypertext.
- *
  **/
 void
 AccessibleHyperlink_getIndexRange (AccessibleHyperlink *obj,
                                    long int *startIndex,
                                    long int *endIndex)
 {
-  *startIndex = (long)
-    Accessibility_Hyperlink__get_startIndex (CSPI_OBJREF (obj), cspi_ev ());
-  *endIndex = (long)
-    Accessibility_Hyperlink__get_endIndex (CSPI_OBJREF (obj), cspi_ev ());
-}
+  CORBA_long si, ei;
 
+  cspi_return_if_fail (obj != NULL);
 
+si = Accessibility_Hyperlink__get_startIndex (CSPI_OBJREF (obj), cspi_ev ());
+ cspi_return_if_ev ("startIndex");
+ ei = Accessibility_Hyperlink__get_endIndex (CSPI_OBJREF (obj), cspi_ev ());
+
+ cspi_return_if_ev ("endIndex");
+ *startIndex = si;
+ *endIndex = ei; 
+}
 
 /**
  * AccessibleHyperlink_isValid:
@@ -129,13 +160,20 @@ AccessibleHyperlink_getIndexRange (AccessibleHyperlink *obj,
  *
  * Returns: #TRUE of the specified #AccessibleHyperlink is still valid with respect
  *          to its originating #AccessibleHypertext object, #FALSE otherwise.
- *
  **/
 SPIBoolean
 AccessibleHyperlink_isValid (AccessibleHyperlink *obj)
 {
-  return (SPIBoolean)
+  SPIBoolean retval;
+
+  cspi_return_val_if_fail (obj != NULL, FALSE);
+
+  retval =
     Accessibility_Hyperlink_isValid (CSPI_OBJREF (obj), cspi_ev ());
+
+  cspi_return_val_if_ev ("isValid", FALSE);
+
+  return retval;
 }