Next: Documenting bison files Prev: Setup and configuration
Many ``C++'' elements may be documented: classes, methods, functions, template classes and functions, typedefs, enums, global variables, nested types, friend and using declarations, anonymous unions and preprocessor defines. A ``C++'' auto comment summary lines start with 3 slashes, and elaboration lines with 2,
/// summary line1 /// summary line 2 /// ... // elaborate line1 // ...For example,
/// this is class X // more on class X class X { public: /// first member void f(int k); ... }; /// typedef unsigned int uint;A non comment or an empty line terminate an auto comment. However you may place a ``C++'' comment between an auto comment and element. For example,
/// this is f // more on f // low level f issues. void f(int x);
@ref{ReferencesTable::addTop(ostream&,const char*,FileInfo const&)}
@ref{ReferencesTable::addTop(const char*,FileInfo const&,uint)}
To reference a template function, use del<> or del<>(vector<T*>*). Use del<>(vector<char*>*) to reference a template specification.
In many cases documentation of an overriding virtual function is the same (or contains) the documentation of that function it replaces in the base class. Keeping 2 (or more) identical copies of the same documentation is bad for the usual reason. d4c&b can't do the copying because there is no guarantee that documentation for the two classes is generated at the same time.
d4c&b instead provides a one click access to the base documentation from the derived class, by hyper-linking the virtual
keyword. (for example, see FileEntries::FreeComment::ref).
To do the above, one must
virtual
keyword in the derived class.
A `@virtual' declaration specifies the base class for virtual functions following it. For example
/// class X { /// f documentation virtual void f(int i); }; /// class Y : X { ... }; /// class Z : public Y { //@virtual X /// virtual void f(int i); };The
@virtual
specification may be omitted when the class is derived directly from exactly one base class. For example
/// class X { /// f documentation virtual void f(int i); }; /// class Y : public X { /// virtual void f(int i); };
@special
as a last resort.
For example,
friend bool operator== /*@*/ __STL_NULL_TMPL_ARGS /*@*/ (const map&, const map&);
/// void f(const char* x);Whenever you have a complex type, introduce a typedef (which I find helpful in any case). An argument name may be omitted when it is trivial to deduce it's absence,
typedef ... name;
typedef ... name[...];
typedef ... ([qualified-name::] [*&] name)(...) [const];
typedef ... qualified-name::* name;
For example, when you use g++ naming results extension.
/// String X::f(void) /*@end*/ return s; { ... } or /// String X::f(void) /*@*/ return s; /*@*/ { ... }
const
in prototype definitionsconst
on the argument before the name. For example, `f(int const x);'
This is the only way that d4c&b, which doesn't parse types, can tell that the const applies to the argument and remove it when constructing the signature. (`f(int)' in the example).
/// float x; /// class X { /// int x; /// @ref{x} void f(void); };The reference will pick
X::x
, just like ``C++'' does.
In addition, d4c&b prefers a class name over a constructor, so that @ref{X}
resolve to class X
X
has a constructor. To reference a constructor, use @ref{X::X}
.
@special
directive, a last resort hack. For example,
/// Set debug topic from command in topic. //@special setDebug $; extern bool LIBFNAME(setDebug) (const char* topic);The
@special
directive is placed immediately before the element, and specifies element name and where element ends. The end specification can simply specify the element suffix (above, this may be `@special setDebug topic)'), or specify characters beyond the element end. In the latter case, a `$' marks the end of the element so that those extra characters are removed from the element description.