|
@@ -0,0 +1,675 @@
|
|
1
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
2
|
+$
|
|
3
|
+== cpp.cin ==
|
|
4
|
+cin >> <CURSOR>;
|
|
5
|
+$
|
|
6
|
+== cpp.cout-variabe ==
|
|
7
|
+cout << <CURSOR> << endl;
|
|
8
|
+$
|
|
9
|
+== cpp.cout-string ==
|
|
10
|
+cout << "<CURSOR>\n";
|
|
11
|
+$
|
|
12
|
+== cpp.cout-operator == insert ==
|
|
13
|
+<< "<CURSOR>"
|
|
14
|
+$
|
|
15
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
16
|
+== cpp.output-manipulator-boolalpha == insert ==
|
|
17
|
+<< boolalpha <CURSOR>
|
|
18
|
+== cpp.output-manipulator-dec == insert ==
|
|
19
|
+<< dec <CURSOR>
|
|
20
|
+== cpp.output-manipulator-endl == insert ==
|
|
21
|
+<< endl <CURSOR>
|
|
22
|
+== cpp.output-manipulator-fixed == insert ==
|
|
23
|
+<< fixed <CURSOR>
|
|
24
|
+== cpp.output-manipulator-flush == insert ==
|
|
25
|
+<< flush <CURSOR>
|
|
26
|
+== cpp.output-manipulator-hex == insert ==
|
|
27
|
+<< hex <CURSOR>
|
|
28
|
+== cpp.output-manipulator-internal == insert ==
|
|
29
|
+<< internal <CURSOR>
|
|
30
|
+== cpp.output-manipulator-left == insert ==
|
|
31
|
+<< left <CURSOR>
|
|
32
|
+== cpp.output-manipulator-oct == insert ==
|
|
33
|
+<< oct <CURSOR>
|
|
34
|
+== cpp.output-manipulator-right == insert ==
|
|
35
|
+<< right <CURSOR>
|
|
36
|
+== cpp.output-manipulator-scientific == insert ==
|
|
37
|
+<< scientific <CURSOR>
|
|
38
|
+== cpp.output-manipulator-setbase == insert ==
|
|
39
|
+<< setbase(10<CURSOR>)
|
|
40
|
+== cpp.output-manipulator-setfill == insert ==
|
|
41
|
+<< setfill(<CURSOR>)
|
|
42
|
+== cpp.output-manipulator-setiosflag == insert ==
|
|
43
|
+<< setiosflags(<CURSOR>)
|
|
44
|
+== cpp.output-manipulator-setprecision == insert ==
|
|
45
|
+<< setprecision(6<CURSOR>)
|
|
46
|
+== cpp.output-manipulator-setw == insert ==
|
|
47
|
+<< setw(0<CURSOR>)
|
|
48
|
+== cpp.output-manipulator-showbase == insert ==
|
|
49
|
+<< showbase <CURSOR>
|
|
50
|
+== cpp.output-manipulator-showpoint == insert ==
|
|
51
|
+<< showpoint <CURSOR>
|
|
52
|
+== cpp.output-manipulator-showpos == insert ==
|
|
53
|
+<< showpos <CURSOR>
|
|
54
|
+== cpp.output-manipulator-uppercase == insert ==
|
|
55
|
+<< uppercase <CURSOR>
|
|
56
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
57
|
+== cpp.method-implementation ==
|
|
58
|
+//--------------------------------------------------------------------------------------
|
|
59
|
+// Class: |?CLASSNAME|
|
|
60
|
+// Method: |?METHODNAME|
|
|
61
|
+//--------------------------------------------------------------------------------------
|
|
62
|
+<CURSOR>void |CLASSNAME|::|METHODNAME| ( ) {
|
|
63
|
+ return ;
|
|
64
|
+} // ----- end of method |CLASSNAME|::|METHODNAME| -----
|
|
65
|
+
|
|
66
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
67
|
+== cpp.accessor-implementation ==
|
|
68
|
+//--------------------------------------------------------------------------------------
|
|
69
|
+// Class: |?CLASSNAME|
|
|
70
|
+// Method: get_|?ATTRIBUTE|
|
|
71
|
+//--------------------------------------------------------------------------------------
|
|
72
|
+inline <CURSOR>int |CLASSNAME|::get_|ATTRIBUTE| ( ) {
|
|
73
|
+ return |ATTRIBUTE|;
|
|
74
|
+} // ----- end of method |CLASSNAME|::get_|ATTRIBUTE| -----
|
|
75
|
+
|
|
76
|
+//--------------------------------------------------------------------------------------
|
|
77
|
+// Class: |CLASSNAME|
|
|
78
|
+// Method: set_|ATTRIBUTE|
|
|
79
|
+//--------------------------------------------------------------------------------------
|
|
80
|
+inline void |CLASSNAME|::set_|ATTRIBUTE| ( int value ) {
|
|
81
|
+ |ATTRIBUTE| = value;
|
|
82
|
+ return ;
|
|
83
|
+} // ----- end of method |CLASSNAME|::set_|ATTRIBUTE| -----
|
|
84
|
+
|
|
85
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
86
|
+== cpp.class-definition ==
|
|
87
|
+/**
|
|
88
|
+ \brief <CURSOR>
|
|
89
|
+ \details
|
|
90
|
+ */
|
|
91
|
+class |?CLASSNAME:c| : public |?BASECLASS:c| {
|
|
92
|
+
|
|
93
|
+// ==================== LIFECYCLE =======================
|
|
94
|
+
|
|
95
|
+/** Default constructor */
|
|
96
|
+|CLASSNAME| ( );
|
|
97
|
+
|
|
98
|
+/** Default destructor */
|
|
99
|
+~|CLASSNAME| ();
|
|
100
|
+
|
|
101
|
+// ==================== OPERATORS =======================
|
|
102
|
+
|
|
103
|
+// ==================== OPERATIONS =======================
|
|
104
|
+
|
|
105
|
+// ==================== ACCESS =======================
|
|
106
|
+
|
|
107
|
+// ==================== INQUIRY =======================
|
|
108
|
+
|
|
109
|
+protected:
|
|
110
|
+
|
|
111
|
+// ==================== DATA MEMBERS =========================
|
|
112
|
+
|
|
113
|
+private:
|
|
114
|
+
|
|
115
|
+}; // ----- end of class |CLASSNAME| -----
|
|
116
|
+
|
|
117
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
118
|
+== cpp.class-definitionLemma ==
|
|
119
|
+#pragma once
|
|
120
|
+#include "|?BASECLASS|.h"
|
|
121
|
+
|
|
122
|
+namespace Lemma {
|
|
123
|
+
|
|
124
|
+/**
|
|
125
|
+ \brief <CURSOR>
|
|
126
|
+ \details
|
|
127
|
+ */
|
|
128
|
+class |?CLASSNAME:c| : public |BASECLASS:c| {
|
|
129
|
+
|
|
130
|
+ friend std::ostream &operator<<(std::ostream &stream, const |CLASSNAME| &ob);
|
|
131
|
+
|
|
132
|
+ public:
|
|
133
|
+
|
|
134
|
+ // ==================== LIFECYCLE =======================
|
|
135
|
+
|
|
136
|
+ /*
|
|
137
|
+ * Factory method for generating concrete class.
|
|
138
|
+ * @return a std::shared_ptr of type |CLASSNAME|
|
|
139
|
+ */
|
|
140
|
+ static std::shared_ptr< |CLASSNAME| > NewSP();
|
|
141
|
+
|
|
142
|
+ /**
|
|
143
|
+ * Uses YAML to serialize this object.
|
|
144
|
+ * @return a YAML::Node
|
|
145
|
+ * @see |CLASSNAME|::DeSerialize
|
|
146
|
+ */
|
|
147
|
+ YAML::Node Serialize() const;
|
|
148
|
+
|
|
149
|
+ /**
|
|
150
|
+ * Constructs an |CLASSNAME| object from a YAML::Node.
|
|
151
|
+ * @see |CLASSNAME|::Serialize
|
|
152
|
+ */
|
|
153
|
+ static std::shared_ptr<|CLASSNAME|> DeSerialize(const YAML::Node& node);
|
|
154
|
+
|
|
155
|
+ // ==================== OPERATORS =======================
|
|
156
|
+
|
|
157
|
+ // ==================== OPERATIONS =======================
|
|
158
|
+
|
|
159
|
+ // ==================== ACCESS =======================
|
|
160
|
+
|
|
161
|
+ // ==================== INQUIRY =======================
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+ protected:
|
|
166
|
+
|
|
167
|
+ // ==================== LIFECYCLE =======================
|
|
168
|
+
|
|
169
|
+ /**
|
|
170
|
+ * Default protected constructor, use NewSP methods to construct
|
|
171
|
+ * @see |CLASSNAME|::NewSP
|
|
172
|
+ */
|
|
173
|
+ |CLASSNAME| (const std::string& name);
|
|
174
|
+
|
|
175
|
+ /**
|
|
176
|
+ * Protected DeDerializing constructor, use factory DeSerialize method.
|
|
177
|
+ * @see |CLASSNAME|::DeSerialize
|
|
178
|
+ */
|
|
179
|
+ |CLASSNAME| (const YAML::Node& node);
|
|
180
|
+
|
|
181
|
+ /** Default protected destructor, use smart pointers (std::shared_ptr) */
|
|
182
|
+ ~|CLASSNAME| ();
|
|
183
|
+
|
|
184
|
+ // ==================== DATA MEMBERS =========================
|
|
185
|
+
|
|
186
|
+ private:
|
|
187
|
+
|
|
188
|
+}; // ----- end of class |CLASSNAME| -----
|
|
189
|
+} // ----- end of namespace Lemma ----
|
|
190
|
+
|
|
191
|
+/* vim: set tabstop=4 expandtab: */
|
|
192
|
+/* vim: set filetype=cpp: */
|
|
193
|
+
|
|
194
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
195
|
+== cpp.class-definitionLemmaAbstract ==
|
|
196
|
+/**
|
|
197
|
+ \brief <CURSOR>
|
|
198
|
+ \details
|
|
199
|
+ */
|
|
200
|
+class |?CLASSNAME:c| : public |?BASECLASS:c| {
|
|
201
|
+
|
|
202
|
+ friend std::ostream &operator<<(std::ostream &stream,
|
|
203
|
+ const |CLASSNAME| &ob) {
|
|
204
|
+ stream << *(|BASECLASS|*)(&ob);
|
|
205
|
+ return stream;
|
|
206
|
+ }
|
|
207
|
+
|
|
208
|
+ public:
|
|
209
|
+
|
|
210
|
+// ==================== LIFECYCLE =======================
|
|
211
|
+
|
|
212
|
+// ==================== OPERATORS =======================
|
|
213
|
+
|
|
214
|
+// ==================== OPERATIONS =======================
|
|
215
|
+virtual void APIDemo()=0; // REMEMBER TO MAKE PURE VIRTUAL DUMMY
|
|
216
|
+
|
|
217
|
+// ==================== ACCESS =======================
|
|
218
|
+
|
|
219
|
+// ==================== INQUIRY =======================
|
|
220
|
+
|
|
221
|
+protected:
|
|
222
|
+
|
|
223
|
+// ==================== LIFECYCLE =======================
|
|
224
|
+
|
|
225
|
+/** Default protected constructor, abstract class this cannot be called */
|
|
226
|
+|CLASSNAME| (const std::string& name);
|
|
227
|
+
|
|
228
|
+/** Default protected destructor, this is an abstract class, this cannot be called */
|
|
229
|
+~|CLASSNAME| ();
|
|
230
|
+
|
|
231
|
+// ==================== DATA MEMBERS =========================
|
|
232
|
+
|
|
233
|
+private:
|
|
234
|
+
|
|
235
|
+}; // ----- end of class |CLASSNAME| -----
|
|
236
|
+
|
|
237
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
238
|
+== cpp.class-implementationLemma ==
|
|
239
|
+#include "|?CLASSNAME|.h"
|
|
240
|
+
|
|
241
|
+namespace Lemma {
|
|
242
|
+
|
|
243
|
+// ==================== FRIEND METHODS =====================
|
|
244
|
+
|
|
245
|
+std::ostream &operator << (std::ostream &stream, const |CLASSNAME| &ob) {
|
|
246
|
+ stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
|
|
247
|
+ return stream;
|
|
248
|
+}
|
|
249
|
+
|
|
250
|
+// ==================== LIFECYCLE =======================
|
|
251
|
+
|
|
252
|
+//--------------------------------------------------------------------------------------
|
|
253
|
+// Class: |CLASSNAME|
|
|
254
|
+// Method: |CLASSNAME|
|
|
255
|
+// Description: constructor (protected)
|
|
256
|
+//--------------------------------------------------------------------------------------
|
|
257
|
+|CLASSNAME|::|CLASSNAME| (const std::string& name) : |?BASECLASS|(name) {
|
|
258
|
+
|
|
259
|
+} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
|
|
260
|
+
|
|
261
|
+//--------------------------------------------------------------------------------------
|
|
262
|
+// Class: |CLASSNAME|
|
|
263
|
+// Method: |CLASSNAME|
|
|
264
|
+// Description: DeSerializing constructor (protected)
|
|
265
|
+//--------------------------------------------------------------------------------------
|
|
266
|
+|CLASSNAME|::|CLASSNAME| (const YAML::Node& node) : |BASECLASS|(node) {
|
|
267
|
+
|
|
268
|
+} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
|
|
269
|
+
|
|
270
|
+//--------------------------------------------------------------------------------------
|
|
271
|
+// Class: |CLASSNAME|
|
|
272
|
+// Method: NewSP()
|
|
273
|
+// Description: public constructor returing a shared_ptr
|
|
274
|
+//--------------------------------------------------------------------------------------
|
|
275
|
+std::shared_ptr< |CLASSNAME| > |CLASSNAME|::NewSP() {
|
|
276
|
+ std::shared_ptr< |CLASSNAME| > sp(new |CLASSNAME|("|CLASSNAME|"), LemmaObjectDeleter() );
|
|
277
|
+ return sp;
|
|
278
|
+}
|
|
279
|
+
|
|
280
|
+//--------------------------------------------------------------------------------------
|
|
281
|
+// Class: |CLASSNAME|
|
|
282
|
+// Method: ~|CLASSNAME|
|
|
283
|
+// Description: destructor (protected)
|
|
284
|
+//--------------------------------------------------------------------------------------
|
|
285
|
+|CLASSNAME|::~|CLASSNAME| () {
|
|
286
|
+
|
|
287
|
+} // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
|
|
288
|
+
|
|
289
|
+//--------------------------------------------------------------------------------------
|
|
290
|
+// Class: |CLASSNAME|
|
|
291
|
+// Method: Serialize
|
|
292
|
+//--------------------------------------------------------------------------------------
|
|
293
|
+YAML::Node |CLASSNAME|::Serialize ( ) const {
|
|
294
|
+ YAML::Node node = |BASECLASS|::Serialize();
|
|
295
|
+ node.SetTag( GetName() );
|
|
296
|
+ // FILL IN CLASS SPECIFICS HERE
|
|
297
|
+ return node;
|
|
298
|
+} // ----- end of method |CLASSNAME|::Serialize -----
|
|
299
|
+
|
|
300
|
+//--------------------------------------------------------------------------------------
|
|
301
|
+// Class: |CLASSNAME|
|
|
302
|
+// Method: DeSerialize
|
|
303
|
+//--------------------------------------------------------------------------------------
|
|
304
|
+std::shared_ptr<|CLASSNAME|> |CLASSNAME|::DeSerialize ( const YAML::Node& node ) {
|
|
305
|
+ if (node.Tag() != "|CLASSNAME|" ) {
|
|
306
|
+ throw DeSerializeTypeMismatch( "|CLASSNAME|", node.Tag());
|
|
307
|
+ }
|
|
308
|
+ std::shared_ptr< |CLASSNAME| > Object(new |CLASSNAME|(node), LemmaObjectDeleter() );
|
|
309
|
+ return Object ;
|
|
310
|
+} // ----- end of method |CLASSNAME|::DeSerialize -----
|
|
311
|
+
|
|
312
|
+} // ---- end of namespace Lemma ----
|
|
313
|
+
|
|
314
|
+/* vim: set tabstop=4 expandtab: */
|
|
315
|
+/* vim: set filetype=cpp: */
|
|
316
|
+
|
|
317
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
318
|
+== cpp.class-implementation ==
|
|
319
|
+
|
|
320
|
+// ==================== LIFECYCLE =======================
|
|
321
|
+
|
|
322
|
+//--------------------------------------------------------------------------------------
|
|
323
|
+// Class: |CLASSNAME|
|
|
324
|
+// Method: |CLASSNAME|
|
|
325
|
+// Description: constructor (protected)
|
|
326
|
+//--------------------------------------------------------------------------------------
|
|
327
|
+|CLASSNAME|::|CLASSNAME| ( ) : |BASECLASS|(name) {
|
|
328
|
+
|
|
329
|
+} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
|
|
330
|
+
|
|
331
|
+//--------------------------------------------------------------------------------------
|
|
332
|
+// Class: |CLASSNAME|
|
|
333
|
+// Method: ~|CLASSNAME|
|
|
334
|
+// Description: destructor
|
|
335
|
+//--------------------------------------------------------------------------------------
|
|
336
|
+|CLASSNAME|::~|CLASSNAME| () {
|
|
337
|
+<CURSOR>
|
|
338
|
+} // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
342
|
+== cpp.class-using-new-definition ==
|
|
343
|
+// =====================================================================================
|
|
344
|
+// Class: |?CLASSNAME:c|
|
|
345
|
+// Description: <CURSOR>
|
|
346
|
+// =====================================================================================
|
|
347
|
+class |CLASSNAME|
|
|
348
|
+{
|
|
349
|
+ public:
|
|
350
|
+
|
|
351
|
+ // ==================== LIFECYCLE =======================================
|
|
352
|
+ |CLASSNAME| (); // constructor
|
|
353
|
+ |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor
|
|
354
|
+ ~|CLASSNAME| (); // destructor
|
|
355
|
+
|
|
356
|
+ // ==================== OPERATORS =======================================
|
|
357
|
+ const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
|
|
358
|
+
|
|
359
|
+ // ==================== OPERATIONS =======================================
|
|
360
|
+
|
|
361
|
+ // ==================== ACCESS =======================================
|
|
362
|
+
|
|
363
|
+ // ==================== INQUIRY =======================================
|
|
364
|
+
|
|
365
|
+ // ==================== DATA MEMBERS =======================================
|
|
366
|
+ protected:
|
|
367
|
+
|
|
368
|
+ private:
|
|
369
|
+
|
|
370
|
+}; // ----- end of class |CLASSNAME| -----
|
|
371
|
+
|
|
372
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
373
|
+== cpp.class-using-new-implementation ==
|
|
374
|
+//--------------------------------------------------------------------------------------
|
|
375
|
+// Class: |?CLASSNAME|
|
|
376
|
+// Method: |CLASSNAME|
|
|
377
|
+// Description: constructor
|
|
378
|
+//--------------------------------------------------------------------------------------
|
|
379
|
+|CLASSNAME|::|CLASSNAME| ()
|
|
380
|
+{
|
|
381
|
+} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
|
|
382
|
+
|
|
383
|
+//--------------------------------------------------------------------------------------
|
|
384
|
+// Class: |CLASSNAME|
|
|
385
|
+// Method: |CLASSNAME|
|
|
386
|
+// Description: copy constructor
|
|
387
|
+//--------------------------------------------------------------------------------------
|
|
388
|
+|CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other )
|
|
389
|
+{
|
|
390
|
+} // ----- end of method |CLASSNAME|::|CLASSNAME| (copy constructor) -----
|
|
391
|
+
|
|
392
|
+//--------------------------------------------------------------------------------------
|
|
393
|
+// Class: |CLASSNAME|
|
|
394
|
+// Method: ~|CLASSNAME|
|
|
395
|
+// Description: destructor
|
|
396
|
+//--------------------------------------------------------------------------------------
|
|
397
|
+|CLASSNAME|::~|CLASSNAME| ()
|
|
398
|
+{
|
|
399
|
+} // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
|
|
400
|
+
|
|
401
|
+//--------------------------------------------------------------------------------------
|
|
402
|
+// Class: |CLASSNAME|
|
|
403
|
+// Method: operator =
|
|
404
|
+// Description: assignment operator
|
|
405
|
+//--------------------------------------------------------------------------------------
|
|
406
|
+const |CLASSNAME|&
|
|
407
|
+|CLASSNAME|::operator = ( const |CLASSNAME| &other )
|
|
408
|
+{
|
|
409
|
+ if ( this != &other ) {
|
|
410
|
+ }
|
|
411
|
+ return *this;
|
|
412
|
+} // ----- end of method |CLASSNAME|::operator = (assignment operator) -----
|
|
413
|
+
|
|
414
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
415
|
+== cpp.error-class ==
|
|
416
|
+// =====================================================================================
|
|
417
|
+// Class: |?CLASSNAME:c|
|
|
418
|
+// Description: <CURSOR>
|
|
419
|
+// =====================================================================================
|
|
420
|
+class |CLASSNAME|
|
|
421
|
+{
|
|
422
|
+ public: |CLASSNAME| ( string msg = "|CLASSNAME|" ):message(msg) { }
|
|
423
|
+ virtual ~|CLASSNAME| ( ) { }
|
|
424
|
+ virtual string what ( ) const throw ( ) { return message; }
|
|
425
|
+ protected: string message;
|
|
426
|
+}; // ---------- end of class |CLASSNAME| ----------
|
|
427
|
+
|
|
428
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
429
|
+== cpp.template-method-implementation ==
|
|
430
|
+template < class T >
|
|
431
|
+void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( )
|
|
432
|
+{
|
|
433
|
+ return ;
|
|
434
|
+} // ----- end of method |CLASSNAME|<T>::|METHODNAME| -----
|
|
435
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
436
|
+== cpp.template-accessor-implementation ==
|
|
437
|
+//--------------------------------------------------------------------------------------
|
|
438
|
+// Class: |?CLASSNAME|
|
|
439
|
+// Method: get_|?ATTRIBUTE|
|
|
440
|
+//--------------------------------------------------------------------------------------
|
|
441
|
+template < class T >
|
|
442
|
+inline <CURSOR>int |CLASSNAME|<T>::get_|ATTRIBUTE| ( )
|
|
443
|
+{
|
|
444
|
+ return |ATTRIBUTE|;
|
|
445
|
+} // ----- end of method |CLASSNAME|<T>::get_|ATTRIBUTE| -----
|
|
446
|
+
|
|
447
|
+//--------------------------------------------------------------------------------------
|
|
448
|
+// Class: |CLASSNAME|
|
|
449
|
+// Method: set_|ATTRIBUTE|
|
|
450
|
+//--------------------------------------------------------------------------------------
|
|
451
|
+template < class T >
|
|
452
|
+inline void |CLASSNAME|<T>::set_|ATTRIBUTE| ( int value )
|
|
453
|
+{
|
|
454
|
+ |ATTRIBUTE| = value;
|
|
455
|
+ return ;
|
|
456
|
+} // ----- end of method |CLASSNAME|<T>::set_|ATTRIBUTE| -----
|
|
457
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
458
|
+== cpp.template-class-definition ==
|
|
459
|
+// =====================================================================================
|
|
460
|
+// Class: |?CLASSNAME:c|
|
|
461
|
+// Description: <CURSOR>
|
|
462
|
+// =====================================================================================
|
|
463
|
+
|
|
464
|
+template < class T >
|
|
465
|
+class |CLASSNAME|
|
|
466
|
+{
|
|
467
|
+ public:
|
|
468
|
+
|
|
469
|
+ // ==================== LIFECYCLE =======================================
|
|
470
|
+ |CLASSNAME| (); // constructor
|
|
471
|
+
|
|
472
|
+ // ==================== OPERATORS =======================================
|
|
473
|
+
|
|
474
|
+ // ==================== OPERATIONS =======================================
|
|
475
|
+
|
|
476
|
+ // ==================== ACCESS =======================================
|
|
477
|
+
|
|
478
|
+ // ==================== INQUIRY =======================================
|
|
479
|
+
|
|
480
|
+ // ==================== DATA MEMBERS =======================================
|
|
481
|
+ protected:
|
|
482
|
+
|
|
483
|
+ private:
|
|
484
|
+
|
|
485
|
+}; // ----- end of template class |CLASSNAME| -----
|
|
486
|
+
|
|
487
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
488
|
+== cpp.template-class-implementation ==
|
|
489
|
+//--------------------------------------------------------------------------------------
|
|
490
|
+// Class: |?CLASSNAME|
|
|
491
|
+// Method: |CLASSNAME|
|
|
492
|
+// Description: constructor
|
|
493
|
+//--------------------------------------------------------------------------------------
|
|
494
|
+template < class T >
|
|
495
|
+|CLASSNAME| <T>:: |CLASSNAME| ()
|
|
496
|
+{
|
|
497
|
+} // ----- end of constructor of template class |CLASSNAME| -----
|
|
498
|
+
|
|
499
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
500
|
+== cpp.template-class-using-new-definition ==
|
|
501
|
+// =====================================================================================
|
|
502
|
+// Class: |?CLASSNAME:c|
|
|
503
|
+// Description: <CURSOR>
|
|
504
|
+// =====================================================================================
|
|
505
|
+
|
|
506
|
+template < class T >
|
|
507
|
+class |CLASSNAME|
|
|
508
|
+{
|
|
509
|
+ public:
|
|
510
|
+
|
|
511
|
+ // ==================== LIFECYCLE =======================================
|
|
512
|
+ |CLASSNAME| (); // constructor
|
|
513
|
+ |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor
|
|
514
|
+ ~|CLASSNAME| (); // destructor
|
|
515
|
+
|
|
516
|
+ // ==================== OPERATORS =======================================
|
|
517
|
+
|
|
518
|
+ const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
|
|
519
|
+
|
|
520
|
+ // ==================== OPERATIONS =======================================
|
|
521
|
+
|
|
522
|
+ // ==================== ACCESS =======================================
|
|
523
|
+
|
|
524
|
+ // ==================== INQUIRY =======================================
|
|
525
|
+
|
|
526
|
+ // ==================== DATA MEMBERS =======================================
|
|
527
|
+ protected:
|
|
528
|
+
|
|
529
|
+ private:
|
|
530
|
+
|
|
531
|
+}; // ----- end of template class |CLASSNAME| -----
|
|
532
|
+
|
|
533
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
534
|
+== cpp.template-class-using-new-implementation ==
|
|
535
|
+//--------------------------------------------------------------------------------------
|
|
536
|
+// Class: |?CLASSNAME|
|
|
537
|
+// Method: |CLASSNAME|
|
|
538
|
+// Description: constructor
|
|
539
|
+//--------------------------------------------------------------------------------------
|
|
540
|
+template < class T >
|
|
541
|
+|CLASSNAME|<T>::|CLASSNAME| ()
|
|
542
|
+{
|
|
543
|
+} // ----- end of constructor of template class |CLASSNAME| -----
|
|
544
|
+
|
|
545
|
+//--------------------------------------------------------------------------------------
|
|
546
|
+// Class: |CLASSNAME|
|
|
547
|
+// Method: |CLASSNAME|
|
|
548
|
+// Description: copy constructor
|
|
549
|
+//--------------------------------------------------------------------------------------
|
|
550
|
+template < class T >
|
|
551
|
+|CLASSNAME|<T>::|CLASSNAME| ( const |CLASSNAME| &other )
|
|
552
|
+{
|
|
553
|
+} // ----- end of copy constructor of template class |CLASSNAME| -----
|
|
554
|
+
|
|
555
|
+//--------------------------------------------------------------------------------------
|
|
556
|
+// Class: |CLASSNAME|
|
|
557
|
+// Method: ~|CLASSNAME|
|
|
558
|
+// Description: destructor
|
|
559
|
+//--------------------------------------------------------------------------------------
|
|
560
|
+template < class T >
|
|
561
|
+|CLASSNAME|<T>::~|CLASSNAME| ()
|
|
562
|
+{
|
|
563
|
+} // ----- end of destructor of template class |CLASSNAME| -----
|
|
564
|
+
|
|
565
|
+//--------------------------------------------------------------------------------------
|
|
566
|
+// Class: |CLASSNAME|
|
|
567
|
+// Method: operator =
|
|
568
|
+// Description: assignment operator
|
|
569
|
+//--------------------------------------------------------------------------------------
|
|
570
|
+template < class T >
|
|
571
|
+const |CLASSNAME|<T>& |CLASSNAME|<T>::operator = ( const |CLASSNAME| &other )
|
|
572
|
+{
|
|
573
|
+ if ( this != &other ) {
|
|
574
|
+ }
|
|
575
|
+ return *this;
|
|
576
|
+} // ----- end of assignment operator of template class |CLASSNAME| -----
|
|
577
|
+
|
|
578
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
579
|
+== cpp.template-function ==
|
|
580
|
+template <class T>
|
|
581
|
+<CURSOR>void |?TEMPALTE_FUNCTION_NAME| ( T param )
|
|
582
|
+{
|
|
583
|
+ return ;
|
|
584
|
+} // ----- end of template function |?TEMPALTE_FUNCTION_NAME| -----
|
|
585
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
586
|
+== cpp.operator-in ==
|
|
587
|
+ostream &
|
|
588
|
+operator << ( ostream & os, const |?CLASSNAME| & obj )
|
|
589
|
+{
|
|
590
|
+ os << obj.<CURSOR> ;
|
|
591
|
+ return os;
|
|
592
|
+} // ----- end of function operator << -----
|
|
593
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
594
|
+== cpp.operator-out ==
|
|
595
|
+istream &
|
|
596
|
+operator >> ( istream & is, |?CLASSNAME| & obj )
|
|
597
|
+{
|
|
598
|
+ is >> obj.<CURSOR> ;
|
|
599
|
+ return is;
|
|
600
|
+} // ----- end of function operator >> -----
|
|
601
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
602
|
+== cpp.try-catch ==
|
|
603
|
+try {
|
|
604
|
+<SPLIT>}
|
|
605
|
+catch ( const <CURSOR> &ExceptObj ) { // handle exception:
|
|
606
|
+}
|
|
607
|
+catch (...) { // handle exception: unspezified
|
|
608
|
+}
|
|
609
|
+
|
|
610
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
611
|
+== cpp.catch ==
|
|
612
|
+catch ( <CURSOR>const &ExceptObj ) { // handle exception:
|
|
613
|
+<SPLIT>}
|
|
614
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
615
|
+== cpp.catch-points ==
|
|
616
|
+catch (...) { // handle exception:
|
|
617
|
+<SPLIT>}
|
|
618
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
619
|
+== cpp.extern ==
|
|
620
|
+extern "C" {<CURSOR>
|
|
621
|
+<SPLIT>}
|
|
622
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
623
|
+== cpp.open-input-file ==
|
|
624
|
+string ifs_file_name = "<CURSOR>"; // input file name
|
|
625
|
+ifstream ifs; // create ifstream object
|
|
626
|
+
|
|
627
|
+ifs.open ( ifs_file_name.c_str() ); // open ifstream
|
|
628
|
+if (!ifs) {
|
|
629
|
+ cerr << "\nERROR : failed to open input file " << ifs_file_name << endl;
|
|
630
|
+ exit (EXIT_FAILURE);
|
|
631
|
+}
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+ifs.close (); // close ifstream
|
|
635
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
636
|
+== cpp.open-output-file ==
|
|
637
|
+string ofs_file_name = "<CURSOR>"; // input file name
|
|
638
|
+ofstream ofs; // create ofstream object
|
|
639
|
+
|
|
640
|
+ofs.open ( ofs_file_name.c_str() ); // open ofstream
|
|
641
|
+if (!ofs) {
|
|
642
|
+ cerr << "\nERROR : failed to open output file " << ofs_file_name << endl;
|
|
643
|
+ exit (EXIT_FAILURE);
|
|
644
|
+}
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+ofs.close (); // close ofstream
|
|
648
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
649
|
+== cpp.namespace-std ==
|
|
650
|
+using namespace std;
|
|
651
|
+== cpp.namespace ==
|
|
652
|
+using namespace |?NAMESPACE|;
|
|
653
|
+== cpp.namespace-block ==
|
|
654
|
+namespace |?NAMESPACE| {
|
|
655
|
+<CURSOR>
|
|
656
|
+<SPLIT>} // ----- end of |NAMESPACE| name -----
|
|
657
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
658
|
+== cpp.rtti-typeid == insert ==
|
|
659
|
+typeid(<CURSOR><SPLIT>)
|
|
660
|
+$
|
|
661
|
+== cpp.rtti-static-cast == insert ==
|
|
662
|
+static_cast<>(<CURSOR><SPLIT>)
|
|
663
|
+$
|
|
664
|
+== cpp.rtti-const-cast == insert ==
|
|
665
|
+const_cast<>(<CURSOR><SPLIT>)
|
|
666
|
+$
|
|
667
|
+== cpp.rtti-reinterpret-cast == insert ==
|
|
668
|
+reinterpret_cast<>(<CURSOR><SPLIT>)
|
|
669
|
+$
|
|
670
|
+== cpp.rtti-dynamic-cast == insert ==
|
|
671
|
+dynamic_cast<>(<CURSOR><SPLIT>)
|
|
672
|
+$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
673
|
+
|
|
674
|
+/* vim: set tabstop=4 expandtab: */
|
|
675
|
+/* vim: set filetype=cpp: */
|