]> git.draconx.ca Git - gob-dx.git/blobdiff - doc/gob.1.in
Release 0.93.4
[gob-dx.git] / doc / gob.1.in
index a2724c6ead2359ae90eb435348534a8d5d47f73c..5afe3bbc9b5a2313af6818de8614bac7b55f40fd 100644 (file)
@@ -188,14 +188,14 @@ For example:
 .PP
 Data members:
 .PP
-There are four types of data members.  Three of them are normal
-data numbers, and one is a virtual one, usually linked to a normal
-data member.  The three normal data members are public, protected and
-private.  Public and protected are basically just entries in the object
-structure, while private has it's own dynamically allocated private
-structure.  Protected members are always put after the public one in the
-structure and are marked protected in the header file.  There is only one
-identifier allowed per typename unlike in normal C.  Example:
+There are five types of data members.  Three of them are normal data numbers,
+one is class wide (global) in scope and one is a virtual one, usually linked to
+a normal data member or a class wide data member.  The three normal data
+members are public, protected and private.  Public and protected are basically
+just entries in the object structure, while private has it's own dynamically
+allocated private structure.  Protected members are always put after the public
+one in the structure and are marked protected in the header file.  There is
+only one identifier allowed per typename unlike in normal C.  Example:
 .nf
 
   public int i;
@@ -230,6 +230,24 @@ In case you use the \fB--no-private-header\fR option, no
 private header file is created and you can only access the _priv pointer
 below the class definition in the .gob file.
 .PP
+Classwide data members:
+.PP
+Sometimes you want a datamember to be shared by all objects.  You then need
+the "classwide" scope keyword.  So for example the following adds a global
+member foo:
+.nf
+
+  classwide int foo;
+
+.fi
+To access the member you do the standard voodoo of getting the class from the
+object and casting it to your class pointer.  Thus the following would work:
+.nf
+
+  SELF_CLASS(GTK_OBJECT(object)->klass)->foo = 20;
+
+.fi
+.PP
 Automatic Initialization (0.93.0 and higher only):
 .PP
 You can automatically initialize the public private and protected data members