/[projects]/smsdaemon/tasks/createskeleton.sh
ViewVC logotype

Annotation of /smsdaemon/tasks/createskeleton.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 520 - (hide annotations) (download) (as text)
Sat Dec 26 23:01:01 2009 UTC (14 years, 5 months ago) by torben
File MIME type: application/x-sh
File size: 1501 byte(s)
Added delayspam plugin+task


1 torben 97 #!/bin/bash
2    
3     if [ "$1" == "" ] ; then
4     echo "Usage: $0 <TaskName>"
5     exit
6     fi
7    
8     CLASS="$1Task"
9     CLASSUP=`echo $CLASS | tr [:lower:] [:upper:]`
10     CLASSLO=`echo $1 | tr [:upper:] [:lower:]`
11    
12     HEADER="$CLASS.h"
13     CPP="$CLASS.cpp"
14    
15    
16     # create header file
17     echo -n "#ifndef __" > $HEADER
18     echo -n $CLASSUP >> $HEADER
19     echo "_H__" >> $HEADER
20     echo -n "#define __" >> $HEADER
21     echo -n $CLASSUP >> $HEADER
22     echo -e "_H__\n\n" >> $HEADER
23    
24     echo -e "#include \"Task.h\"\n\n" >> $HEADER
25     echo "class $CLASS : public Task" >> $HEADER
26     echo "{" >> $HEADER
27     echo "public:" >> $HEADER
28     echo -e "\t$CLASS();\n" >> $HEADER
29 torben 520 echo -e "\tvirtual void ExecuteTask(ISmsTransceiver& modem);\n" >> $HEADER
30 torben 97 echo -e "\tvirtual ~$CLASS() {}\n" >> $HEADER
31     echo -e "};\n\n" >> $HEADER
32     echo -n "#endif // __" >> $HEADER
33     echo -n $CLASSUP >> $HEADER
34     echo "_H__" >> $HEADER
35    
36     #create implementation file
37     echo "#include \"$HEADER\"" > $CPP
38 torben 520 echo -e "#include \"ISmsTransceiver.h\"\n" >> $CPP
39 torben 97
40     echo "$CLASS::$CLASS()" >> $CPP
41     echo " : Task(\"$CLASSLO\", isTemporary ??)" >> $CPP
42     echo "{" >> $CPP
43     echo -e "}\n" >> $CPP
44    
45 torben 520 echo "void $CLASS::ExecuteTask(ISmsTransceiver& modem)" >> $CPP
46 torben 97 echo "{" >> $CPP
47     echo -e "\t//Add Implementation" >> $CPP
48     echo "}" >> $CPP
49 torben 129
50     echo ""
51     echo "Created $HEADER and $CPP"
52     echo "Remember to:"
53     echo " - Add an implementation in the $CLASS::ExecuteTask() method"
54     echo " - Add $CPP to CMakeLists.txt"
55     echo " - Add $HEADER and $CPP to source control"
56     echo " - If non-temporary, add an instance of $CLASS to TaskManager::LoadTasks()"

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20