![vs2008注釋宏_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6041.gif)
![vs2008注釋宏_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6042.gif)
![vs2008注釋宏_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6043.gif)
![vs2008注釋宏_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6044.gif)
![vs2008注釋宏_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/20/d93d8bcf-753c-49db-bd0d-f234391bf604/d93d8bcf-753c-49db-bd0d-f234391bf6045.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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樣式的函數注釋 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 '如果行數大于1,則將各行的字符串合成一個字符串 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) '得到函數名稱 Do While InStr(fcName, " ") <> 0 RetTp = RetTp + Left(fcName, InSt
6、r(fcName, " ") fcName = Right(fcName, Len(fcName) - InStr(fcName, " ") Loop '如果函數名稱第一個字符為"*"或"&",則做為返回值最后一個字符 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 '對返回值進行處理 '去掉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() '判斷是構造函數還是析構函數 If Len(Trim(RetTp) > 0 The
14、n ActiveDocument.Selection.text = "* brief " + fcName + " " Else '為構造函數 If InStr(fcName, "") <> 0 Then ActiveDocument.Selection.text = "* brief " + "Destructor for " + Right(fcName, Len(fcName) - 1) + "." '為析構函數 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() '首先判斷參數列表中有沒有'='號,如果有,則等號左邊為參數名,右邊為默認值。 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時,應該將引用符號放到前邊 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樣式的簡要注釋 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樣式的項目編號描述 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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 未來電商模式探索與展望
- 現代企業(yè)財務管理的倫理與責任
- 生產管理策略與工藝優(yōu)化技術
- 災害預防教育學校防災減災的必由之路
- 環(huán)保節(jié)能建筑的設計與實施案例分享
- 2024年重陽節(jié)活動策劃方案-11
- 現代物流與科技融合的商業(yè)模式
- 國慶節(jié)房地產促銷方案
- 2024年五年級英語上冊 Unit 6 In a nature park Part A 第三課時說課稿 人教PEP
- 2024-2025學年新教材高中語文 第二單元 5 雷雨(節(jié)選)(1)說課稿 部編版必修下冊
- 2025年1月浙江省高考政治試卷(含答案)
- 教體局校車安全管理培訓
- 湖北省十堰市城區(qū)2024-2025學年九年級上學期期末質量檢測綜合物理試題(含答案)
- 導播理論知識培訓班課件
- 空氣能安裝合同
- 中國人婚戀狀況調查報告公布
- 早產兒視網膜病變
- GB 10665-1997碳化鈣(電石)
- 《中小學教育懲戒規(guī)則》重點內容學習PPT課件(帶內容)
- 板帶生產工藝5(熱連軋帶鋼生產)課件
- 2022年同等學力英語考試真題及詳解
評論
0/150
提交評論