2011-11-06 17:09:08 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Requirements:
|
2013-03-06 09:05:41 +01:00
|
|
|
# astyle > =2.02 (patched with foreach support)
|
|
|
|
# normalize (Qt tool to normalize all signal/slots format)
|
2011-11-06 17:09:08 +01:00
|
|
|
#
|
|
|
|
|
2014-04-05 14:42:19 +02:00
|
|
|
OPTIONS="--indent=spaces=4 --style=linux
|
|
|
|
--pad-oper --unpad-paren --pad-header --convert-tabs
|
|
|
|
--indent-preprocessor --break-closing-brackets
|
|
|
|
--align-pointer=type --align-reference=name
|
|
|
|
--suffix=none --formatted"
|
2013-01-21 22:38:31 +01:00
|
|
|
|
2014-04-05 14:42:19 +02:00
|
|
|
function format_sources {
|
|
|
|
astyle $OPTIONS \
|
|
|
|
`find -type f \( -name '*.cpp' -not -name 'moc_*.cpp' \)`
|
2012-02-22 18:33:44 +01:00
|
|
|
}
|
2011-11-06 17:09:08 +01:00
|
|
|
|
2012-02-22 18:33:44 +01:00
|
|
|
function format_headers {
|
2014-04-05 14:42:19 +02:00
|
|
|
astyle $OPTIONS --keep-one-line-statements --keep-one-line-blocks \
|
|
|
|
`find -type f -name '*.h'`
|
2012-02-22 18:33:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cd ../src
|
2014-04-05 14:42:19 +02:00
|
|
|
|
2013-03-06 09:05:41 +01:00
|
|
|
echo "Running astyle for *.cpp ..."
|
2012-02-22 18:33:44 +01:00
|
|
|
format_sources
|
|
|
|
|
2013-03-06 09:05:41 +01:00
|
|
|
echo "Running astyle for *.h ..."
|
2012-02-22 18:33:44 +01:00
|
|
|
format_headers
|
2013-01-21 22:38:31 +01:00
|
|
|
|
2013-03-06 09:05:41 +01:00
|
|
|
echo "Running normalize ..."
|
|
|
|
normalize --modify .
|
|
|
|
|
2013-01-21 22:38:31 +01:00
|
|
|
exit 0
|