forked from Thyodas/rtype
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from NexoEngine/dev
fix: fix sonar issues, suppressed warning, improved coverage
- Loading branch information
Showing
51 changed files
with
867 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,44 @@ | ||
//// Exception.hpp //////////////////////////////////////////////////////////// | ||
// | ||
// zzzzz zzz zzzzzzzzzzzzz zzzz zzzz zzzzzz zzzzz | ||
// zzzzzzz zzz zzzz zzzz zzzz zzzz | ||
// zzz zzz zzz zzzzzzzzzzzzz zzzz zzzz zzz | ||
// zzz zzz zzz z zzzz zzzz zzzz zzzz | ||
// zzz zzz zzzzzzzzzzzzz zzzz zzz zzzzzzz zzzzz | ||
// | ||
// Author: Mehdy MORVAN | ||
// Date: 12/11/2024 | ||
// Description: Common header file for the nexo base exception class | ||
// | ||
/////////////////////////////////////////////////////////////////////////////// | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace nexo { | ||
class Exception : public std::exception { | ||
public: | ||
explicit Exception(std::string message, const char *file = __FILE__, const int line = __LINE__) | ||
: message(std::move(message)), file(file), line(line) {} | ||
|
||
const char *what() const noexcept override; | ||
|
||
const std::string &getMessage() const noexcept { return message; } | ||
const char *getFile() const noexcept { return file; } | ||
int getLine() const noexcept { return line; } | ||
|
||
protected: | ||
std::string formatMessage() const; | ||
|
||
private: | ||
std::string message; | ||
const char *file; | ||
int line; | ||
mutable std::string formattedMessage; | ||
}; | ||
} | ||
//// Exception.hpp //////////////////////////////////////////////////////////// | ||
// | ||
// zzzzz zzz zzzzzzzzzzzzz zzzz zzzz zzzzzz zzzzz | ||
// zzzzzzz zzz zzzz zzzz zzzz zzzz | ||
// zzz zzz zzz zzzzzzzzzzzzz zzzz zzzz zzz | ||
// zzz zzz zzz z zzzz zzzz zzzz zzzz | ||
// zzz zzz zzzzzzzzzzzzz zzzz zzz zzzzzzz zzzzz | ||
// | ||
// Author: Mehdy MORVAN | ||
// Date: 12/11/2024 | ||
// Description: Common header file for the nexo base exception class | ||
// | ||
/////////////////////////////////////////////////////////////////////////////// | ||
#pragma once | ||
|
||
#include <string> | ||
#include <source_location> | ||
|
||
namespace nexo { | ||
class Exception : public std::exception { | ||
public: | ||
explicit Exception(std::string message, const std::source_location loc) | ||
: message(std::move(message)), file(loc.file_name()), line(loc.line()) {} | ||
|
||
const char *what() const noexcept override; | ||
|
||
const std::string &getMessage() const noexcept { return message; } | ||
const char *getFile() const noexcept { return file; } | ||
unsigned int getLine() const noexcept { return line; } | ||
|
||
protected: | ||
std::string formatMessage() const; | ||
|
||
private: | ||
std::string message; | ||
const char *file; | ||
unsigned int line; | ||
mutable std::string formattedMessage; | ||
}; | ||
} | ||
|
||
#define THROW_EXCEPTION(ExceptionType, ...) \ | ||
throw ExceptionType(__VA_OPT__(__VA_ARGS__,) __FILE__, __LINE__) | ||
throw ExceptionType(__VA_OPT__(__VA_ARGS__,) std::source_location::current()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.