| 1 | #!/bin/bash |
| 2 | # This file is part of ccbuild. |
| 3 | |
| 4 | # ccbuild is free software: you can redistribute it and/or modify |
| 5 | # it under the terms of the GNU General Public License as published by |
| 6 | # the Free Software Foundation, either version 3 of the License, or |
| 7 | # (at your option) any later version. |
| 8 | |
| 9 | # ccbuild is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with ccbuild. If not, see <http://www.gnu.org/licenses/>. |
| 16 | # |
| 17 | HELP=" |
| 18 | Create a simple .cc function file for a class member. |
| 19 | It includes the srcHeader file of the first higher directory named src. |
| 20 | The function file name is given on stdout. |
| 21 | |
| 22 | Usage: $0 <class member function name, case sensitive> |
| 23 | Example: gedit \`ccFunction myFunctionName\` |
| 24 | " |
| 25 | if [ -z "$1" ];then |
| 26 | echo "$HELP" |
| 27 | exit |
| 28 | fi |
| 29 | #Create a simple .cc function file for a |
| 30 | # class member, whose name is the first argument |
| 31 | # It includes the srcHeader file of the first higher src directory. |
| 32 | FNAME=$1 |
| 33 | FILENAME="$FNAME".cc |
| 34 | CNAME=`basename "$PWD"` |
| 35 | #Uppercase first character is probably the class name |
| 36 | UCNAME=`echo "${CNAME:0:1}" |tr '[:lower:]' '[:upper:]' `${CNAME:1} |
| 37 | HEADER=`echo $PWD |grep -o "^.*src"`/srcHeader |
| 38 | echo $FILENAME |
| 39 | cat < "$HEADER" >> "$FILENAME" |
| 40 | cat >> "$FILENAME" <<EOF |
| 41 | |
| 42 | #include "$CNAME.ih" |
| 43 | |
| 44 | void $UCNAME::$FNAME() |
| 45 | { |
| 46 | |
| 47 | } |
| 48 | EOF |