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

Contents of /smsdaemon/plugins/createskeleton.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 205 - (show annotations) (download) (as text)
Fri Dec 19 22:29:25 2008 UTC (15 years, 5 months ago) by torben
File MIME type: application/x-sh
File size: 1553 byte(s)
Enable selection and configuration of loaded plugins to be specified in the configuration file

1 #!/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 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 \"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 echo -e "\tvirtual void Execute(ISmsTransceiver& modem, SMS& sms);\n" >> $HEADER
30 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 echo -e "#include \"ISmsTransceiver.h\"" >> $CPP
39 echo -e "#include \"Sms.h\"\n" >> $CPP
40
41 echo "$CLASS::$CLASS()" >> $CPP
42 echo " : Plugin(\"$CLASSLO\", \"<insert description>\")" >> $CPP
43 echo "{" >> $CPP
44 echo -e "}\n" >> $CPP
45
46 echo "void $CLASS::Execute(ISmsTransceiver& modem, SMS& sms)" >> $CPP
47 echo "{" >> $CPP
48 echo -e "\t//Add Implementation" >> $CPP
49 echo "}" >> $CPP
50
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::CreatePlugin()"

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20