diff options
author | crupest <crupest@outlook.com> | 2018-11-25 23:11:06 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-11-25 23:11:06 +0800 |
commit | b88992fd00df7b8c243bc0e7d577ef2aa9437c3f (patch) | |
tree | b67d2be76343d4948b5b7fb57f80ec3d3a379ca7 /src | |
parent | 22322daf6f51da53740ff95ef2eaceed9a6efcae (diff) | |
download | cru-b88992fd00df7b8c243bc0e7d577ef2aa9437c3f.tar.gz cru-b88992fd00df7b8c243bc0e7d577ef2aa9437c3f.tar.bz2 cru-b88992fd00df7b8c243bc0e7d577ef2aa9437c3f.zip |
Reorganize headers and add memory leak check.
Diffstat (limited to 'src')
34 files changed, 113 insertions, 12 deletions
diff --git a/src/any_map.hpp b/src/any_map.hpp index ea6044b1..dfc54f3f 100644 --- a/src/any_map.hpp +++ b/src/any_map.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <any> #include <unordered_map> #include <functional> diff --git a/src/application.hpp b/src/application.hpp index b9427826..a8d59cc8 100644 --- a/src/application.hpp +++ b/src/application.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include <memory> #include <optional> diff --git a/src/base.hpp b/src/base.hpp index fdd736a0..64ce7f6e 100644 --- a/src/base.hpp +++ b/src/base.hpp @@ -1,8 +1,7 @@ #pragma once // ReSharper disable once CppUnusedIncludeDirective -#include "global_macros.hpp" - +#include "pre.hpp" #include <string> #include <stdexcept> diff --git a/src/cru_debug.hpp b/src/cru_debug.hpp index ed6fcaf6..17cc7b53 100644 --- a/src/cru_debug.hpp +++ b/src/cru_debug.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <functional> #include "base.hpp" diff --git a/src/cru_event.hpp b/src/cru_event.hpp index 76a36b22..69832a0e 100644 --- a/src/cru_event.hpp +++ b/src/cru_event.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <type_traits> #include <functional> #include <unordered_map> diff --git a/src/exception.hpp b/src/exception.hpp index 68558478..b8cef604 100644 --- a/src/exception.hpp +++ b/src/exception.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include <optional> diff --git a/src/format.hpp b/src/format.hpp index 3f6253ff..efd25f89 100644 --- a/src/format.hpp +++ b/src/format.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "base.hpp" namespace cru diff --git a/src/global_macros.hpp b/src/global_macros.hpp deleted file mode 100644 index eda57187..00000000 --- a/src/global_macros.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#ifdef _DEBUG -#define CRU_DEBUG -#endif - -#ifdef CRU_DEBUG -#define CRU_DEBUG_LAYOUT -#endif diff --git a/src/graph/graph.hpp b/src/graph/graph.hpp index 7771b48f..440b0594 100644 --- a/src/graph/graph.hpp +++ b/src/graph/graph.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include <memory> #include <functional> diff --git a/src/main.cpp b/src/main.cpp index 5cc98a72..7b27d95e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,5 @@ +#include "pre.hpp" + #include "application.hpp" #include "ui/window.hpp" #include "ui/controls/linear_layout.hpp" @@ -36,6 +38,10 @@ int APIENTRY wWinMain( LPWSTR lpCmdLine, int nCmdShow) { +#ifdef CRU_DEBUG + _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); +#endif + Application application(hInstance); const auto window = Window::CreateOverlapped(); @@ -225,7 +231,6 @@ int APIENTRY wWinMain( window.AddChild(linear_layout); */ - window->Show(); return application.Run(); diff --git a/src/math_util.hpp b/src/math_util.hpp index 7b286346..b9830d6b 100644 --- a/src/math_util.hpp +++ b/src/math_util.hpp @@ -1,6 +1,9 @@ #pragma once // ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + +// ReSharper disable once CppUnusedIncludeDirective #include <type_traits> #include <optional> diff --git a/src/pre.hpp b/src/pre.hpp new file mode 100644 index 00000000..03c51a94 --- /dev/null +++ b/src/pre.hpp @@ -0,0 +1,18 @@ +#pragma once + +#ifdef _DEBUG +#define CRU_DEBUG +#endif + +#ifdef CRU_DEBUG +#define CRU_DEBUG_LAYOUT +#endif + + +#ifdef CRU_DEBUG +// ReSharper disable once IdentifierTypo +// ReSharper disable once CppInconsistentNaming +#define _CRTDBG_MAP_ALLOC +#include <cstdlib> +#include <crtdbg.h> +#endif diff --git a/src/system_headers.hpp b/src/system_headers.hpp index d471678a..eabc7c25 100644 --- a/src/system_headers.hpp +++ b/src/system_headers.hpp @@ -1,5 +1,7 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" //include system headers diff --git a/src/timer.hpp b/src/timer.hpp index 3488db45..5055a3d8 100644 --- a/src/timer.hpp +++ b/src/timer.hpp @@ -1,5 +1,7 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" #include "system_headers.hpp" #include <map> diff --git a/src/ui/animations/animation.hpp b/src/ui/animations/animation.hpp index f25e4699..2226f021 100644 --- a/src/ui/animations/animation.hpp +++ b/src/ui/animations/animation.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <unordered_map> #include "base.hpp" diff --git a/src/ui/border_property.hpp b/src/ui/border_property.hpp index 7766f5a3..4dee0e0f 100644 --- a/src/ui/border_property.hpp +++ b/src/ui/border_property.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include "base.hpp" diff --git a/src/ui/control.hpp b/src/ui/control.hpp index 1ce4afe3..5f5285b6 100644 --- a/src/ui/control.hpp +++ b/src/ui/control.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include <unordered_map> #include <any> diff --git a/src/ui/controls/button.hpp b/src/ui/controls/button.hpp index 50640b11..c53f7ed9 100644 --- a/src/ui/controls/button.hpp +++ b/src/ui/controls/button.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <initializer_list> #include "ui/control.hpp" diff --git a/src/ui/controls/frame_layout.hpp b/src/ui/controls/frame_layout.hpp index ca022780..45971584 100644 --- a/src/ui/controls/frame_layout.hpp +++ b/src/ui/controls/frame_layout.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <initializer_list> #include "ui/control.hpp" diff --git a/src/ui/controls/linear_layout.hpp b/src/ui/controls/linear_layout.hpp index b7ca42ec..deb51bd1 100644 --- a/src/ui/controls/linear_layout.hpp +++ b/src/ui/controls/linear_layout.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "ui/control.hpp" namespace cru::ui::controls diff --git a/src/ui/controls/list_item.hpp b/src/ui/controls/list_item.hpp index 1de89b5f..a77d13e6 100644 --- a/src/ui/controls/list_item.hpp +++ b/src/ui/controls/list_item.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <map> #include <initializer_list> diff --git a/src/ui/controls/popup_menu.hpp b/src/ui/controls/popup_menu.hpp index d47e3eb6..a2916590 100644 --- a/src/ui/controls/popup_menu.hpp +++ b/src/ui/controls/popup_menu.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <vector> #include <utility> #include <functional> diff --git a/src/ui/controls/scroll_control.hpp b/src/ui/controls/scroll_control.hpp index faf192ad..76762f21 100644 --- a/src/ui/controls/scroll_control.hpp +++ b/src/ui/controls/scroll_control.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <optional> #include <initializer_list> diff --git a/src/ui/controls/text_block.hpp b/src/ui/controls/text_block.hpp index 4d017da5..66f5defa 100644 --- a/src/ui/controls/text_block.hpp +++ b/src/ui/controls/text_block.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "text_control.hpp" namespace cru::ui::controls diff --git a/src/ui/controls/text_box.hpp b/src/ui/controls/text_box.hpp index 65f81fc3..3a30ecb2 100644 --- a/src/ui/controls/text_box.hpp +++ b/src/ui/controls/text_box.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "text_control.hpp" #include "timer.hpp" diff --git a/src/ui/controls/text_control.hpp b/src/ui/controls/text_control.hpp index 93120a44..762d85f3 100644 --- a/src/ui/controls/text_control.hpp +++ b/src/ui/controls/text_control.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "ui/control.hpp" namespace cru::ui::controls diff --git a/src/ui/controls/toggle_button.hpp b/src/ui/controls/toggle_button.hpp index 5de40ca5..4cbb4f37 100644 --- a/src/ui/controls/toggle_button.hpp +++ b/src/ui/controls/toggle_button.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "ui/control.hpp" namespace cru::ui::controls diff --git a/src/ui/convert_util.hpp b/src/ui/convert_util.hpp index 6deb7fff..5408f2e4 100644 --- a/src/ui/convert_util.hpp +++ b/src/ui/convert_util.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include "ui_base.hpp" diff --git a/src/ui/cursor.hpp b/src/ui/cursor.hpp index 0b056365..273e524d 100644 --- a/src/ui/cursor.hpp +++ b/src/ui/cursor.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include <memory> diff --git a/src/ui/events/ui_event.hpp b/src/ui/events/ui_event.hpp index c0585506..cc651832 100644 --- a/src/ui/events/ui_event.hpp +++ b/src/ui/events/ui_event.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include <optional> diff --git a/src/ui/layout_base.hpp b/src/ui/layout_base.hpp index 7ae6f65c..2ae21837 100644 --- a/src/ui/layout_base.hpp +++ b/src/ui/layout_base.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <unordered_set> #include "base.hpp" diff --git a/src/ui/ui_base.hpp b/src/ui/ui_base.hpp index aaba343e..b898b2ed 100644 --- a/src/ui/ui_base.hpp +++ b/src/ui/ui_base.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include <optional> diff --git a/src/ui/ui_manager.hpp b/src/ui/ui_manager.hpp index 9ad68eff..f0e1e8ce 100644 --- a/src/ui/ui_manager.hpp +++ b/src/ui/ui_manager.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include "base.hpp" diff --git a/src/ui/window.hpp b/src/ui/window.hpp index a3fba57a..7c82bf89 100644 --- a/src/ui/window.hpp +++ b/src/ui/window.hpp @@ -1,5 +1,8 @@ #pragma once +// ReSharper disable once CppUnusedIncludeDirective +#include "pre.hpp" + #include "system_headers.hpp" #include <map> #include <memory> |