Mercurial > emacs
comparison etc/srecode/cpp.srt @ 105407:84fc40980c51
* srecode: New directory for SRecode template files.
| author | Chong Yidong <cyd@stupidchicken.com> |
|---|---|
| date | Sat, 03 Oct 2009 19:28:56 +0000 |
| parents | |
| children | 1d1d5d9bd884 |
comparison
equal
deleted
inserted
replaced
| 105406:5b8c8cd21526 | 105407:84fc40980c51 |
|---|---|
| 1 ;;; cpp.srt --- SRecode templates for c++-mode | |
| 2 | |
| 3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. | |
| 4 | |
| 5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> | |
| 6 | |
| 7 ;; This file is part of GNU Emacs. | |
| 8 | |
| 9 ;; GNU Emacs is free software: you can redistribute it and/or modify | |
| 10 ;; it under the terms of the GNU General Public License as published by | |
| 11 ;; the Free Software Foundation, either version 3 of the License, or | |
| 12 ;; (at your option) any later version. | |
| 13 | |
| 14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
| 15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 ;; GNU General Public License for more details. | |
| 18 | |
| 19 ;; You should have received a copy of the GNU General Public License | |
| 20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | |
| 22 set mode "c++-mode" | |
| 23 | |
| 24 set comment_start "/**" | |
| 25 set comment_end " */" | |
| 26 set comment_prefix " *" | |
| 27 | |
| 28 ;; OVERRIDE THIS in your user or project template file to whatever | |
| 29 ;; you use for your project. | |
| 30 set HEADEREXT ".h" | |
| 31 | |
| 32 context file | |
| 33 | |
| 34 template empty :time :user :file :cpp | |
| 35 ---- | |
| 36 {{>:filecomment}} | |
| 37 | |
| 38 {{#NOTHEADER}} | |
| 39 | |
| 40 {{^}} | |
| 41 {{/NOTHEADER}} | |
| 42 {{#HEADER}} | |
| 43 {{>:header_guard}} | |
| 44 {{/HEADER}} | |
| 45 ---- | |
| 46 | |
| 47 template header_guard :file :blank | |
| 48 ---- | |
| 49 #ifndef {{FILENAME_SYMBOL}} | |
| 50 #define {{FILENAME_SYMBOL}} 1 | |
| 51 | |
| 52 {{^}} | |
| 53 | |
| 54 #endif // {{FILENAME_SYMBOL}} | |
| 55 ---- | |
| 56 | |
| 57 context misc | |
| 58 | |
| 59 template arglist | |
| 60 "Insert an argument list for a function. | |
| 61 @todo - Support smart CR in a buffer for not too long lines." | |
| 62 ---- | |
| 63 ({{#ARGS}}{{TYPE}} {{NAME}}{{#NOTLAST}},{{/NOTLAST}}{{/ARGS}}) | |
| 64 ---- | |
| 65 | |
| 66 context declaration | |
| 67 | |
| 68 prompt TYPE "Return Type: " | |
| 69 | |
| 70 template function :indent :blank | |
| 71 "Insert a function declaration." | |
| 72 ---- | |
| 73 {{?TYPE}} {{?NAME}}{{>:misc:arglist}} | |
| 74 {{#INITIALIZERS}}{{>B:initializers}}{{/INITIALIZERS}} | |
| 75 { | |
| 76 {{^}} | |
| 77 } | |
| 78 ---- | |
| 79 bind "f" | |
| 80 | |
| 81 template function-prototype :indent :blank | |
| 82 "Insert a function declaration." | |
| 83 ---- | |
| 84 {{?TYPE}} {{?NAME}}{{>:misc:arglist}}; | |
| 85 ---- | |
| 86 | |
| 87 | |
| 88 prompt TYPE "Data Type: " | |
| 89 | |
| 90 template variable :indent :blank | |
| 91 "Insert a variable declaration." | |
| 92 ---- | |
| 93 {{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}}; | |
| 94 ---- | |
| 95 bind "v" | |
| 96 | |
| 97 template variable-prototype :indent :blank | |
| 98 "Insert a variable declaration." | |
| 99 ---- | |
| 100 {{?TYPE}} {{?NAME}}; | |
| 101 ---- | |
| 102 bind "v" | |
| 103 | |
| 104 template class :indent :blank | |
| 105 "Insert a C++ class. For use by user insertion. | |
| 106 Override this template to change contents of a class. | |
| 107 Override `class-tag' to override the outer structure of the class." | |
| 108 ---- | |
| 109 {{<A:class-tag}} | |
| 110 public: | |
| 111 {{>CONSTRUCTOR:classdecl:constructor-tag}} | |
| 112 {{>DESTRUCTOR:classdecl:destructor-tag}} | |
| 113 private: | |
| 114 {{^}} | |
| 115 | |
| 116 {{/A}} | |
| 117 ---- | |
| 118 | |
| 119 template subclass :indent :blank | |
| 120 "Insert a C++ subclass of some other class." | |
| 121 sectiondictionary "PARENTS" | |
| 122 set NAME "?PARENTNAME" | |
| 123 ---- | |
| 124 {{>A:class}} | |
| 125 ---- | |
| 126 | |
| 127 template class-tag :indent :blank | |
| 128 "Insert a C++ class with the expectation of it being used by a tag inserter. | |
| 129 Override this to affect applications, or the outer class structure for | |
| 130 the user-facing template." | |
| 131 ---- | |
| 132 class {{?NAME}} {{#PARENTS}}{{#FIRST}}: {{/FIRST}}public {{NAME}}{{/PARENTS}} | |
| 133 { | |
| 134 {{^}} | |
| 135 }; | |
| 136 ---- | |
| 137 bind "c" | |
| 138 | |
| 139 template method :indent :blank | |
| 140 "Method belonging to some class, declared externally." | |
| 141 ---- | |
| 142 {{?TYPE}} {{?PARENT}}::{{?NAME}}{{>:misc:arglist}} | |
| 143 {{#INITIALIZERS}}{{>B:initializers}}{{/INITIALIZERS}} | |
| 144 { | |
| 145 {{^}} | |
| 146 } | |
| 147 ---- | |
| 148 | |
| 149 template include :blank | |
| 150 "An include statement." | |
| 151 ---- | |
| 152 #include "{{?NAME}}" | |
| 153 ---- | |
| 154 bind "i" | |
| 155 | |
| 156 template label :blank :indent | |
| 157 ---- | |
| 158 {{?NAME}}: | |
| 159 ---- | |
| 160 | |
| 161 context classdecl | |
| 162 | |
| 163 template constructor-tag :indent :blank | |
| 164 ---- | |
| 165 {{?NAME}}{{>:misc:arglist}} | |
| 166 { {{^}} } | |
| 167 ---- | |
| 168 | |
| 169 ;; This one really sucks. How can I finish it? | |
| 170 template initializers :indent | |
| 171 ---- | |
| 172 {{#FIRST}}: | |
| 173 {{/FIRST}}{{INITNAME}}(){{#NOTLAST}},{{/NOTLAST}} | |
| 174 ---- | |
| 175 | |
| 176 template destructor-tag :indent :blank | |
| 177 ---- | |
| 178 ~{{?NAME}}{{>:misc:arglist}} | |
| 179 { {{^}} } | |
| 180 ---- | |
| 181 | |
| 182 ;;; Base Comment functions for overriding. | |
| 183 context classdecl | |
| 184 | |
| 185 template comment-function-group-start :indent :blank | |
| 186 "Used for putting comments in front of a functional group of declarations. | |
| 187 Override this with your own preference to avoid using doxygen." | |
| 188 ---- | |
| 189 {{>A:classdecl:doxygen-function-group-start}} | |
| 190 ---- | |
| 191 | |
| 192 template comment-function-group-end :indent :blank | |
| 193 "Used for putting comments in front of a functional group of declarations. | |
| 194 Override this with your own preference to avoid using doxygen." | |
| 195 ---- | |
| 196 {{>A:classdecl:doxygen-function-group-end}} | |
| 197 ---- | |
| 198 | |
| 199 context declaration | |
| 200 | |
| 201 template comment-function :indent :blank | |
| 202 "Used to put a nice comment in front of a function. | |
| 203 Override this with your own preference to avoid using doxygen" | |
| 204 ---- | |
| 205 {{>A:declaration:doxygen-function}} | |
| 206 ---- | |
| 207 | |
| 208 ;;; DOXYGEN FEATURES | |
| 209 ;; | |
| 210 ;; | |
| 211 context classdecl | |
| 212 | |
| 213 prompt GROUPNAME "Name of declaration group: " | |
| 214 | |
| 215 template doxygen-function-group-start :indent :blank | |
| 216 ---- | |
| 217 /** | |
| 218 * {{?GROUPNAME}} | |
| 219 * @{ | |
| 220 */ | |
| 221 | |
| 222 ---- | |
| 223 | |
| 224 template doxygen-function-group-end :indent :blank | |
| 225 ---- | |
| 226 /** | |
| 227 * @} | |
| 228 */ | |
| 229 | |
| 230 ---- | |
| 231 | |
| 232 context declaration | |
| 233 | |
| 234 template doxygen-function :indent :blank | |
| 235 ---- | |
| 236 /** | |
| 237 * @name {{NAME}} - {{DOC}}{{^}}{{#ARGS}} | |
| 238 * @param {{NAME}} - {{DOC}}{{/ARGS}} | |
| 239 * @return {{TYPE}} | |
| 240 */ | |
| 241 ---- | |
| 242 | |
| 243 template doxygen-variable-same-line | |
| 244 ---- | |
| 245 /**< {{DOC}}{{^}} */ | |
| 246 ---- | |
| 247 | |
| 248 template doxygen-section-comment :blank :indent | |
| 249 "Insert a comment that separates sections of an Emacs Lisp file." | |
| 250 ---- | |
| 251 | |
| 252 /** {{?TITLE}} | |
| 253 * | |
| 254 * {{^}} | |
| 255 */ | |
| 256 | |
| 257 ---- | |
| 258 | |
| 259 | |
| 260 ;; end |
