-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateClass.sh
executable file
·61 lines (40 loc) · 913 Bytes
/
CreateClass.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
54
55
56
57
58
59
60
61
#!/bin/bash
COMAND=$1
CLASS_NAME=$2
PATH=$3
MAYUS="${CLASS_NAME}_hpp"
INCLUDE='"'$CLASS_NAME'.hpp"'
if [ $COMAND = "create" ]; then
echo "#ifndef ${MAYUS^^}
# define ${MAYUS^^}
# include <ostream>
# include <string>
# include <iostream>
class $CLASS_NAME
{
private:
public:
$CLASS_NAME();
$CLASS_NAME($CLASS_NAME const &other);
virtual ~$CLASS_NAME();
$CLASS_NAME &operator=($CLASS_NAME const &other);
};
std::ostream &operator<<(std::ostream &out, $CLASS_NAME const &other);
#endif" > $PATH/$CLASS_NAME.hpp
echo "#include $INCLUDE
$CLASS_NAME::$CLASS_NAME(){
}
$CLASS_NAME::~$CLASS_NAME(){
}
$CLASS_NAME::$CLASS_NAME($CLASS_NAME const &other){
}
$CLASS_NAME &$CLASS_NAME::operator=($CLASS_NAME const &other){
return *this;
}
std::ostream &operator<<(std::ostream &out, $CLASS_NAME const &other){
return out;
}
" > $PATH/$CLASS_NAME.cpp
else
echo "Invalid command"
fi