Noeud:Class Synopsis, Noeud « Next »:Command Synopsis, Noeud « Previous »:Synopsis, Noeud « Up »:Synopsis
ClassSynopsis = ( ( OOClass | OOInterface | OOException )+, ( ClassSynopsisInfo | FieldSynopsis| ConstructorSynopsis | DestructorSynopsis | MethodSynopsis )* ) OOClass = (Modifier*, ClassName) OOInterface = (Modifier*, InterfaceName) OOException = (Modifier*, ExceptionName) ClassName = ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )* InterfaceName = ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )* ExceptionName = ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )* FieldSynopsis = ( Modifier*, Type?, VarName, Initializer? ) ConstructorSynopsis = ( Modifier*, MethodName?, ( MethodParam+ | Void ), ExceptionName* ) DestructorSynopsis = ( Modifier*, MethodName?, ( MethodParam+ | Void ), ExceptionName* ) MethodSynopsis = ( Modifier*, ( Type | Void )?, MethodName, ( MethodParam+ | Void ), ExceptionName*, Modifier* ) Modifier = ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )* Type = ( ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )+ ) VarName = ( ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )+ ) Initializer = ( ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )+ ) MethodName = ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )* MethodParam = ( Modifier*, Type?, ( ( Parameter , Initializer? ) | FuncParams ), Modifier* ) Void = EMPTY ExceptionName = ( #PCDATA | Replaceable | InlineGraphic | InlineMediaObject | IndexTerm )*
Elements : ClassSynopsis
, OOClass
, OOInterface
, OOException
, ClassSynopsisInfo
, FieldSynopsis
, ConstructorSynopsis
, DestructorSynopsis
, MethodSynopsis
, Modifier
, ClassName
, InterfaceName
, ExceptionName
, Type
, VarName
, Initializer
, MethodName
, MethodParam
, Void
, Replaceable
, InlineGraphic
, InlineMediaObject
, IndexTerm
, Parameter
, FuncParams
.
Attributes : Language
, Class
, Choice
, Rep
.
The ClassSynopsis
element is used to give the definition of a class
for an object oriented language, like Java, C++, IDL or Python.
It is not necessary to give the punctuation for the final presentation of
the class definition. The ClassSynopsis
element permits to define a
class regardless of the object oriented language, and the processing
system will be able to present differently this defintion in accordance with
the desired language.
The ClassSynopsis
element can define a class or an interface. For
this, one must use the Class
attribute, which can get the values
Class
and Interface
. The Class
value is the default
one.
The Language
attribute from the ClassSynopsis
element is needed
to define the object oriented language for which the class definition must
be presented. DocBook does not specify specific values for this attribute.
The processing system must give the list of the possible values, as soon as
the default value for this attribute.
The ClassSynopsis
element contains first one or several of the
elements OOClass
, OOInterface
and OOException
. These
elements permit to define respectively the class, superclasses, implemented
interfaces and exceptions raised by the class for a class definition, or the
interface for an interface definition.
Each of these elements OOClass
, OOInterface
and
OOException
contains any number of modifiers (Modifier
),
followed, respectively, by the element ClassName
,
InterfaceName
or ExceptionName
.
The elements Modifier
, ClassName
, InterfaceName
and
ExceptionName
contain any number of the following elements:
#PCDATA
),
Replaceable
element, indicating that the contents must be replaced
by the user,
InlineGraphic
),
InlineMediaObject
),
IndexTerm
).
The ClassSynopsis
element contains then meta-information for a class
synopsis ClassSynopsisInfo
(voir Metainformations).
After that are inserted definitions for fields, constructors, destructor
and class methods, respectively represented by FieldSynopsis
,
ConstructorSynopsis
, DestructorSynopsis
and
MethodSynopsis
. Each class synopsis can contain any number of these
elements, in any order.
A field definition FieldSynopsis
is composed of:
Modifier
),
Type
), optional,
VarName
), mandatory,
Initializer
), optional, giving the initial value for
the variable.
The definitions for the constructors and destructors are composed of:
Modifier
),
MethodName
), optional,
MethodParam
), or composed of the Void
element indicating that
the method does not accept arguments.
ExceptionName
).
In several object languages, the names of the constructors and destructors are identical to the name of the class. It is not necessary, in this case, to declare the name of the method.
A method definition is composed of:
Modifier
),
Type
) or a
non-type (Void
),
MethodName
), mandatory,
MethodParam
), or composed of the Void
element, indicating
that the method does not have parameters.
ExceptionName
),
Modifier
), suffixes this time.
The elements Type
, VarName
, Initializer
contain one or
several of the following elements:
#PCDATA
),
Replaceable
, indicating that the contents must be replaced
by the user,
InlineGraphic
),
InlineMediaObject
),
IndexTerm
).
The elements MethodName
and ExceptionName
contain any number
of the following elements:
#PCDATA
),
Replaceable
, indicating that the contents must be replaced
bythe user,
InlineGraphic
),
InlineMediaObject
),
IndexTerm
).
A method parameter (MethodParam
) is composed of:
Modifier
),
Type
), optional,
Parameter
), followed by an optional initializer
(Initializer
) when the parameter is a variable, or function
parameters (FuncParams
) when the parameter is a pointer to a function.
Modifier
), suffixes.
<classsynopsis language="java" class="interface"> <oointerface> <modifier>public</modifier> <interfacename>Figure</interfacename> </oointerface> <fieldsynopsis> <type>int</type> <varname>dimensions</varname> </fieldsynopsis> <methodsynopsis> <modifier>public</modifier> <modifier>abstract</modifier> <void> <methodname>Draw</methodname> <void> </methodsynopsis> </classsynopsis>
public interface Figure { int dimensions; public abstract void Draw (); }
<classsynopsis language="java" class="interface"> <oointerface> <modifier>public</modifier> <interfacename>FlatFigure</interfacename> </oointerface> <oointerface> <interfacename>Figure</interfacename> </oointerface> <fieldsynopsis> <type>int</type> <varname>dimensions</varname> <initializer>2</initializer> </fieldsynopsis> <methodsynopsis> <modifier>public</modifier> <modifier>abstract</modifier> <void> <methodname>Draw</methodname> <void> </methodsynopsis> </classsynopsis>
public interface FlatFigure extends Figure { int dimensions = 2; public abstract void Draw (); }
<classsynopsis language="java" class="class"> <ooclass> <modifier>public</modifier> <classname>Rectangle</classname> </ooclass> <oointerface> <interfacename>FlatFigure</interfacename> </oointerface> <constructorsynopsis> <methodname>Rectangle</methodname> <methodparam> <type>int</type> <parameter>width</parameter> </methodparam> <methodparam> <type>int</type> <parameter>height</parameter> </methodparam> </constructorsynopsis> </classsynopsis>
public class Rectangle implements FlatFigure { Rectangle (int width, int height); }
<classsynopsis language="java" class="class"> <ooclass> <modifier>public</modifier> <classname><replaceable>class_name</replaceable></classname> </ooclass> <oointerface> <interfacename><replaceable>interface_name</replaceable></interfacename> </oointerface> <constructorsynopsis> <methodname><replaceable>class_name</replaceable></methodname> <methodparam> <type><replaceable>type</replaceable></type> <parameter><replaceable>argument1</replaceable></parameter> </methodparam> <methodparam> <type><replaceable>type</replaceable></type> <parameter><replaceable>argument2</replaceable></parameter> </methodparam> </constructorsynopsis> </classsynopsis>
public class class_name implements interface_name { class_name (type argument1, type argument2); }