终于到了激动人心的时刻了。今天的博客内容将永远消除Visual Studio的本地C++XML注释编译出来的XML文档没有办法生成可读文档的根本原因。
首先介绍一下C++的XML注释。在启用注释之前,我们必须先去工程属性里面,把[C/C++ -> Output Files -> Generate Xml Documentation Files]设置成Yes。这样我们就可以在C++的类啊函数上面写XML注释,然后被编译成一份带有符号链接的XML注释集合。这里先给一个GacUI的XML注释的例子: ///
/// This is the interface for graphics renderers.
///
class IGuiGraphicsRenderer : public Interface
{
public:
///
/// Access the graphics
///
///
virtual IGuiGraphicsRendererFactory* GetFactory()=0;
///
/// Initialize the grpahics renderer by binding a
///
/// The graphics element to bind.
virtual void Initialize(IGuiGraphicsElement* element)=0;
///
/// Release all resources that used by this renderer.
///
virtual void Finalize()=0;
///
/// Set a
///
/// The graphics render target. It can be NULL.
virtual void SetRenderTarget(IGuiGraphicsRenderTarget* renderTarget)=0;
///
/// Render the graphics element using a specified bounds.
///
/// Bounds to decide the size and position of the binded graphics element.
virtual void Render(Rect bounds)=0;
///
/// Notify that the state in the binded graphics element is changed. This function is usually called by the element itself.
///
virtual void OnElementStateChanged()=0;
///
/// Calculate the minimum size using the binded graphics element and its state.
///
///
virtual Size GetMinSize()=0;
};
这个XML注释的格式是Visual Studio的统一格式。无论C++、C#和VB等语言都可以使用。在编译之后会给出下面的一个XML文件: < xml version="1.0" >
"GacUISrc"
Notify that the state in the binded graphics element is changed. This function is usually called by the element itself.
Render the graphics element using a specified bounds.
Bounds to decide the size and position of the binded graphics element.
Set a
The graphics render target. It can be NULL.
Release all resources that used by this renderer.
Initialize the grpahics renderer by binding a
The graphics element to bind.
Access the graphics
This is the interface for graphics renderers.
我们可以看出,C++编译器帮我们把每一个XML注释都标注了一个符号链接的名字,也就是