简体   繁体   English

定制脱氧预处理器

[英]customizing doxygen preprocessor

I'm new to Doxygen and can't figure out if I am missing a specific step or the code is too difficult for it to parse. 我是Doxygen的新手,无法弄清楚是否错过了特定步骤,或者代码太难解析。 Pretty much every class in this project will #include <common.hpp> , where the following is defined: 该项目中的几乎每个类都将#include <common.hpp> ,其中定义了以下内容:

#define DFS_NAMESPACE_BEGIN namespace dfs {
#define DFS_NAMESPACE_END }

So for example in class Alg/Thing.hpp 因此,例如在类Alg / Thing.hpp中

#ifndef _DFS_ALG_THING_H
#define _DFS_ALG_THING_H

#include <common.hpp>

DFS_NAMESPACE_BEGIN

class Thing {
    ...
};

DFS_NAMESPACE_END

#endif

I've got 我有

  • ENABLE_PREPROCESSING=YES
  • MACRO_EXPANSION=YES
  • EXPAND_ONLY_PREDEF=NO
  • SEARCH_INCLUDES=YES

which based off what the Doxyfile claims should be enough. 这基于Doxyfile声称的内容就足够了。 I've tried explicitly specifiying the common.hpp path, PREDEFINED , turning off SKIP_FUNCTION_MACROS , and a few others without success. 我试着明确specifiying的common.hpp路径, PREDEFINED ,关闭SKIP_FUNCTION_MACROS ,和其他几个人都没有成功。 The best I could get PREDEFINED to give me, though, was instead of class Thing it made it namespace Thing . 不过,我能得到的最好的PREDEFINED不是给class Thing ,而是给它namespace Thing

Namespaces do work as expected if I just write them out instead of using the above define , but I'd like to keep this macro (or perhaps replace it with a similar one?) for readability. 如果我只是写出命名空间而不使用上面的define ,那么命名空间确实可以按预期工作,但是我想保留此宏(或者用类似的宏替换?)以提高可读性。

Is this fixable? 这个可以解决吗? Is there another way to maybe just raw text-replace the DFS_NAMESPACE_* or something? 是否有另一种方法可以仅将原始文本替换为DFS_NAMESPACE_*或其他内容? Thanks for any help! 谢谢你的帮助!

Ok this shouldn't be necessary, but I was able to get it working with 好的,这不是必须的,但是我能够使它与

ENABLE_PREPROCESSING   = YES
MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = YES
PREDEFINED             = DFS_NAMESPACE_BEGIN="namespace dfs {"
PREDEFINED            += DFS_NAMESPACE_END="}"
SEARCH_INCLUDES        = YES
SKIP_FUNCTION_MACROS   = YES

I think I had a problem with the original PREDEFINED enumeration, I escaped it with \\ but I think the leading whitespace may have caused issues? 我想我对原始的PREDEFINED枚举有问题,我用\\对其进行了转义,但是我认为前导空格可能引起了问题?

Just a little frustrating because I don't want to have to enumerate all of the macros I want in the Doxyfile. 有点令人沮丧,因为我不想枚举Doxyfile中想要的所有宏。 Hopefully somebody benefits from this someday though. 希望有人有一天能从中受益。

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

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