HeaderDoc C tag set |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
文法の基本タグはタイプに依存して、1個又は2個のフィールドを持ちます.例えば以下のようになります.@function [FunctionName] @param [parameterName] [Some descriptive text...] @abstractタグと@discussionのタグは他のタグと一緒に使うことができます.例えば以下のようになります. /*! @enum 飲み物のカテゴリ @abstract 飲み物を示す列挙型 @discussion kSodaやkBeer等の定数を使うことができます */
これらのタグはHeaderDocコメントでは必須ではありません.しかしHTML出力のフォーマットすることを改善し、 Function Tags(関数用タグ)
例
/*!
@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 TableOrigin
@discussion スクリーン座標系でのテーブルの左下隅の座標を見つけます
@field x 水平軸の点
@field y 垂直軸の点
*/
struct TableOrigin {
int x;
int y;
}
Enum Tags(列挙型用タグ)
例:
/*!
@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 (型定義)
例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 kCFTypeArrayCallBacks
@discussion Predefined CFArrayCallBacks structure containing a set of
callbacks appropriate...
*/
const CFArrayCallBacks kCFTypeArrayCallBacks;
#define Tags (記号定数用タグ)
例 /*! @defined TRUE @discussion ブーリアンの真を定義してます */ #define TRUE 1 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||