[Xfce4-commits] <glib-objc:no-foundation-dep> add private -storage method to GOCNumber/Value

Brian J. Tarricone noreply at xfce.org
Sun Nov 22 04:02:15 CET 2009


Updating branch refs/heads/no-foundation-dep
         to 07cbb4c44fad8967ee24c9db4393349d4501dd4e (commit)
       from 90c17545bc9353440cbb17f8d1a8c5db712ad49d (commit)

commit 07cbb4c44fad8967ee24c9db4393349d4501dd4e
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Fri Jul 10 13:24:52 2009 -0700

    add private -storage method to GOCNumber/Value

 .../GOCNumber+GOCPrivate.h                         |   17 +++-----
 gobject-objc/GOCNumber.m                           |   45 ++++++++++++++++++++
 .../GOCValue+GOCPrivate.h                          |   16 +++----
 gobject-objc/GOCValue.m                            |   20 +++++++++
 4 files changed, 77 insertions(+), 21 deletions(-)

diff --git a/glib-objc/GOCIterable.h b/gobject-objc/GOCNumber+GOCPrivate.h
similarity index 81%
copy from glib-objc/GOCIterable.h
copy to gobject-objc/GOCNumber+GOCPrivate.h
index 5e15e9e..19fc28c 100644
--- a/glib-objc/GOCIterable.h
+++ b/gobject-objc/GOCNumber+GOCPrivate.h
@@ -17,20 +17,15 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-#ifndef __GOC_ITERABLE_H__
-#define __GOC_ITERABLE_H__
+#ifndef __GOC_NUMBER__GOC_PRIVATE__
+#define __GOC_NUMBER__GOC_PRIVATE__
 
- at protocol GOCIter
+#import "GOCNumber.h"
 
-- (id <GOCObject>)next;
+ at interface GOCNumber (GOCPrivate)
 
- at end
-
- at protocol GOCIterable
-
-- (id <GOCIter>)getIter;
+- (const void *)storage;
 
 @end
 
-
-#endif  /* __GOC_ITERABLE_H__ */
+#endif   /* __GOC_NUMBER__GOC_PRIVATE__ */
diff --git a/gobject-objc/GOCNumber.m b/gobject-objc/GOCNumber.m
index b7beb0d..354ceaf 100644
--- a/gobject-objc/GOCNumber.m
+++ b/gobject-objc/GOCNumber.m
@@ -26,6 +26,8 @@
 #include <glib.h>
 
 #import "GOCNumber.h"
+#import "GOCValue+GOCPrivate.h"
+#import "GOCNumber+GOCPrivate.h"
 
 @implementation GOCNumber
 
@@ -519,3 +521,46 @@ struct _GOCNumberPriv
 }
 
 @end
+
+
+ at implementation GOCNumber (GOCPrivate)
+
+- (const void *)storage
+{
+    switch(type) {
+        case GN_TYPE_BOOL:
+            return &gnpriv->data.b;
+        case GN_TYPE_UCHAR:
+            return &gnpriv->data.uc;
+        case GN_TYPE_CHAR:
+            return &gnpriv->data.c;
+        case GN_TYPE_USHORT:
+            return &gnpriv->data.us;
+        case GN_TYPE_SHORT:
+            return &gnpriv->data.s;
+        case GN_TYPE_UINT:
+            return &gnpriv->data.ui;
+        case GN_TYPE_INT:
+            return &gnpriv->data.i;
+        case GN_TYPE_ULONG:
+            return &gnpriv->data.ul;
+        case GN_TYPE_LONG:
+            return &gnpriv->data.l;
+        case GN_TYPE_UINT64:
+            return &gnpriv->data.ull;
+        case GN_TYPE_INT64:
+            return &gnpriv->data.ll;
+        case GN_TYPE_FLOAT:
+            return &gnpriv->data.f;
+        case GN_TYPE_DOUBLE:
+            return &gnpriv->data.d;
+        case GN_TYPE_ENUM:
+            return &gnpriv->data.i;
+        case GN_TYPE_FLAGS:
+            return &gnpriv->data.ui;
+    }
+
+    return [super storage];
+}
+
+ at end
diff --git a/glib-objc/GOCIterable.h b/gobject-objc/GOCValue+GOCPrivate.h
similarity index 81%
copy from glib-objc/GOCIterable.h
copy to gobject-objc/GOCValue+GOCPrivate.h
index 5e15e9e..b7b6a8d 100644
--- a/glib-objc/GOCIterable.h
+++ b/gobject-objc/GOCValue+GOCPrivate.h
@@ -17,20 +17,16 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-#ifndef __GOC_ITERABLE_H__
-#define __GOC_ITERABLE_H__
+#ifndef __GOC_VALUE__GOC_PRIVATE__
+#define __GOC_VALUE__GOC_PRIVATE__
 
- at protocol GOCIter
+#import "GOCValue.h"
 
-- (id <GOCObject>)next;
+ at interface GOCValue (GOCPrivate)
 
- at end
-
- at protocol GOCIterable
-
-- (id <GOCIter>)getIter;
+- (const void *)storage;
 
 @end
 
+#endif   /* __GOC_VALUE__GOC_PRIVATE__ */
 
-#endif  /* __GOC_ITERABLE_H__ */
diff --git a/gobject-objc/GOCValue.m b/gobject-objc/GOCValue.m
index d6fb1c3..71e038c 100644
--- a/gobject-objc/GOCValue.m
+++ b/gobject-objc/GOCValue.m
@@ -24,6 +24,7 @@
 #include <glib.h>
 
 #import "GOCValue.h"
+#import "GOCValue+GOCPrivate.h"
 
 @implementation GOCValue
 
@@ -148,3 +149,22 @@ struct _GOCValuePriv
 }
 
 @end
+
+
+ at implementation GOCValue (GOCPrivate)
+
+- (const void *)storage
+{
+    switch(type) {
+        case GV_TYPE_VOID:
+            return NULL;
+        case GV_TYPE_OBJECT:
+            return &gvpriv->data.o;
+        case GV_TYPE_POINTER:
+            return &gvpriv->data.p;
+    }
+
+    return NULL;
+}
+
+ at end



More information about the Xfce4-commits mailing list