4

Doxygen はバージョン 1.7.2 の変更ログで、Apple のブロック拡張機能をサポートすることを発表しました。ドキュメントを生成するための構文は何なのだろうか。ヒントは見つかりませんでした-doxygen構成ファイル(バージョン1.7.2)にもありません。
更新: 2011 年 8 月 14 日にバージョン 1.7.5 がリリースされました。それでも、Apple ブロックのドキュメントの書き方がわかりませんでした。

4

2 に答える 2

1

1.7.1 と 1.7.2 の差分を見ると、この行が意味しているのは、ブロック型のtypedefを認識する際に、Doxygen スキャナーが Apple のブロック構文をサポートするように更新されたことだと思います。たとえば、次のように関数ポインタ typedef を文書化できます。

///
/// This is a typedef for a function pointer type. 
/// It takes an NSUInteger parameter, an id adopting protocol Foo, and has no return value.
/// 
typedef void (*MyFunctionPtrType)(NSUInteger p1, id<Foo> p2);

次のような出力を取得します。

関数ポインター typedef の Doxygen 出力

スキャナーの変更により、次のようなブロック typedef のサポートが追加されたようです。

///
/// This is a typedef for a block type. 
/// It takes an NSUInteger parameter, an id adopting protocol Foo, and has no return value.
/// 
typedef void (^MyBlockType)(NSUInteger p1, id<Foo> p2);

実際、最近のバージョンの Doxygen では、次のような出力が生成されます。

ブロック typedef の Doxygen 出力

ブロック型のグローバル変数を文書化することはできますが、動作は少し不安定です。たとえば、これで:

///
/// This is a global variable of type MyBlockType. It logs the parameters to the console.
///
MyBlockType myGlobalBlock = ^(NSUInteger p1, id<Foo> p2){

    /**
     * This is a block comment inside my block, which would get 
     * concatted into the "in body" description if this were a function.
     * but won't be because this is a block.
     */
    NSLog(@"p1: %lu p2: %@", p1, p2);
};

///
/// This is the definition for the function MyFunction
/// 
void MyFunction(NSUInteger p1, id<Foo> p2)
{
    /**
     * This is a block comment inside my function, which will get 
     * concatted into the "in body" description.
     */

    NSLog(@"p1: %lu p2: %@", p1, p2);
}

私はこの出力を取得しますが、これは私が望むものではありません:

関数と比較したグローバル ブロック型変数の Doxygen 出力

幸いなことに、ブロック型のグローバル変数は実際にはそれほど一般的なパターンではないと思うので、Doxygen がそれらを処理するのにそれほど優れていないという事実は、それほど大きな問題ではありません。diff 内のブロックのサポートがさらに追加されたという証拠はないようです。

于 2011-12-23T19:20:12.387 に答える