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

Annotation of /smsdaemon/plugins/createskeleton.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 120 - (hide annotations) (download) (as text)
Mon Dec 1 12:26:28 2008 UTC (15 years, 6 months ago) by torben
File MIME type: application/x-sh
File size: 1534 byte(s)
Added a list of items to be done when creating a new plugin.

1 torben 37 #!/bin/bash
2    
3     if [ "$1" == "" ] ; then
4     echo "Usage: $0 <ClassName>"
5     exit
6     fi
7    
8     CLASS="$1Plugin"
9     CLASSUP=`echo $CLASS | tr [:lower:] [:upper:]`
10 torben 41 CLASSLO=`echo $1 | tr [:upper:] [:lower:]`
11 torben 37
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 \"Plugin.h\"\n\n" >> $HEADER
25     echo "class $CLASS : public Plugin" >> $HEADER
26     echo "{" >> $HEADER
27     echo "public:" >> $HEADER
28     echo -e "\t$CLASS();\n" >> $HEADER
29 torben 51 echo -e "\tvirtual void Execute(IGsmModem& modem, SMS& sms);\n" >> $HEADER
30 torben 37 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 90 echo -e "#include \"IGsmModem.h\"" >> $CPP
39     echo -e "#include \"Sms.h\"\n" >> $CPP
40 torben 37
41     echo "$CLASS::$CLASS()" >> $CPP
42     echo " : Plugin(\"$CLASSLO\", \"<insert description>\")" >> $CPP
43     echo "{" >> $CPP
44     echo -e "}\n" >> $CPP
45    
46 torben 51 echo "void $CLASS::Execute(IGsmModem& modem, SMS& sms)" >> $CPP
47 torben 37 echo "{" >> $CPP
48     echo -e "\t//Add Implementation" >> $CPP
49     echo "}" >> $CPP
50 torben 120
51     echo ""
52     echo "Created $HEADER and $CPP"
53     echo "Remember to:"
54     echo " - Add an implementation in the $CLASS::Execute() method"
55     echo " - Add $CPP to CMakeLists.txt"
56     echo " - Add $HEADER and $CPP to source control"
57     echo " - Add an instance of $CLASS to PluginManager::LoadPlugins()"

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20