-
Notifications
You must be signed in to change notification settings - Fork 5
/
analyze_moc_include
26 lines (24 loc) · 1.14 KB
/
analyze_moc_include
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# Copyright (c) 2022 Remy van Elst
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
for filename in $(grep --recursive --files-with-matches --extended-regexp 'Q_OBJECT|Q_GADGET|Q_NAMESPACE'); do
cppfile="${filename%.*}.cpp";
if [[ -f "${cppfile}" ]]; then
if grep --quiet "#include \"moc_$(basename ${cppfile})\"" "${cppfile}"; then
echo "OK: ${cppfile} HAS moc include";
else
echo -n "FAIL: ${cppfile} MISSES moc include. "
echo "Add this line to the end of the file: ";
echo -e "\t#include \"moc_$(basename ${cppfile})\""
echo
fi;
fi;
done