文檔首頁>>BCGControlBar 中文文檔>>XML格式的大綱解析器
XML格式的大綱解析器
立即下載BCGControlBar Professional Edition for MFC
本文描述與CBCGPOutlineParser和編輯控件的自動概述特性一起使用的XML文件格式,XML解析器通過調(diào)用CBCGPEditCtrl::LoadOutlineParserXMLSettings來調(diào)用。
大綱解析器使用的結(jié)構(gòu)如下:
<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"標簽定義一般大綱解析器設(shè)置。
- IgnoreOneLineBlocks”標簽定義了編輯控件是否應(yīng)該將一行塊視為可折疊的,默認為False。
- "EscapeSequences"標簽定義了一個轉(zhuǎn)義序列列表。
- "EscapeSequence"標記表示單個轉(zhuǎn)義序列。
- “BLOCKS”標記用于該語言的語法定義,每個塊指定大綱解析器如何找到大綱可折疊區(qū)域的規(guī)則。當您需要定義一組相同語言語法塊的自動概述區(qū)域時,它很有用,對于每個塊,XML解析器將調(diào)用CBCGPOutlineParser::AddBlockType。
-
BLOCK”標簽代表單個塊
- "Start" - defines BlockType::m_strOpen
- "End" - defines BlockType::m_strClose
- "ReplaceString" - defines BlockType::m_strReplace, "..." by default
- "AllowNestedBlocks" - defines BlockType::m_bAllowNestedBlocks, "True" by default
- "Ignore" - defines BlockType::m_bIgnore, "False" by default
C++的默認XML設(shè)置:
<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>