-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXxxClass_cpp.vm
65 lines (57 loc) · 1.73 KB
/
XxxClass_cpp.vm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* C++ class for entity "${entity.name}"
* Created on $now.date ( $now.time ) generated by $generator.name ( version $generator.version )
*/
##--------------------------------------------------------------------------------------------------
#set($env.language = "C++")
## Data fields = fields not in Primary Key and not in selected Links
#set( $dataFields = $entity.getAttributesByCriteria( $const.NOT_KEY, $const.NOT_IN_SELECTED_LINKS ) )
##--------------------------------------------------------------------------------------------------
${SHARP}include <iostream>
using namespace std;
class ${entity.name} {
public:
// Entity Primary Key
#foreach( $attrib in $entity.keyAttributes )
#if ($attrib.type != "" )
$attrib.formattedType(10) $attrib.name ;
#else
// no C++ type for $attrib.name ($attrib.neutralType)
#end
#end
// Entity other fields
#foreach( $attrib in $dataFields )
#if ($attrib.type != "" )
$attrib.formattedType(10) $attrib.name ;
#else
// no C++ type for $attrib.name ($attrib.neutralType)
#end
#end
// Entity links
#foreach( $link in $entity.selectedLinks )
// ${link.fieldType} $link.fieldName
#end
// Constructor
${entity.name}() {
cout << "Constructor \n";
}
// Destructor
~${entity.name}() {
cout << "Destructor \n";
}
void method1() { // method inside class
cout << "method #1 \n";
}
void method2(); // method outside class
};
// Method/function definition outside the class
void ${entity.name}::method2() {
cout << "method #2 \n";
}
int main() {
cout << "Running main for ${entity.name} \n";
${entity.name} o; // Create a new object of ${entity.name} (call constructor)
o.method1();
o.method2();
return 0;
}