-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.sh
53 lines (41 loc) · 964 Bytes
/
class.sh
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
#!/bin/bash
if [ -z "$1" ]
then
echo "Bad args. Example: class className"
exit 1
fi
Name=$1
UpperName=$(echo "$Name" | tr '[:lower:]' '[:upper:]')
HEADER="#ifndef __"$UpperName"_H__
#define __"$UpperName"_H__
class $Name{
private:
// your privite members here
public:
$Name ();
$Name (const $Name &a);
~$Name ();
$Name & operator = (const $Name &a);
};
#endif
"
SRC="#include \"$Name.hpp\"
/*-----------------------------------------------------*/
$Name::$Name (){
// your implementation here
}
/*-----------------------------------------------------*/
$Name::$Name (const $Name &a){
// your implementation here
}
/*-----------------------------------------------------*/
$Name::~$Name (){
// your implementation here
}
/*-----------------------------------------------------*/
$Name & $Name::operator = (const $Name &a){
// your implementation here
}
"
echo "$HEADER" > "$Name.hpp"
echo "$SRC" > "$Name.cpp"