title: Document functions defined through a macro in Doxygen
body: <p>I have a class that does not really exist but is defined through a macro:</p>
  
  <pre><code>#define DEFCLASS(name,datatype) Class name { \
      public: \
          void clear(); \
          datatype obj; \
      };
  DEFMETHOD(StringContainer, const char*)
  </code></pre>
  
  <p>...</p>
  
  <pre><code>StringContainer foo("hi!");
  </code></pre>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>/*!
      \class StringContainer
      \brief A string container
  
      \fn void StringContainer::clear()
      \brief Clears the container
  */
  </code></pre>
  
  <p>I get doxygen warnings:</p>
  
  <pre><code>warning: documented function `StringContainer::clear' was not declared or defined.
  </code></pre>
  
  <p>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?</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>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 <strong>.dox</strong> extension. This way, I'm going to create a .dox file including the class definition and the documentation:</p>
  
  <pre><code>class StringContainer {
  public:
      /*! Removes the contents of the container. */
      void clear();
      const char *obj;
  };
  </code></pre>
  
  <p>This file won't actually be included in the build system and its sole purpose will be for documenting StringContainer.</p>