[Overview]

Symbol Markers for HTML-based Documentation

Introduction

As HeaderDoc generates documentation for a set of header files, it injects named anchors (<a name="marker"></a>) into the HTML to mark the location of the documentation for each API symbol. This document describes the composition of these markers.

As you will see, each marker is self describing and can answer questions such as:

With this embedded information, the HTML documentation can be scanned to produce API lists for various purposes. For example, such a list could be used to verify that all declared API has corresponding documentation. Or, the documentation could be scanned to produce indexes of various sorts. The scanning script could as well create hyperlinks from the indexes to the source documentation. In short, these anchors retain at least some of the semantic information that is commonly lost when converting material to HTML format.

The Marker String

A marker string is defined as:

marker := prefix '/' lang-type '/' sym-type '/' sym-value

A marker is a string composed of 4 values separated by '/'. The forward-slash character is used because it is not a legal character in the symbol names for any of the languages we are considering. The prefix defines this marker as conforming to our conventions and helps identify these markers to scanners. The language type defines the language of the symbol. The symbol type defines some semantic information about the symbol (e.g. whether it is a class name or function). The symbol value is a string representing the symbol.

By default, the prefix is:

'//apple_ref'

However, the prefix string can be reassigned using HeaderDoc's configuration file.

The language types are:

'c'              C
'occ'            Objective-C
'java'           Java
'cpp'            C++

The language type defines the language binding of the symbol. Some logical symbols may be available in more than one language. The 'c' language defines symbols which can be called from the C family of languages (C, Objective-C, and C++).

Symbol types for for the 'c' lang:

sym-type             notes
--------             ---------
'tag'                "tag": struct, union, or enum tag
'econst'             "enumerated constant": symbols defined inside an enum
'tdef'               typedef name
'macro'              macro name (without '()')
'data'               global or file-static data
'func'               function name (without '()')

Symbol types for for the languages 'occ', 'java', 'cpp'

sym-type           notes
--------           ---------
'cl'               class name
'intf'             interface or protocol name
'cat'              category name, just for Objective-C
'intfm'            method defined in an interface (or protocol)
'instm'            an instance method
'clm'              a class (or static [in java or c++]) method

Symbol types for for the language 'cpp'

sym-type           notes
--------           ---------
'tmplt'            C++ class template
'ftmplt'           C++ function template
'func'             C++ scoped function (i.e. not extern 'C'); includes return type and signature.

 

Symbol types for for the language 'java'

sym-type           notes
--------           ---------
'clconst'          Java constant values defined inside a class

The symbol value for method names includes the class name.

 

The format for method names for Objective-C is:

			class_name '/' method_name
			e.g.: //apple_ref/occ/instm/NSString/stringWithCString:
		

For methods in Objective-C categories, the category name is not included in the method name marker. The class named used is the class the category is defined on. For example, for the windowDidMove: delegate method on in NSWindow, the marker would be:

e.g.: //apple_ref/occ/intfm/NSObject/windowDidMove:

 

The format for method names for Java and C++ is:
			class_name '/' method_name '/' return_type '/' '(' signature ')'
			e.g.: //apple_ref/java/instm/NSString/stringWithCString/NSString/(char*)
		

For Java and C++, signatures are part of the method name; signatures are enclosed in parens. The algorithm for encoding a signature is:

  1. Remove the parameter name e.g. (Foo *bar, int i) -> (Foo *, int )
  2. Remove spaces e.g. (Foo *, int ) -> (Foo*,int)