I have a class that does not really exist but is defined through a macro:
#define DEFCLASS(name,datatype) Class name { \
public: \
void clear(); \
datatype obj; \
};
DEFMETHOD(StringContainer, const char*)
...
StringContainer foo("hi!");
Of course it should have been implemented using templates but I didn't write it, I can't change it and a large codebase relies on it.
Now the question is, I would like to document StringContainer in doxygen. However, it's not a class that really exists, so if I do:
/*!
\class StringContainer
\brief A string container
\fn void StringContainer::clear()
\brief Clears the container
*/
I get doxygen warnings:
warning: documented function `StringContainer::clear' was not declared or defined.
And the documentation doesn't contain that function. I know it's a bit tricky, but is there any way to force doxygen to have "faith" and create the documentation for StringContainer even though it's not defined in the source code?
SOLUTION
It is possible to create fake .h files to make doxygen believe a class exists while preventing build systems from including it. Those files can have the .dox extension. This way, I'm going to create a .dox file including the class definition and the documentation:
class StringContainer {
public:
/*! Removes the contents of the container. */
void clear();
const char *obj;
};
This file won't actually be included in the build system and its sole purpose will be for documenting StringContainer.