mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
move code from Diagnostics and Guard to cpp
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1825236544844a508cff5cbc /* Diagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81cf7519bf594fc784d5a8ff /* Diagnostics.cpp */; };
|
||||
3825702bfcdb4591987ec9f6 /* Guard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6fe2e9d5655a47c3bb58aa07 /* Guard.cpp */; };
|
||||
426da7e58564472ba1b7991f /* crash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = a9793fe06a4244938f5d4b61 /* crash.cpp */; };
|
||||
001085F01C90FD030075A2AD /* textinputbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 001085EE1C90FD030075A2AD /* textinputbuffer.c */; };
|
||||
426da7e58564472ba1b7991f /* crash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = a9793fe06a4244938f5d4b61 /* crash.cpp */; };
|
||||
C62A08D51C787C2A00F3AA76 /* drawing_fast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C62A08D41C787C2A00F3AA76 /* drawing_fast.cpp */; };
|
||||
@@ -223,6 +226,9 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
81cf7519bf594fc784d5a8ff /* Diagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Diagnostics.cpp; path = src/core/Diagnostics.cpp; sourceTree = "<group>"; };
|
||||
6fe2e9d5655a47c3bb58aa07 /* Guard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Guard.cpp; path = src/core/Guard.cpp; sourceTree = "<group>"; };
|
||||
a9793fe06a4244938f5d4b61 /* crash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = crash.cpp; path = src/platform/crash.cpp; sourceTree = "<group>"; };
|
||||
001085EE1C90FD030075A2AD /* textinputbuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = textinputbuffer.c; sourceTree = "<group>"; };
|
||||
001085EF1C90FD030075A2AD /* textinputbuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textinputbuffer.h; sourceTree = "<group>"; };
|
||||
C62A08D41C787C2A00F3AA76 /* drawing_fast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drawing_fast.cpp; sourceTree = "<group>"; };
|
||||
@@ -659,6 +665,10 @@
|
||||
D4163F671C2A044D00B83136 /* version.h */,
|
||||
a9793fe06a4244938f5d4b61 /* crash.cpp */,
|
||||
);
|
||||
a9793fe06a4244938f5d4b61 /* crash.cpp */,
|
||||
6fe2e9d5655a47c3bb58aa07 /* Guard.cpp */,
|
||||
81cf7519bf594fc784d5a8ff /* Diagnostics.cpp */,
|
||||
);
|
||||
name = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -1510,6 +1520,10 @@
|
||||
D4EC48701C26342F0024B507 /* viewport.c in Sources */,
|
||||
426da7e58564472ba1b7991f /* crash.cpp in Sources */,
|
||||
);
|
||||
426da7e58564472ba1b7991f /* crash.cpp in Sources */,
|
||||
3825702bfcdb4591987ec9f6 /* Guard.cpp in Sources */,
|
||||
1825236544844a508cff5cbc /* Diagnostics.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
<ClCompile Include="src\cmdline_sprite.c" />
|
||||
<ClCompile Include="src\config.c" />
|
||||
<ClCompile Include="src\core\Console.cpp" />
|
||||
<ClCompile Include="src\core\Diagnostics.cpp" />
|
||||
<ClCompile Include="src\core\Guard.cpp" />
|
||||
<ClCompile Include="src\core\Json.cpp" />
|
||||
<ClCompile Include="src\core\Path.cpp" />
|
||||
<ClCompile Include="src\core\Stopwatch.cpp" />
|
||||
@@ -394,4 +396,4 @@
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
22
src/core/Diagnostics.cpp
Normal file
22
src/core/Diagnostics.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <SDL_platform.h>
|
||||
|
||||
#if defined(DEBUG) && defined(__WINDOWS__)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "Diagnostics.hpp"
|
||||
|
||||
namespace Debug
|
||||
{
|
||||
void Break()
|
||||
{
|
||||
#if DEBUG
|
||||
#if __WINDOWS__
|
||||
if (IsDebuggerPresent()) {
|
||||
DebugBreak();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if _WIN32
|
||||
#include <debugapi.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Utility methods for asserting and logging.
|
||||
*/
|
||||
namespace Debug
|
||||
{
|
||||
void Break()
|
||||
{
|
||||
#if DEBUG
|
||||
#if _WIN32
|
||||
if (IsDebuggerPresent()) {
|
||||
DebugBreak();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
void Break();
|
||||
}
|
||||
|
||||
24
src/core/Guard.cpp
Normal file
24
src/core/Guard.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <cassert>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Console.hpp"
|
||||
#include "Diagnostics.hpp"
|
||||
#include "Guard.hpp"
|
||||
|
||||
namespace Guard
|
||||
{
|
||||
void Assert(bool expression, const char * message)
|
||||
{
|
||||
if (expression) return;
|
||||
|
||||
if (message != nullptr)
|
||||
{
|
||||
Console::Error::WriteLine(message);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
Debug::Break();
|
||||
#endif
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Console.hpp"
|
||||
#include "Diagnostics.hpp"
|
||||
|
||||
/**
|
||||
* Utility methods for asserting function parameters.
|
||||
*/
|
||||
namespace Guard
|
||||
{
|
||||
void Assert(bool expression, const char * message = nullptr)
|
||||
{
|
||||
if (expression) return;
|
||||
|
||||
if (message != nullptr)
|
||||
{
|
||||
Console::Error::WriteLine(message);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
Debug::Break();
|
||||
#endif
|
||||
assert(false);
|
||||
}
|
||||
void Assert(bool expression, const char * message = nullptr);
|
||||
|
||||
template<typename T>
|
||||
void ArgumentNotNull(T * argument, const char * message = nullptr)
|
||||
|
||||
Reference in New Issue
Block a user