classsynopsis

classsynopsis — The syntax summary for a class definition.

Synopsis

classsynopsis ::=

Attributes

Common attributes and common linking attributes.

Additional attributes:

  • class (enumeration)
    • “class”
    • “interface”
  • language
  • packageref

Additional Constraints

  • If this element is the root element, it must have a version attribute.

Description

A classsynopsis contains the syntax summary of a class (generally speaking, a class in the object-oriented programming language sense).

This is one of the few places where DocBook attempts to model as well as describe. Unlike funcsynopsis, which was designed with C language function prototypes in mind, the content model of classsynopsis was designed to capture a wide range of object-oriented language semantics.

Processing expectations

For the most part, the processing application is expected to generate all of the parentheses, semicolons, commas, and so on required in the rendered synopsis. The exception to this rule is that the spacing and other punctuation inside a parameter that is a pointer to a function must be provided in the source markup.

Attributes

Common attributes and common linking attributes.

any attribute

Any attribute in any other explicit namespace

class

Specifies the nature of the synopsis

Enumerated values:
“class”

This is the synopsis of a class

“interface”

This is the synopsis of an interface

language

Identifies the language (i.e. programming language) of the content

packageref

Identifies the package to which this synopsis (logically) belongs

Parents

These elements contain classsynopsis: abstract, acknowledgements, annotation, answer, appendix, article, bibliodiv, bibliography, bibliolist, blockquote, callout, calloutlist, caption (db.caption), caution, chapter, colophon, constraintdef, cover, danger, dedication, entry, example, figure, footnote, glossary, glossdef, glossdiv, glosslist, important, index, indexdiv, informalexample, informalfigure, itemizedlist, legalnotice, listitem, meta (db.meta.content), msgexplan, msgtext, note, orderedlist, packagesynopsis, para, partintro, preface, procedure, qandadiv, qandaset, question, refsect1, refsect2, refsect3, refsection, refsynopsisdiv, result, revdescription, sect1, sect2, sect3, sect4, sect5, section, setindex, sidebar, simplesect, step, taskprerequisites, taskrelated, tasksummary, td, textobject, th, tip, toc, tocdiv, topic, variablelist, warning.

Children

The following elements occur in classsynopsis: classsynopsisinfo, constructorsynopsis, destructorsynopsis, fieldsynopsis, info (db.titleforbidden.info), methodsynopsis, ooclass, ooexception, oointerface, template, templatename.

Examples

A simple Java class.

 1 |<classsynopsis xmlns="http://docbook.org/ns/docbook" version="5.0"
   |               language="java">
   |<ooclass>
   |<modifier>public</modifier>
 5 |<classname>MyClass</classname>
   |</ooclass>
   |<fieldsynopsis>
   |<modifier>public</modifier>
   |<modifier>static</modifier>
10 |<modifier>final</modifier>
   |<type>int</type>
   |<varname>BASE</varname>
   |<initializer>0</initializer>
   |</fieldsynopsis>
15 |<constructorsynopsis>
   |<modifier>public</modifier>
   |<methodname>MyClass</methodname>
   |<void/>
   |</constructorsynopsis>
20 |<methodsynopsis>
   |<modifier>public</modifier>
   |<void/>
   |<methodname>dwim</methodname>
   |<methodparam>
25 |<type>int</type>
   |<parameter>scope</parameter>
   |</methodparam>
   |</methodsynopsis>
   |</classsynopsis>
public class MyClass {
  public static final int BASE = 0;
  public MyClass();
  public dwim(int scope);
}