![vs2008注釋宏_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6041.gif)
![vs2008注釋宏_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6042.gif)
![vs2008注釋宏_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6043.gif)
![vs2008注釋宏_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6044.gif)
![vs2008注釋宏_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6045.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Imports SystemImports EnvDTEImports EnvDTE80Imports EnvDTE90Imports System.DiagnosticsPublic Module COMMENT Function StripTabs(ByVal MyStr) Do While InStr(MyStr, vbTab) <> 0 MyStr = Right(MyStr, Len(MyStr) - InStr(MyStr, vbTab) Loop StripTabs = Trim(MyStr) End Function '生成Doxygen樣式的函數(shù)注釋 Pu
2、blic Sub FunctionDescription() '判斷所選擇的行 Dim StartLine, endLine, Temp, tmpLine, Header, Reti, Loc, RetTp, Loc2, fcName, iPrm, iPrmA, prms, ParamArr, Last StartLine = ActiveDocument.Selection.TopLine endLine = ActiveDocument.Selection.BottomLine If endLine < StartLine Then Temp = StartLine Star
3、tLine = endLine endLine = Temp End If '如果行數(shù)大于1,則將各行的字符串合成一個(gè)字符串 tmpLine = StartLine Do While tmpLine <= endLine ActiveDocument.Selection.GoToLine(tmpLine) ActiveDocument.Selection.SelectLine() Header = Header & StripTabs(Trim(ActiveDocument.Selection.text) tmpLine = tmpLine + 1 Loop '把
4、回車換成空格 Header = Replace(Header, vbCrLf, " ") ActiveDocument.Selection.GoToLine(StartLine) If Header <> "" Then Reti = InStr(Header, " ") Loc = InStr(Header, "(") If Reti < Loc Then RetTp = Left(Header, Reti) Header = Right(Header, Len(Header) - Reti)
5、End If Loc = InStr(Header, "(") - 1 Loc2 = InStr(Header, ")") If Loc > 0 And Loc2 > 0 Then fcName = Left(Header, Loc) Header = Right(Header, Len(Header) - Len(fcName) Trim(fcName) '得到函數(shù)名稱 Do While InStr(fcName, " ") <> 0 RetTp = RetTp + Left(fcName, InSt
6、r(fcName, " ") fcName = Right(fcName, Len(fcName) - InStr(fcName, " ") Loop '如果函數(shù)名稱第一個(gè)字符為"*"或"&",則做為返回值最后一個(gè)字符 If InStr(fcName, "*") = 1 Then RetTp = RTrim(RetTp) + "*" fcName = LTrim(Right(fcName, Len(fcName) - 1) End If If InStr(fc
7、Name, "&") = 1 Then RetTp = RTrim(RetTp) + "&" fcName = LTrim(Right(fcName, Len(fcName) - 1) End If '對(duì)返回值進(jìn)行處理 '去掉virtual If InStr(RetTp, "virtual") <> 0 Then RetTp = LTrim(Right(RetTp, Len(RetTp) - Len("virtual") End If '去掉inline If I
8、nStr(RetTp, "inline") <> 0 Then RetTp = LTrim(Right(RetTp, Len(RetTp) - Len("inline") End If '去掉static If InStr(RetTp, "static") <> 0 Then RetTp = LTrim(Right(RetTp, Len(RetTp) - Len("static") End If iPrm = 0 iPrmA = 0 prms = Header Do While In
9、Str(prms, ",") <> 0 iPrm = iPrm + 1 prms = Right(prms, Len(prms) - InStr(prms, ",") Loop If iPrm > 0 Then iPrm = iPrm + 1 iPrmA = iPrm ReDim ParamArr(iPrm) Do While InStr(Header, ",") <> 0 ParamArr(iPrm) = Left(Header, InStr(Header, ",") - 1) If
10、 InStr(ParamArr(iPrm), " (") <> 0 Then ParamArr(iPrm) = Right(ParamArr(iPrm), _ Len(ParamArr(iPrm) - InStr(ParamArr(iPrm), " (") Trim(ParamArr(iPrm) End If Header = Right(Header, Len(Header) - InStr(Header, ",") iPrm = iPrm - 1 Loop ParamArr(iPrm) = Header If InSt
11、r(ParamArr(iPrm), ")") <> 0 Then ParamArr(iPrm) = Left(ParamArr(iPrm), InStr(ParamArr(iPrm), ")") - 1) Trim(ParamArr(iPrm) End If Else ReDim ParamArr(1) Header = Right(Header, Len(Header) - 1) Trim(Header) ParamArr(1) = StripTabs(Header) If InStr(ParamArr(1), ")")
12、 <> 1 Then ParamArr(1) = Left(ParamArr(1), InStr(ParamArr(1), ")") - 1) Trim(ParamArr(1) iPrmA = 1 If ParamArr(1) = "void" Then iPrmA = 0 End If End If End If If ActiveDocument.Selection.CurrentLine <> 1 Then ActiveDocument.Selection.GoToLine(ActiveDocument.Selection.
13、CurrentLine - 1) ActiveDocument.Selection.MoveTo(ActiveDocument.Selection.CurrentLine, 0) ActiveDocument.Selection.EndOfLine() ActiveDocument.Selection.NewLine() End If ActiveDocument.Selection.text = "/* " ActiveDocument.Selection.NewLine() '判斷是構(gòu)造函數(shù)還是析構(gòu)函數(shù) If Len(Trim(RetTp) > 0 The
14、n ActiveDocument.Selection.text = "* brief " + fcName + " " Else '為構(gòu)造函數(shù) If InStr(fcName, "") <> 0 Then ActiveDocument.Selection.text = "* brief " + "Destructor for " + Right(fcName, Len(fcName) - 1) + "." '為析構(gòu)函數(shù) Else ActiveDoc
15、ument.Selection.text = "* brief " + "Constructor for " + fcName + "." End If End If ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* Detailed description." L
16、ast = iPrmA Do While iPrmA <> 0 If InStr(ParamArr(iPrmA), vbLf) <> 0 Then ParamArr(iPrmA) = Right(ParamArr(iPrmA), (Len(ParamArr(iPrmA) - _ InStr(ParamArr(iPrmA), vbLf) Trim(ParamArr(iPrmA) End If ParamArr(iPrmA) = StripTabs(ParamArr(iPrmA) If iPrmA = Last And Last <> 1 Then ParamA
17、rr(iPrmA) = Right(ParamArr(iPrmA), Len(ParamArr(iPrmA) - 1) End If ActiveDocument.Selection.NewLine() '首先判斷參數(shù)列表中有沒有'='號(hào),如果有,則等號(hào)左邊為參數(shù)名,右邊為默認(rèn)值。 Dim defautValue If InStr(ParamArr(iPrmA), "=") <> 0 Then defautValue = LTrim(Right(ParamArr(iPrmA), Len(ParamArr(iPrmA) - InStr(Pa
18、ramArr(iPrmA), "=") ParamArr(iPrmA) = RTrim(Left(ParamArr(iPrmA), InStr(ParamArr(iPrmA), "=") - 1) End If Do While InStr(defautValue, " ") <> 0 defautValue = Right(defautValue, Len(defautValue) - InStr(defautValue, " ") Loop Do While InStr(ParamArr(iPrmA
19、), " ") <> 0 ParamArr(iPrmA) = Right(ParamArr(iPrmA), Len(ParamArr(iPrmA) - InStr(ParamArr(iPrmA), " ") Loop '如果形參形如std:string &name時(shí),應(yīng)該將引用符號(hào)放到前邊 If InStr(ParamArr(iPrmA), "*") = 1 Or InStr(ParamArr(iPrmA), "&") = 1 Then ParamArr(iPrmA) = LTr
20、im(Right(ParamArr(iPrmA), Len(ParamArr(iPrmA) - 1) End If If Len(Trim(defautValue) > 0 Then ActiveDocument.Selection.text = "* paramin " + LTrim(ParamArr(iPrmA) + " Defaults to " + Trim(defautValue) + "." Else ActiveDocument.Selection.text = "* paramin " +
21、LTrim(ParamArr(iPrmA) + " " End If iPrmA = iPrmA - 1 Loop ActiveDocument.Selection.NewLine() If Len(Trim(RetTp) > 0 And Trim(RetTp) <> "void" Then ActiveDocument.Selection.text = "* return " + RetTp + " " ActiveDocument.Selection.NewLine() End If Acti
22、veDocument.Selection.text = "*/" Else MsgBox("It is possible that the function you are trying to work with has a syntax error.") End If End If End Sub '生成doxygen樣式的簡(jiǎn)要注釋 Public Sub BriefDescription() ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "/* b
23、rief */" End Sub '生成doxygen樣式的公開變量的注釋 Public Sub MemberDescription() ActiveDocument.Selection.text = ActiveDocument.Selection.text + " /*< */" End Sub '生成doxygen樣式的一般通用的注釋 Public Sub DetailDescription() ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = &quo
24、t;/* " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* brief " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* Detailed description." ActiveDocument.
25、Selection.NewLine() ActiveDocument.Selection.text = "*/" End Sub '生成doxygen樣式的一般通用的注釋 Public Sub Define() ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "#define " End Sub '生成doxygen樣式的一般通用的注釋 Public Sub Include() ActiveDocument.Selection.NewLine() Act
26、iveDocument.Selection.text = "#include " End Sub '生成doxygen樣式的一般通用的注釋 Public Sub TypedefStruct() ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "typedef struct" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "" ActiveDocument.
27、Selection.NewLine() ActiveDocument.Selection.text = "TSP_PACKED _Struct;" ActiveDocument.Selection.NewLine() End Sub '生成doxygen樣式的一般通用的注釋 Public Sub TypedefEnum() ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "typedef Enum" ActiveDocument.Selection.NewLin
28、e() ActiveDocument.Selection.text = "" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "_Enum;" ActiveDocument.Selection.NewLine() End Sub '生成doxygen樣式的文件描述 Public Sub FileDescription() If ActiveDocument.Selection.CurrentLine <> 1 Then ActiveDocument.
29、Selection.GoToLine(ActiveDocument.Selection.CurrentLine - 1) ActiveDocument.Selection.MoveTo(ActiveDocument.Selection.CurrentLine, 0) ActiveDocument.Selection.EndOfLine() ActiveDocument.Selection.NewLine() End If ActiveDocument.Selection.text = "/*" ActiveDocument.Selection.NewLine() Activ
30、eDocument.Selection.text = "* file " + ActiveDocument.Name ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* brief " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* author skywizards" ActiveDocument.Selection.NewLine() ActiveDoc
31、ument.Selection.text = "* date " ActiveDocument.Selection.text = DateTime.Today + " " + TimeOfDay ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* version " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "*/" End Sub
32、39;生成doxygen樣式的新文件描述 Public Sub NewFileDescription() If ActiveDocument.Selection.CurrentLine <> 1 Then ActiveDocument.Selection.GoToLine(ActiveDocument.Selection.CurrentLine - 1) ActiveDocument.Selection.MoveTo(ActiveDocument.Selection.CurrentLine, 0) ActiveDocument.Selection.EndOfLine() Activ
33、eDocument.Selection.NewLine() End If ActiveDocument.Selection.text = "/*" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* file " + ActiveDocument.Name ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* brief " ActiveDocument.Sele
34、ction.NewLine() ActiveDocument.Selection.text = "* author *" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* date " ActiveDocument.Selection.text = DateTime.Today + " " + TimeOfDay ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text =
35、"* version " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* <pre><b>copyright: </b></pre>" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* <pre><b>email: </b>*</pre>" ActiveDocu
36、ment.Selection.NewLine() ActiveDocument.Selection.text = "* <pre><b>company: </b>http:/</pre>" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* <pre><b>All rights reserved.</b></pre>" ActiveDocument.Selection.Ne
37、wLine() ActiveDocument.Selection.text = "* <pre><b>modification:</b></pre>" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* <pre>Write modifications here.</pre>" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.
38、text = "*/" If InStr(ActiveDocument.Name, ".") > 0 Then If Right(ActiveDocument.Name, Len(ActiveDocument.Name) - InStr(ActiveDocument.Name, ".") = "h" _ Or Right(ActiveDocument.Name, Len(ActiveDocument.Name) - InStr(ActiveDocument.Name, ".") = &qu
39、ot;hpp" _ Or Right(ActiveDocument.Name, Len(ActiveDocument.Name) - InStr(ActiveDocument.Name, ".") = "hh" Then Dim def def = "_" + UCase(Left(ActiveDocument.Name, InStr(ActiveDocument.Name, ".") - 1) _ + "_" + Right(ActiveDocument.Name, Len(Acti
40、veDocument.Name) - InStr(ActiveDocument.Name, ".") ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "#ifndef " + def ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "#define " + def ActiveDocument.Selection.NewLine() ActiveDocument.S
41、election.NewLine() ActiveDocument.Selection.text = "#endif " ActiveDocument.Selection.NewLine() End If If Right(ActiveDocument.Name, Len(ActiveDocument.Name) - InStr(ActiveDocument.Name, ".") = "c" _ Or Right(ActiveDocument.Name, Len(ActiveDocument.Name) - InStr(ActiveD
42、ocument.Name, ".") = "cpp" Then Dim def def = "#include " + Chr(34) + Left(ActiveDocument.Name, InStr(ActiveDocument.Name, ".") + "h" + Chr(34) ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = def ActiveDocument.Selection.NewLine()
43、End If End If End Sub '生成doxygen樣式的項(xiàng)目編號(hào)描述 Public Sub ItemDescription() ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "/*" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.t
44、ext = "* - " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* -# " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* -# " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* - " ActiveDocument.Selectio
45、n.NewLine() ActiveDocument.Selection.text = "* -# " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* -# " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "*/" End Sub '生成doxygen樣式模塊描述 Sub ModuleDescription() ActiveDocument.Sel
46、ection.NewLine() ActiveDocument.Selection.text = "/*" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* defgroup " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* brief " ActiveDocument.Selection.NewLine() ActiveDocument.Selecti
47、on.text = "* " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* Detailed description." ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "* " ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "*/" ActiveDocument.Selection.NewLine() ActiveDocument.Selection.NewLine() ActiveDocument.Selection.text = "/* */ " End Sub '生成doxygen樣式類描述 Sub ClassDescription() Dim className Dim StartLine className = ActiveDocument.Selection.text If Le
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年公司年會(huì)領(lǐng)導(dǎo)發(fā)言稿范文(17篇)
- 2024-2025學(xué)年廣東省梅州市平遠(yuǎn)縣實(shí)驗(yàn)中學(xué)高三上學(xué)期9月月考?xì)v史試卷
- 2024-2025學(xué)年第17課挽救民族危亡的斗爭(zhēng)-勤徑學(xué)升高中歷史必修上同步練測(cè)(統(tǒng)編版2019)
- 2025年以車抵押還款協(xié)議書范本
- 2025年個(gè)人項(xiàng)目委托合同
- 2025年臨時(shí)展覽館場(chǎng)地租賃合同范文
- 2025年涂料助劑:流平劑項(xiàng)目申請(qǐng)報(bào)告模范
- 2025年企業(yè)會(huì)議設(shè)備租賃合同范本
- 2025年個(gè)人與團(tuán)隊(duì)共同成長(zhǎng)策劃協(xié)議
- 2025年全場(chǎng)景住宅交易居間合同模板
- 2023六年級(jí)數(shù)學(xué)下冊(cè) 第2單元 百分?jǐn)?shù)(二)綜合與實(shí)踐 生活與百分?jǐn)?shù)說(shuō)課稿 新人教版
- 2025年1月浙江省高考政治試卷(含答案)
- 教體局校車安全管理培訓(xùn)
- 湖北省十堰市城區(qū)2024-2025學(xué)年九年級(jí)上學(xué)期期末質(zhì)量檢測(cè)綜合物理試題(含答案)
- 行車起重作業(yè)風(fēng)險(xiǎn)分析及管控措施
- 健康體檢中心患者身份登記制度
- 《災(zāi)害的概述》課件
- 2025年上半年重慶三峽融資擔(dān)保集團(tuán)股份限公司招聘6人高頻重點(diǎn)提升(共500題)附帶答案詳解
- 大模型關(guān)鍵技術(shù)與應(yīng)用
- DZ∕T 0227-2010 地質(zhì)巖心鉆探規(guī)程(正式版)
- 20以內(nèi)加減法口算題(10000道)(A4直接打印-每頁(yè)100題)
評(píng)論
0/150
提交評(píng)論