简体   繁体   English

使用dOxygen记录具有指定指针的typedef结构?

[英]Documenting a typedef'd struct with specified pointer using dOxygen?

I have a struct something like: 我有一个类似的结构:

/**
*  Typical dOxygen brief about the typedef. Longer description follows.
*/
typedef struct _SOME_STRUCT_TAG {
    int var1; /**< Something useful. */
    int var2; /**< something equally useful. */
} SOME_STRUCT_T, *LPSOME_STRUCT_T /**< A post doc the pointer here. Longer description follows */;

I've enabled the project option TYPEDEF_HIDES_STRUCT. 我已启用项目选项TYPEDEF_HIDES_STRUCT。

I'd like the documentation to create two separate entries: one for the pointer typedef and one for the non-pointer typedef. 我希望文档创建两个单独的条目:一个用于指针typedef,一个用于非指针typedef。 Currently, I only seem to get one for the pointer typedef. 目前,我似乎只为指针typedef获得了一个。

What am I doing wrong here? 我在这里做错了什么? I'm also open to general syntax suggestions. 我也欢迎一般语法建议。 Note this is for a C library, not C++. 请注意,这是针对C库的,而不是针对C ++的。 It seems dOxygen has trouble dealing with a typedef which has multiple statements (ie typedef int var_t,*pvar_t ). 这似乎doxygen的有一个处理一个麻烦typedef其中有多个语句(即typedef int var_t,*pvar_t )。

IIRC, doxygen doesn't support different documentation for multiple identifiers in a single declaration at all. IIRC,doxygen根本不支持在单个声明中提供多个标识符的不同文档。 So separate them. 所以分开他们。

Instead of 代替

int a, b, c;

use 采用

int a;
int b;
int c;

and instead of 而不是

typedef struct _SOME_STRUCT_TAG {
    int var1; /**< Something useful. */
    int var2; /**< something equally useful. */
} SOME_STRUCT_T, *LPSOME_STRUCT_T;

use 采用

typedef struct _SOME_STRUCT_TAG {
    int var1; /**< Something useful. */
    int var2; /**< something equally useful. */
} SOME_STRUCT_T;
typedef SOME_STRUCT_T *LPSOME_STRUCT_T;

Also note that you're using reserved words for struct and typedef names, which is inviting trouble, not only from doxygen. 还要注意,您正在为结构和typedef名称使用保留字,这不仅给doxygen带来了麻烦,而且会引起麻烦。

Also, this practice of transparent typedef names for pointers is bad style. 同样,这种为指针使用透明typedef名称的做法也是不好的做法。 If the pointer type is an opaque handle and clients will never see the underlying type, or even know that the handle is a pointer (as opposed to a table index or other key), use a typedef. 如果指针类型是不透明的句柄,并且客户端将永远看不到基础类型,或者甚至不知道该句柄是指针(与表索引或其他键相对),请使用typedef。 If the client works directly with the structure, let them use SOME_STRUCT_T * . 如果客户端直接使用该结构,则让他们使用SOME_STRUCT_T *

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM