From ba75bd16fef3ab461a7aeaa87af604875e04920a Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Thu, 31 Jul 2014 21:30:56 +0200 Subject: [PATCH] Use common format for all include guards and avoid leading underscores Use a common format for all include guards, make sure each header file has one and make sure it's named after the file name. And as a random extra in this commit: Make sure the gen_version.h file generated by cmake ends with a line break. Closes #59. --- CMakeLists.txt | 12 ++++++------ src/AboutDialog.h | 4 ++-- src/Application.h | 4 ++-- src/CreateIndexDialog.h | 4 ++-- src/DbStructureModel.h | 4 ++-- src/EditDialog.h | 4 ++-- src/EditTableDialog.h | 4 ++-- src/ExportCsvDialog.h | 4 ++-- src/ExtendedTableWidget.h | 4 ++-- src/FilterTableHeader.h | 4 ++-- src/ImportCsvDialog.h | 4 ++-- src/MainWindow.h | 4 ++-- src/PreferencesDialog.h | 4 ++-- src/SqlExecutionArea.h | 4 ++-- src/VacuumDialog.h | 4 ++-- src/gen_version.h | 4 ++-- src/tests/TestImport.h | 4 ++-- src/tests/testsqlobjects.h | 5 +++++ 18 files changed, 43 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76a559b7..7fd1825e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,25 +129,25 @@ endif() # get git version hash if(EXISTS ${CMAKE_SOURCE_DIR}/.git) add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/src/gen_version.h - COMMAND echo "#ifndef __VERSION_H__" > ${CMAKE_SOURCE_DIR}/src/gen_version.h - COMMAND echo "#define __VERSION_H__" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h + COMMAND echo "#ifndef GEN_VERSION_H" > ${CMAKE_SOURCE_DIR}/src/gen_version.h + COMMAND echo "#define GEN_VERSION_H" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h COMMAND git log -n1 "--format=#define APP_VERSION \"%h_git\"" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h COMMAND echo "#define MAJOR_VERSION 999" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h COMMAND echo "#define MINOR_VERSION 0" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h COMMAND echo "#define PATCH_VERSION 0" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h - COMMAND echo "#endif" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h + COMMAND echo "#endif\n" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h DEPENDS .git/HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} VERBATIM) else() file(WRITE ${CMAKE_SOURCE_DIR}/src/gen_version.h - "#ifndef __GEN_VERSIONS_H__\n" - "#define __GEN_VERSIONS_H__\n" + "#ifndef GEN_VERSION_H\n" + "#define GEN_VERSION_H\n" "#define APP_VERSION \"3.0.1\"\n" "#define MAJOR_VERSION 3\n" "#define MINOR_VERSION 0\n" "#define PATCH_VERSION 1\n" - "#endif") + "#endif\n") endif() #icon and correct libs/subsystem for windows diff --git a/src/AboutDialog.h b/src/AboutDialog.h index 5847175d..7eed5c72 100644 --- a/src/AboutDialog.h +++ b/src/AboutDialog.h @@ -1,5 +1,5 @@ -#ifndef __ABOUTDIALOG_H__ -#define __ABOUTDIALOG_H__ +#ifndef ABOUTDIALOG_H +#define ABOUTDIALOG_H #include diff --git a/src/Application.h b/src/Application.h index f0a07e14..03f1cabc 100644 --- a/src/Application.h +++ b/src/Application.h @@ -1,5 +1,5 @@ -#ifndef __APPLICATION_H__ -#define __APPLICATION_H__ +#ifndef APPLICATION_H +#define APPLICATION_H #include diff --git a/src/CreateIndexDialog.h b/src/CreateIndexDialog.h index 56412c92..63930eb5 100644 --- a/src/CreateIndexDialog.h +++ b/src/CreateIndexDialog.h @@ -1,5 +1,5 @@ -#ifndef __CREATEINDEXDIALOG_H__ -#define __CREATEINDEXDIALOG_H__ +#ifndef CREATEINDEXDIALOG_H +#define CREATEINDEXDIALOG_H #include diff --git a/src/DbStructureModel.h b/src/DbStructureModel.h index 72ab5468..49ae7e66 100644 --- a/src/DbStructureModel.h +++ b/src/DbStructureModel.h @@ -1,5 +1,5 @@ -#ifndef __DBSTRUCTUREMODEL_H__ -#define __DBSTRUCTUREMODEL_H__ +#ifndef DBSTRUCTUREMODEL_H +#define DBSTRUCTUREMODEL_H #include diff --git a/src/EditDialog.h b/src/EditDialog.h index 0ee58802..4b605d96 100644 --- a/src/EditDialog.h +++ b/src/EditDialog.h @@ -1,5 +1,5 @@ -#ifndef __EDITDIALOG_H__ -#define __EDITDIALOG_H__ +#ifndef EDITDIALOG_H +#define EDITDIALOG_H #include diff --git a/src/EditTableDialog.h b/src/EditTableDialog.h index 7ed74a7f..beac9f46 100644 --- a/src/EditTableDialog.h +++ b/src/EditTableDialog.h @@ -1,5 +1,5 @@ -#ifndef __EDITTABLEDIALOG_H__ -#define __EDITTABLEDIALOG_H__ +#ifndef EDITTABLEDIALOG_H +#define EDITTABLEDIALOG_H #include "sqlitetypes.h" diff --git a/src/ExportCsvDialog.h b/src/ExportCsvDialog.h index f69d669c..c66f8fdc 100644 --- a/src/ExportCsvDialog.h +++ b/src/ExportCsvDialog.h @@ -1,5 +1,5 @@ -#ifndef __EXPORTCSVDIALOG_H__ -#define __EXPORTCSVDIALOG_H__ +#ifndef EXPORTCSVDIALOG_H +#define EXPORTCSVDIALOG_H #include diff --git a/src/ExtendedTableWidget.h b/src/ExtendedTableWidget.h index 2353b0e8..cb1d515b 100644 --- a/src/ExtendedTableWidget.h +++ b/src/ExtendedTableWidget.h @@ -1,5 +1,5 @@ -#ifndef __EXTENDEDTABLEWIDGET_H__ -#define __EXTENDEDTABLEWIDGET_H__ +#ifndef EXTENDEDTABLEWIDGET_H +#define EXTENDEDTABLEWIDGET_H #include #include "FilterTableHeader.h" diff --git a/src/FilterTableHeader.h b/src/FilterTableHeader.h index 1a7aa050..a988f220 100644 --- a/src/FilterTableHeader.h +++ b/src/FilterTableHeader.h @@ -1,5 +1,5 @@ -#ifndef __FILTERTABLEHEADER_H__ -#define __FILTERTABLEHEADER_H__ +#ifndef FILTERTABLEHEADER_H +#define FILTERTABLEHEADER_H #include #include diff --git a/src/ImportCsvDialog.h b/src/ImportCsvDialog.h index 149b5778..bb5e856e 100644 --- a/src/ImportCsvDialog.h +++ b/src/ImportCsvDialog.h @@ -1,5 +1,5 @@ -#ifndef __IMPORTCSVDIALOG_H__ -#define __IMPORTCSVDIALOG_H__ +#ifndef IMPORTCSVDIALOG_H +#define IMPORTCSVDIALOG_H #include diff --git a/src/MainWindow.h b/src/MainWindow.h index bc66c1ac..4e14ea3a 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -1,5 +1,5 @@ -#ifndef MAINFORM_H -#define MAINFORM_H +#ifndef MAINWINDOW_H +#define MAINWINDOW_H #include "sqltextedit.h" #include "sqlitedb.h" diff --git a/src/PreferencesDialog.h b/src/PreferencesDialog.h index d5e649c7..3b7e4cc1 100644 --- a/src/PreferencesDialog.h +++ b/src/PreferencesDialog.h @@ -1,5 +1,5 @@ -#ifndef __PREFERENCESDIALOG_H__ -#define __PREFERENCESDIALOG_H__ +#ifndef PREFERENCESDIALOG_H +#define PREFERENCESDIALOG_H #include #include diff --git a/src/SqlExecutionArea.h b/src/SqlExecutionArea.h index 79c263eb..2c672b70 100644 --- a/src/SqlExecutionArea.h +++ b/src/SqlExecutionArea.h @@ -1,5 +1,5 @@ -#ifndef __SQLEXECUTIONAREA_H__ -#define __SQLEXECUTIONAREA_H__ +#ifndef SQLEXECUTIONAREA_H +#define SQLEXECUTIONAREA_H #include "sqltextedit.h" diff --git a/src/VacuumDialog.h b/src/VacuumDialog.h index bff430a2..7ba8cba7 100644 --- a/src/VacuumDialog.h +++ b/src/VacuumDialog.h @@ -1,5 +1,5 @@ -#ifndef __VACUUMDIALOG_H__ -#define __VACUUMDIALOG_H__ +#ifndef VACUUMDIALOG_H +#define VACUUMDIALOG_H #include diff --git a/src/gen_version.h b/src/gen_version.h index 43790f93..a906a569 100644 --- a/src/gen_version.h +++ b/src/gen_version.h @@ -1,5 +1,5 @@ -#ifndef __GEN_VERSIONS_H__ -#define __GEN_VERSIONS_H__ +#ifndef GEN_VERSION_H +#define GEN_VERSION_H #define APP_VERSION "master_git" #define MAJOR_VERSION 999 #define MINOR_VERSION 0 diff --git a/src/tests/TestImport.h b/src/tests/TestImport.h index ed78527b..c2b252bd 100644 --- a/src/tests/TestImport.h +++ b/src/tests/TestImport.h @@ -1,5 +1,5 @@ -#ifndef __TESTIMPORT_H__ -#define __TESTIMPORT_H__ +#ifndef TESTIMPORT_H +#define TESTIMPORT_H #include diff --git a/src/tests/testsqlobjects.h b/src/tests/testsqlobjects.h index 8675f87e..d476a2ac 100644 --- a/src/tests/testsqlobjects.h +++ b/src/tests/testsqlobjects.h @@ -1,3 +1,6 @@ +#ifndef TESTSQLOBJECTS_H +#define TESTSQLOBJECTS_H + #include class TestTable: public QObject @@ -20,3 +23,5 @@ private slots: void createTableWithIn(); void createTableWithNotLikeConstraint(); }; + +#endif