程序员的知识教程库

网站首页 > 教程分享 正文

MFC开发帮助文档:Outline解析器的XML格式

henian88 2024-09-03 14:13:33 教程分享 3 ℃ 0 评论

BCGControlBar ("Business Components Gallery ControlBar")是MFC扩展库,使您可以创建具有完全自定义选项(功能区、可自定义工具栏、菜单等)以及一组专业设计的丰富Microsoft Office和Microsoft Visual Studio的应用程序 GUI控件,例如图表、日历、网格、编辑器、甘特图和许多其他控件。 BCGControlBar库拥有500多个经过全面设计、测试和充分记录的MFC扩展类。 我们的组件可以轻松地集成到您的应用程序中,并为您节省数百个开发和调试时间。

点击“了解更多”获取BCG Pro for MFC v31.0正式版下载

本文介绍了与CBCGPOutlineParser一起使用的XML文件格式以及编辑控件的自动概述功能,通过调用CBCGPEditCtrl::LoadOutlineParserXMLSettings来调用XML解析器。

用于 outline解析器的结构如下:

<SETTINGS>
<OUTLINE_DATA>
<IgnoreOneLineBlocks></IgnoreOneLineBlocks>
<EscapeSequences>
<EscapeSequence></EscapeSequence>
</EscapeSequences>

<BLOCKS>
<BLOCK>
<Start></Start>
<End></End>
<ReplaceString></ReplaceString>
<AllowNestedBlocks></AllowNestedBlocks>
<Ignore></Ignore>
</BLOCK>
</BLOCKS>
</OUTLINE_DATA>
</SETTINGS>

除了主要的“ SETTINGS”标签外,没有其他强制性标签。

"OUTLINE_DATA"标记定义常规outline解析器设置。

  • “ IgnoreOneLineBlocks”标签定义编辑控件是否应将一个行块视为可折叠的,默认为“ False”。
  • "EscapeSequences"标签定义转义序列的列表。
  • “ EscapeSequence”标签表示单个转义序列。
  • “ BLOCKS”标签用于该语言的语法定义,每个块指定规则、outline解析器如何找到outline可折叠区域。当您需要定义一组相同语言语法块的自动 outlining区域时,此方法很有用。 对于每个块,XML解析器将调用CBCGPOutlineParser::AddBlockType。
  • “ BLOCK”标记代表单个块

  • "Start" - 定义BlockType::m_strOpen
  • "End" - 定义BlockType::m_strClose
  • "ReplaceString" - 定义BlockType::m_strReplace,默认情况下为“ ...”
  • "AllowNestedBlocks" - 定义BlockType::m_bAllowNestedBlocks,默认为“ True”
  • "Ignore" - 定义BlockType::m_bIgnore,默认情况下为“ False”
  • C ++的默认XML设置:

    <SETTINGS>
    <OUTLINE_DATA>
    <IgnoreOneLineBlocks>True</IgnoreOneLineBlocks>
    <IncludeSpaceLines>True</IncludeSpaceLines>
    <EscapeSequences>
    <EscapeSequence>\\\"</EscapeSequence>
    </EscapeSequences>
    <BLOCKS>
    <BLOCK>
    <Start>\\\"</Start>
    <End></End>
    <ReplaceString></ReplaceString>
    <AllowNestedBlocks>False</AllowNestedBlocks>
    <Ignore>True</Ignore>
    </BLOCK>
    
    <BLOCK>
    <Start>\"</Start>
    <End>\"</End>
    <ReplaceString>\"\"</ReplaceString>
    <AllowNestedBlocks>False</AllowNestedBlocks>
    <Ignore>True</Ignore>
    </BLOCK>
    
    <BLOCK>
    <Start>{</Start>
    <End>}</End>
    <ReplaceString>..</ReplaceString>
    <KEYWORDS>
    <Keyword>else</Keyword>
    <Keyword>struct</Keyword>
    <Keyword>enum</Keyword>
    <Keyword>switch</Keyword>
    <Keyword>catch</Keyword>
    <Keyword>try</Keyword>
    <Keyword>for</Keyword>
    <Keyword>operator</Keyword>
    <Keyword>class</Keyword>
    <Keyword>if</Keyword>
    <Keyword>union</Keyword>
    <Keyword>do</Keyword>
    <Keyword>while</Keyword>
    <Keyword>namespace</Keyword>
    </KEYWORDS>
    </BLOCK>
    
    <BLOCK>
    <Start>{</Start>
    <End>}</End>
    <ReplaceString>...</ReplaceString>
    </BLOCK>
    
    <BLOCK>
    <Start>//</Start>
    <End>\n</End>
    <ReplaceString>/**/</ReplaceString>
    <AllowNestedBlocks>False</AllowNestedBlocks>
    </BLOCK>
    
    <BLOCK>
    <Start>/*</Start>
    <End>*/</End>
    <ReplaceString>/**/</ReplaceString>
    <AllowNestedBlocks>False</AllowNestedBlocks>
    </BLOCK>
    </BLOCKS>
    </OUTLINE_DATA>
    </SETTINGS>

    Tags:

    本文暂时没有评论,来添加一个吧(●'◡'●)

    欢迎 发表评论:

    最近发表
    标签列表