简体   繁体   中英

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. Pretty much every class in this project will #include <common.hpp> , where the following is defined:

#define DFS_NAMESPACE_BEGIN namespace dfs {
#define DFS_NAMESPACE_END }

So for example in class 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. I've tried explicitly specifiying the common.hpp path, PREDEFINED , turning off SKIP_FUNCTION_MACROS , and a few others without success. The best I could get PREDEFINED to give me, though, was instead of class Thing it made it 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.

Is this fixable? Is there another way to maybe just raw text-replace the DFS_NAMESPACE_* or something? 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?

Just a little frustrating because I don't want to have to enumerate all of the macros I want in the Doxyfile. Hopefully somebody benefits from this someday though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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