Commit | Line | Data |
---|---|---|
c05676c5 CY |
1 | ;;; cpp.srt --- SRecode templates for c++-mode |
2 | ||
ab422c4d | 3 | ;; Copyright (C) 2007-2013 Free Software Foundation, Inc. |
c05676c5 CY |
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 | ||
c05676c5 CY |
28 | context declaration |
29 | ||
c05676c5 CY |
30 | template class :indent :blank |
31 | "Insert a C++ class. For use by user insertion. | |
32 | Override this template to change contents of a class. | |
33 | Override `class-tag' to override the outer structure of the class." | |
34 | ---- | |
35 | {{<A:class-tag}} | |
36 | public: | |
37 | {{>CONSTRUCTOR:classdecl:constructor-tag}} | |
38 | {{>DESTRUCTOR:classdecl:destructor-tag}} | |
39 | private: | |
40 | {{^}} | |
41 | ||
42 | {{/A}} | |
43 | ---- | |
44 | ||
45 | template subclass :indent :blank | |
46 | "Insert a C++ subclass of some other class." | |
47 | sectiondictionary "PARENTS" | |
48 | set NAME "?PARENTNAME" | |
49 | ---- | |
50 | {{>A:class}} | |
51 | ---- | |
52 | ||
53 | template class-tag :indent :blank | |
54 | "Insert a C++ class with the expectation of it being used by a tag inserter. | |
55 | Override this to affect applications, or the outer class structure for | |
56 | the user-facing template." | |
57 | ---- | |
58 | class {{?NAME}} {{#PARENTS}}{{#FIRST}}: {{/FIRST}}public {{NAME}}{{/PARENTS}} | |
59 | { | |
60 | {{^}} | |
61 | }; | |
62 | ---- | |
63 | bind "c" | |
64 | ||
65 | template method :indent :blank | |
66 | "Method belonging to some class, declared externally." | |
67 | ---- | |
68 | {{?TYPE}} {{?PARENT}}::{{?NAME}}{{>:misc:arglist}} | |
69 | {{#INITIALIZERS}}{{>B:initializers}}{{/INITIALIZERS}} | |
70 | { | |
71 | {{^}} | |
72 | } | |
73 | ---- | |
74 | ||
c05676c5 CY |
75 | context classdecl |
76 | ||
77 | template constructor-tag :indent :blank | |
78 | ---- | |
79 | {{?NAME}}{{>:misc:arglist}} | |
80 | { {{^}} } | |
81 | ---- | |
82 | ||
83 | ;; This one really sucks. How can I finish it? | |
84 | template initializers :indent | |
85 | ---- | |
86 | {{#FIRST}}: | |
87 | {{/FIRST}}{{INITNAME}}(){{#NOTLAST}},{{/NOTLAST}} | |
88 | ---- | |
89 | ||
90 | template destructor-tag :indent :blank | |
91 | ---- | |
92 | ~{{?NAME}}{{>:misc:arglist}} | |
93 | { {{^}} } | |
94 | ---- | |
95 | ||
96 | ;;; Base Comment functions for overriding. | |
97 | context classdecl | |
98 | ||
99 | template comment-function-group-start :indent :blank | |
100 | "Used for putting comments in front of a functional group of declarations. | |
101 | Override this with your own preference to avoid using doxygen." | |
102 | ---- | |
103 | {{>A:classdecl:doxygen-function-group-start}} | |
104 | ---- | |
105 | ||
106 | template comment-function-group-end :indent :blank | |
107 | "Used for putting comments in front of a functional group of declarations. | |
108 | Override this with your own preference to avoid using doxygen." | |
109 | ---- | |
110 | {{>A:classdecl:doxygen-function-group-end}} | |
111 | ---- | |
112 | ||
c05676c5 CY |
113 | ;;; DOXYGEN FEATURES |
114 | ;; | |
115 | ;; | |
116 | context classdecl | |
117 | ||
118 | prompt GROUPNAME "Name of declaration group: " | |
119 | ||
120 | template doxygen-function-group-start :indent :blank | |
121 | ---- | |
122 | /** | |
123 | * {{?GROUPNAME}} | |
124 | * @{ | |
125 | */ | |
126 | ||
127 | ---- | |
128 | ||
129 | template doxygen-function-group-end :indent :blank | |
130 | ---- | |
131 | /** | |
132 | * @} | |
133 | */ | |
134 | ||
135 | ---- | |
136 | ||
c05676c5 | 137 | ;; end |