文档半岛外围网上直营>>BCGControlBar 中文文档>>XML格式的大纲解析器
XML格式的大纲解析器
本文介绍了与CBCGPOutlineParser一起使用的 XML 文件格式以及编辑控件的自动大纲功能,XML 解析器是通过调用CBCGPEditCtrl::LoadOutlineParserXMLSettings来调用的。
用于大纲解析器的结构如下:
<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"标签定义一般大纲解析器设置。
- “IgnoreOneLineBlocks”标签定义了编辑控件是否应该将一行块视为可折叠的,默认为False。
- "EscapeSequences"标签定义了一个转义序列列表。
- "EscapeSequence"标记表示单个转义序列。
- “BLOCKS”标记用于该语言的语法定义,每个块指定大纲解析器如何找到大纲可折叠区域的规则。当您需要定义一组相同语言语法块的自动概述区域时,它很有用,对于每个块,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>

QQ交谈
在线咨询

渝公网安备
50010702500608号

客服热线