Skip to content

Commit

Permalink
Replace #pragma once with include guards (#ifndef/...)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassross committed Jan 15, 2016
1 parent 5199300 commit 44f9da7
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ while/if (a > 3)
- Use only spaces, and indent 4 spaces at a time. We use spaces for indentation. Do not use tabs in your code. You should set your editor to emit spaces when you hit the tab key.

### Precautions
- Every header file must have the #pragma once directive as a multiple inclusion guard (header guard).
- Every header file must have a `#ifndef/#define <header>` include guard.
- Avoid multiple inheritance if at all possible, especially with Qt classes.
- Keep your code well documented, but don't go overboard. Classes and involved functions should be **described** in the interface and **explained** in the implementation.
- Try to keep functions short -- if a given function reaches 100 lines in length, consider splitting it up into smaller pieces.
Expand Down
6 changes: 5 additions & 1 deletion Source/AddGameWizard.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once
#ifndef _ADDGAMEWIZARD_H_
#define _ADDGAMEWIZARD_H_

#include "Database.h"
#include "Defines.h"
#include <QWizard>
Expand Down Expand Up @@ -55,3 +57,5 @@ Q_OBJECT
public:
LastPage(QWidget* parent = 0);
};

#endif
5 changes: 4 additions & 1 deletion Source/BorderlessWindow.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _BORDERLESSWINDOW_H_
#define _BORDERLESSWINDOW_H_

#include "WinWindow.h"

Expand Down Expand Up @@ -66,3 +67,5 @@ class BorderlessWindow
SizeType minimumSize;
SizeType maximumSize;
};

#endif
6 changes: 5 additions & 1 deletion Source/DRMSetupWizard.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once
#ifndef _DRMSETUPWIZARD_H_
#define _DRMSETUPWIZARD_H_

#include "Database.h"
#include "Defines.h"

Expand Down Expand Up @@ -138,3 +140,5 @@ class FinalPage : public QWizardPage
public:
FinalPage(QWidget* parent = 0);
};

#endif
5 changes: 4 additions & 1 deletion Source/Database.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _DATABASE_H_
#define _DATABASE_H_

#include <QSqlQuery>
#include <QtWidgets>
Expand Down Expand Up @@ -55,3 +56,5 @@ class Database : public QObject

QString path;
};

#endif
5 changes: 4 additions & 1 deletion Source/Init.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _INIT_H_
#define _INIT_H_

#include <QApplication>
#include <QFontDatabase>
Expand Down Expand Up @@ -127,3 +128,5 @@ void initFonts(QApplication &application)
}
}
}

#endif
5 changes: 4 additions & 1 deletion Source/Library.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _LIBRARY_H_
#define _LIBRARY_H_

class LibraryGridView;

Expand Down Expand Up @@ -37,3 +38,5 @@ class Library : public QWidget

void init(QSettings* p);
};

#endif
4 changes: 3 additions & 1 deletion Source/Libs/SteamVdfParse.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _STEAMVDFPARSE_H_
#define _STEAMVDFPARSE_H_

#include <boost/property_tree/ptree.hpp>

Expand Down Expand Up @@ -222,3 +223,4 @@ inline std::unordered_map<int, GameHeader> parseVdf(std::string location)
}
}

#endif
5 changes: 4 additions & 1 deletion Source/MainPanel.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _MAINPANEL_H_
#define _MAINPANEL_H_

#include "TabWidget.h"
#include "Navbar.h"
Expand Down Expand Up @@ -118,3 +119,5 @@ private slots:
settings->show();
}
};

#endif
5 changes: 4 additions & 1 deletion Source/Navbar.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _NAVBAR_H_
#define _NAVBAR_H_

#include "TabWidget.h"

Expand All @@ -21,3 +22,5 @@ class Navbar : public QWidget
protected:
void paintEvent(QPaintEvent* event);
};

#endif
6 changes: 5 additions & 1 deletion Source/Settings.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once
#ifndef _SETTINGS_H_
#define _SETTINGS_H_

#include "Library.h"

#include <QtWidgets>
Expand Down Expand Up @@ -48,3 +50,5 @@ private slots:
signals:
void didUpdateFeedURLs();
};

#endif
5 changes: 4 additions & 1 deletion Source/TabWidget.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _TABWIDGET_H_
#define _TABWIDGET_H_

#include <QWidget>
#include <QSettings>
Expand Down Expand Up @@ -56,3 +57,5 @@ private slots:
void toggleHovered();
void toggleUnhovered();
};

#endif
5 changes: 4 additions & 1 deletion Source/UnixPanel.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _UNIXPANEL_H_
#define _UNIXPANEL_H_

#include "MainPanel.h"

Expand All @@ -20,3 +21,5 @@ public slots:
UnixWindow* unixPanel;

};

#endif
5 changes: 4 additions & 1 deletion Source/UnixWindow.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _UNIXWINDOW_H_
#define _UNIXWINDOW_H_

#include "UnixPanel.h"

Expand All @@ -23,3 +24,5 @@ class UnixWindow : public QWidget
void mouseReleaseEvent(QMouseEvent* evt);
void mouseMoveEvent(QMouseEvent* evt);
};

#endif
6 changes: 4 additions & 2 deletions Source/WinPanel.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _WINPANEL_H_
#define _WINPANEL_H_

#include "MainPanel.h"

Expand All @@ -18,5 +19,6 @@ public slots:

private:
WinWindow* winPanel;

};

#endif
5 changes: 4 additions & 1 deletion Source/WinWindow.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef _WINWINDOW_H_
#define _WINWINDOW_H_

#include "QWinWidget.h"
#include "WinPanel.h"
Expand All @@ -23,3 +24,5 @@ class WinWindow : public QWinWidget
HWND windowHandle;
WinPanel* mainPanel;
};

#endif

0 comments on commit 44f9da7

Please sign in to comment.