Skip to content

Commit d0ce08a

Browse files
Pavlo Solntsevlpil
Pavlo Solntsev
authored andcommittedFeb 26, 2017
Doxygen snippets were added for C/C++ files (honza#829)
* Doxygen snippets were added for C/C++ files * Doxygen snippets were added for C/C++ files
1 parent 7ebdf05 commit d0ce08a

File tree

2 files changed

+159
-7
lines changed

2 files changed

+159
-7
lines changed
 

‎snippets/c.snippets

+105-4
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,84 @@ snippet fun
130130
{
131131
${4}
132132
}
133+
# function definition with zero parameters
134+
snippet fun0
135+
${1:void} ${2:function_name}()
136+
{
137+
${3}
138+
}
139+
# function definition with Doxygen documentation
140+
snippet dfun0
141+
/*! \brief ${1:Brief function description here}
142+
*
143+
* ${2:Detailed description of the function}
144+
*
145+
* \return ${3:Return parameter description}
146+
*/
147+
${4:void} ${5:function_name}()
148+
{
149+
${6}
150+
}
151+
# function definition with one parameter
152+
snippet fun1
153+
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
154+
{
155+
${5}
156+
}
157+
# function definition with one parameter with Doxygen documentation
158+
snippet dfun1
159+
/*! \brief ${1:Brief function description here}
160+
*
161+
* ${2:Detailed description of the function}
162+
*
163+
* \param $3 ${4:Parameter description}
164+
* \return ${5:Return parameter description}
165+
*/
166+
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
167+
{
168+
${9}
169+
}
170+
# function definition with two parameters
171+
snippet fun2
172+
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
173+
{
174+
${7}
175+
}
176+
# function definition with two parameters with Doxygen documentation
177+
snippet dfun2
178+
/*! \brief ${1:Brief function description here}
179+
*
180+
* ${2:Detailed description of the function}
181+
*
182+
* \param $3 ${4:Parameter description}
183+
* \param $5 ${6:Parameter description}
184+
* \return ${7:Return parameter description}
185+
*/
186+
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
187+
{
188+
${12}
189+
}
190+
# function definition with two parameters
191+
snippet fun3
192+
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
193+
{
194+
${9}
195+
}
196+
# function definition with two parameters with Doxygen documentation
197+
snippet dfun3
198+
/*! \brief ${1:Brief function description here}
199+
*
200+
* ${2:Detailed description of the function}
201+
*
202+
* \param $3 ${4:Parameter description}
203+
* \param $5 ${6:Parameter description}
204+
* \param $7 ${8:Parameter description}
205+
* \return ${9:Return parameter description}
206+
*/
207+
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
208+
{
209+
${15}
210+
}
133211
# function declaration
134212
snippet fund
135213
${1:void} ${2:function_name}(${3});
@@ -140,21 +218,39 @@ snippet td
140218
typedef ${1:int} ${2:MyCustomType};
141219
# struct
142220
snippet st
221+
/*! \struct $1
222+
* \brief ${3:Brief struct description}
223+
*
224+
* ${4:Detailed description}
225+
*/
143226
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
144-
${2:/* data */}
145-
}${3: /* optional variable list */};
227+
${2:Data} /*!< ${4:Description} */
228+
}${5: /* optional variable list */};
146229
# typedef struct
147230
snippet tds
231+
/*! \struct $2
232+
* \brief ${5:Brief struct description}
233+
*
234+
* ${6:Detailed description}
235+
*/
148236
typedef struct ${2:_$1 }{
149-
${3:/* data */}
237+
m_${3:Data} /*!< ${4:Description} */
150238
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
151239

152240
snippet enum
241+
/*! \enum $1
242+
*
243+
* ${2:Detailed description}
244+
*/
153245
enum ${1:name} { ${0} };
154246
# typedef enum
155247
snippet tde
248+
/*! \enum $2
249+
*
250+
* ${4:Detailed description}
251+
*/
156252
typedef enum {
157-
${1:/* data */}
253+
${1:Data} /*!< ${3:Description} */
158254
} ${2:foo};
159255
##
160256
## Input/Output
@@ -228,6 +324,11 @@ snippet getopt
228324
}
229325
}
230326
##
327+
# TODO section
328+
snippet todo
329+
/*! TODO: ${1:Todo description here}
330+
* \todo $1
331+
*/
231332
## Miscellaneous
232333
# This is kind of convenient
233334
snippet .

‎snippets/cpp.snippets

+54-3
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,61 @@ snippet mu
7878
## Class
7979
# class
8080
snippet cl
81+
/*! \class $1
82+
* \brief ${3:Brief class description}
83+
*
84+
* ${4:Detailed description}
85+
*/
8186
class ${1:`vim_snippets#Filename('$1', 'name')`}
8287
{
8388
public:
8489
$1(${2});
85-
~$1();
90+
virtual ~$1();
8691

87-
private:
88-
${0:/* data */}
92+
protected:
93+
m_${5}; /*!< ${6:Member description} */
8994
};
9095
# member function implementation
9196
snippet mfun
9297
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
9398
${0}
9499
}
100+
# member function implementation without parameters
101+
snippet dmfun0
102+
/*! \brief ${4:Brief function description here}
103+
*
104+
* ${5:Detailed description}
105+
*
106+
* \return ${6:Return parameter description}
107+
*/
108+
${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() {
109+
${0}
110+
}
111+
# member function implementation with one parameter
112+
snippet dmfun1
113+
/*! \brief ${6:Brief function description here}
114+
*
115+
* ${7:Detailed description}
116+
*
117+
* \param $4 ${8:Parameter description}
118+
* \return ${9:Return parameter description}
119+
*/
120+
${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) {
121+
${0}
122+
}
123+
# member function implementation with two parameter
124+
snippet dmfun2
125+
/*! \brief ${8:Brief function description here}
126+
*
127+
* ${9:Detailed description}
128+
*
129+
* \param $4 ${10:Parameter description}
130+
* \param $6 ${11:Parameter description}
131+
* \return ${12:Return parameter description}
132+
*/
133+
${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) {
134+
${0}
135+
}
95136
# namespace
96137
snippet ns
97138
namespace ${1:`vim_snippets#Filename('', 'my')`} {
@@ -152,3 +193,13 @@ snippet lld
152193
[${1}](${2}){
153194
${3}
154195
};
196+
# snippets exception
197+
snippet try
198+
try {
199+
200+
}catch(${1}) {
201+
202+
}
203+
204+
205+

0 commit comments

Comments
 (0)