X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/3b10bbd3a88d6e16146414d91d06bb2f36347bfc..4f7cfa972623842e64e3a8468696f1f6f40fd202:/doc/gob.1.in diff --git a/doc/gob.1.in b/doc/gob.1.in index df1472b..5afe3bb 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -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 @@ -508,6 +526,22 @@ The onerror value is also used in overrides that have a return value, in case there isn't a parent method, PARENT_HANDLER will return it. More about this later. .PP +Default return: +.PP +Some signal and virtual methods have a return type. But what happens if +there is no default handler and no one connects to a signal. GOB will +normally have the wrappers return whatever you specify with onerror or '0' +if you haven't specified anything. But since 0.93.2 you can specify a default +return value with the keyword 'defreturn'. It's use is identical to the +use of onerror, and you can in fact use both at the same time. Example +.nf + + virtual int get_some_int(self) onerror -1 defreturn 10 ; + +.fi +That is an empty virtual method (in C++ terms a pure virtual). If you never +specify any handler for it in the derived children it will just return 10. +.PP Constructor methods: .PP There are two methods that handle the construction of an object, init and