HeaderDoc C tag set

TopPage

OCUnit

HeaderDoc

GNUstep

Xcode

EmacsWiki


PageList

ChangeLog

文法の基本
Function Tags(関数用タグ)
Struct and Union Tags(構造体&共用体用タグ)
Enum Tags(列挙型用タグ)
Typedef Tags (型定義)
const Tags(定数修飾子用)
#define Tags (記号定数用タグ)

文法の基本

タグはタイプに依存して、1個又は2個のフィールドを持ちます.例えば以下のようになります.

@function [FunctionName]
@param    [parameterName] [Some descriptive text...]

@abstractタグと@discussionのタグは他のタグと一緒に使うことができます.例えば以下のようになります.

/*!
 @enum       飲み物のカテゴリ
 @abstract   飲み物を示す列挙型
 @discussion kSodaやkBeer等の定数を使うことができます
*/

これらのタグはHeaderDocコメントでは必須ではありません.しかしHTML出力のフォーマットすることを改善し、 InsedeMac のドキュメンテーションデータベースへコメントを登録作業の自動化を手伝います.

Function Tags(関数用タグ)

タグ内容フィールド数
@function関数名1
@param関数の引数名2
@result関数の返り値. 返り値がvoid又ははOSErrである場合は記述しない1

/*! 
 @function        ConstructBLT
 @discussion      引数からサンドイッチ構造体を作成する
 @param      b    Top ingredient, typically protein-rich.
 @param      l    Middle ingredient.
 @param      t    Bottom ingredient, controls tartness.
 @param      mayo A flag controlling addition of condiment. Use YES for condiment,
                  HOLDTHE otherwise.
 @result          A pointer to a Sandwich structure. Caller is responsible for 
                  disposing of this structure.
*/
Sandwich *ConstructBLT (
    Ingredient b;
    Ingredient l;
    Ingredient t;
    Boolean mayo;
);

Struct and Union Tags(構造体&共用体用タグ)

タグ内容フィールド数
@struct / @union構造体又は共用対の名前1
@field構造体のフィールド.2

例:

/*!
  @struct       TableOrigin
  @discussion   スクリーン座標系でのテーブルの左下隅の座標を見つけます
  @field      x 水平軸の点
  @field      y 垂直軸の点
*/
struct TableOrigin {
    int x;
    int y;
}

Enum Tags(列挙型用タグ)

タグ内容フィールド数
@enum列挙形の名前. 名前を持っている場合は列挙形のタグになります.それ以外でドキュメンテーション上で定数をまとめる名前を記述してください.1
@constant列挙形の定数.2

例:

/*!
 @enum       Beverage Categories
 @discussion          Categorizes beverages into groups of similar types.
 @constant   kSoda    Sweet, carbonated, non-alcoholic beverages.
 @constant   kBeer    Light, grain-based, alcoholic beverages.
 @constant   kMilk    Dairy beverages.
 @constant   kWater   Unflavored, non-sweet, non-caloric, non-alcoholic beverages.
*/
enum {
  kSoda  = (1 << 6),
  kBeer  = (1 << 7),
  kMilk  = (1 << 8),
  kWater = (1 << 9)
}

Typedef Tags (型定義)

タグ内容フィールド数
@typedef定義された型の名前1
various@typedefタグの後に現われることができるタグは新しいタイプの定義に依存します.
構造体であれば@field
列挙型であれば@constant
単純な関数ポインターであれば@param
関数ポインターを含む構造体であれば@callback, @param, @result

例1 単純な構造体のTypedef

/*!
 @typedef                TypedefdSimpleStruct
 @abstract               Abstract for this API.
 @discussion             Discussion that applies to the entire
                         typedef'd simple struct.
 @field      firstField  Description of first field
 @field      secondField Description of second field
*/
 
typedef struct _structTag {
    short firstField;
    unsigned long secondField
} TypedefdSimpleStruct;

例2 -列挙形のTypedef

/*!
 @typedef                          TypedefdEnum
 @abstract                         Abstract for this API.
 @discussion                       Discussion that applies to the entire
                                   typedef'd enum.
 @constant   kCFCompareLessThan    Description of first constant.
 @constant   kCFCompareEqualTo     Description of second constant.
 @constant   kCFCompareGreaterThan Description of third constant.
*/
typedef enum {
     kCFCompareLessThan    = -1,
     kCFCompareEqualTo     =  0,
     kCFCompareGreaterThan =  1
} TypedefdEnum;

例3 - 関数ポインターのTypedef

/*!
 @typedef                       simpleCallback
 @abstract                      Abstract for this API.
 @discussion                    Discussion that applies to the entire callback.
 @param      inFirstParameter   Description of the callback's first parameter.
 @param      outSecondParameter Description of the callback's second parameter.
 @result                        Returns what it can when it is possible to do so.
*/
typedef long (*simpleCallback)(short              inFirstParameter,
                               unsigned long long *outSecondParameter);

例4- 関数ポインターを含む構造体のTypedef

/*!
 @typedef                TypedefdStructWithCallbacks
 @abstract               Abstract for this API.
 @discussion             Defines the basic interface for Command
                         DescriptorBlock (CDB)  commands.
 @field      firstField  Description of first field.
 
 @callback   setPointers Specifies the location of the data buffer. 
                         The setPointers function has the following
                         parameters:
 @param      cmd         A pointer to the CDB command interface.
 @param     sgList       A pointer to a scatter/gather list.
 @result                 An IOReturn structure which returns the return
                         value in the structure returned.  
 @field     lastField    Description of the struct's last field.
 */
 typedef struct _someTag {
 	short         firstField;
 	IOReturn      (*setPointers)(void *cmd, IOVirtualRange *sgList);
 	unsigned long lastField
 } TypedefdStructWithCallbacks;

const Tags(定数修飾子用)

タグ内容フィールド数
@const定数の名前1

/*!
 @const      kCFTypeArrayCallBacks
 @discussion Predefined CFArrayCallBacks structure containing a set of 
             callbacks appropriate...
*/
const CFArrayCallBacks kCFTypeArrayCallBacks;

#define Tags (記号定数用タグ)

タグ内容フィールド数
@defined定数の名前1

/*!
 @defined    TRUE
 @discussion ブーリアンの真を定義してます
*/
#define TRUE 1

Updated: 2004-01-01 MindTools