BCGSoft Professional Editor(BCGPEdit)是一款能讓您將高級編輯控件合併到任何基於MFC的應用程序的MFC擴展庫。這個編輯器支持各種類型的應用程序,從簡單的客戶端到複雜的開發工具都可以集成這款編輯控件。
本文介紹了與CBCGPOutlineParser一起使用的XML文件格式,以及編輯控件的自動概述功能,通過調用
CBCGPEditCtrl::LoadOutlineParserXMLSettings來調用XML解析器。
用於大綱分析器的結構如下:
<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>原創文章,作者:投稿專員,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/225889.html
微信掃一掃
支付寶掃一掃