当前位置:编程学习 > XML/UML >>

合并Visual Studio本地C++XML注释文档和PDB的符号内容

终于到了激动人心的时刻了。今天的博客内容将永远消除Visual Studio的本地C++XML注释编译出来的XML文档没有办法生成可读文档的根本原因。

    首先介绍一下C++的XML注释。在启用注释之前,我们必须先去工程属性里面,把[C/C++ -> Output Files -> Generate Xml Documentation Files]设置成Yes。这样我们就可以在C++的类啊函数上面写XML注释,然后被编译成一份带有符号链接的XML注释集合。这里先给一个GacUI的XML注释的例子:             /// <summary>
            /// This is the interface for graphics renderers.
            /// </summary>
            class IGuiGraphicsRenderer : public Interface
            {
            public:
                /// <summary>
                /// Access the graphics <see cref="IGuiGraphicsRendererFactory"></see> that is used to create this graphics renderer.
                /// </summary>
                /// <returns>Returns the related factory.</returns>
                virtual IGuiGraphicsRendererFactory*    GetFactory()=0;

                /// <summary>
                /// Initialize the grpahics renderer by binding a <see cref="IGuiGraphicsElement"></see> to it.
                /// </summary>
                /// <param name="element">The graphics element to bind.</param>
                virtual void                            Initialize(IGuiGraphicsElement* element)=0;
                /// <summary>
                /// Release all resources that used by this renderer.
                /// </summary>
                virtual void                            Finalize()=0;
                /// <summary>
                /// Set a <see cref="IGuiGraphicsRenderTarget"></see> to this element.
                /// </summary>
                /// <param name="renderTarget">The graphics render target. It can be NULL.</param>
                virtual void                            SetRenderTarget(IGuiGraphicsRenderTarget* renderTarget)=0;
                /// <summary>
                /// Render the graphics element using a specified bounds.
                /// </summary>
                /// <param name="bounds">Bounds to decide the size and position of the binded graphics element.</param>
                virtual void                            Render(Rect bounds)=0;
                /// <summary>
                /// Notify that the state in the binded graphics element is changed. This function is usually called by the element itself.
                /// </summary>
                virtual void                            OnElementStateChanged()=0;
                /// <summary>
                /// Calculate the minimum size using the binded graphics element and its state.
                /// </summary>
                /// <returns>The minimum size.</returns>
                virtual Size                            GetMinSize()=0;
            };
    这个XML注释的格式是Visual Studio的统一格式。无论C++、C#和VB等语言都可以使用。在编译之后会给出下面的一个XML文件: <?xml version="1.0"?>
<doc>
    <assembly>
        "GacUISrc"
    </assembly>
    <members>
       
        <member name="M:vl.presentation.elements.IGuiGraphicsRenderer.GetMinSize">
            <summary>
Calculate the minimum size using the binded graphics element and its state.
</summary>
            <returns>The minimum size.</returns>
        </member>
        <memb

补充:软件开发 , C++ ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,