Enlightenment CVS committal

Author  : mej
Project : eterm
Module  : libast

Dir     : eterm/libast/include/libast


Modified Files:
        obj.h 


Log Message:
Fri Oct 31 15:21:53 2003                        Michael Jennings (mej)

Fixes to string class find/splice routines.

Added SPIF_DEFINE_PROPERTY_FUNC_NONOBJ() macro for defining get/set
methods of a property which is not an object.  It should be used in
place of SPIF_DEFINE_PROPERTY_FUNC() for spif_*_t types that are not
objects, such as spif_int32_t and spif_sockport_t.

===================================================================
RCS file: /cvsroot/enlightenment/eterm/libast/include/libast/obj.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- obj.h       30 Oct 2003 23:13:53 -0000      1.19
+++ obj.h       31 Oct 2003 20:23:25 -0000      1.20
@@ -197,8 +197,35 @@
 /**
  * Define the get/set methods of a "property" of an object.
  *
- * This macro is used to define (i.e., create, i.e. insert the code
- * for) the get/set methods of an object property.
+ * This macro is identical to SPIF_DEFINE_PROPERTY_FUNC(), except that
+ * the property is treated as a non-object (i.e., its current value is
+ * not checked, so no destructor is called for the current value).
+ * Use this for spif_*_t types that are not objects, such as
+ * spif_int32_t and spif_sockport_t.
+ *
+ * @param otype The type of the object.
+ * @param vtype The type of the property variable.
+ * @param name  The name of the property.
+ *
+ * @see DOXGRP_OBJ, SPIF_DEFINE_PROPERTY_FUNC()
+ */
+#define SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(otype, vtype, name)  \
+  SPIF_TYPE(vtype) spif_ ## otype ## _get_ ## name (SPIF_TYPE(otype) self) \
+    { return ((SPIF_OBJ_IS_TYPE(self, otype)) ? (self-> ## name) : (SPIF_CAST(vtype) 
(0))); } \
+  SPIF_TYPE(bool) spif_ ## otype ## _set_ ## name (SPIF_TYPE(otype) self, 
SPIF_TYPE(vtype) new_ ## name) \
+    { \
+        if (!SPIF_OBJ_IS_TYPE(self, otype)) { \
+            return FALSE; \
+        } \
+        self-> ## name = new_ ## name; \
+        return TRUE; \
+    }
+
+/**
+ * Define the get/set methods of a "property" of an object.
+ *
+ * This macro is identical to SPIF_DEFINE_PROPERTY_FUNC(), except that
+ * a native C type is used.
  *
  * @param otype The type of the object.
  * @param vtype The C type of the property variable.




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to