diff options
Diffstat (limited to 'lib/nes/common/status.hh')
| -rw-r--r-- | lib/nes/common/status.hh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/nes/common/status.hh b/lib/nes/common/status.hh new file mode 100644 index 0000000..4b23b60 --- /dev/null +++ b/lib/nes/common/status.hh @@ -0,0 +1,42 @@ +#pragma once + +namespace nes +{ + /// A status code. + enum class status + { + success, + error_system_error, + error_invalid_ines_data, + error_unsupported_mapper, + error_unsupported_instruction, + error_buffer_overflow, + error_invalid_path, + error_invalid_format_string, + }; + + constexpr auto to_string(status const status) -> char const* + { + switch (status) + { + case status::success: + return "Success"; + case status::error_system_error: + return "System error"; + case status::error_invalid_ines_data: + return "Invalid iNES data"; + case status::error_unsupported_mapper: + return "Unsupported mapper"; + case status::error_unsupported_instruction: + return "Unsupported instruction"; + case status::error_buffer_overflow: + return "Buffer overflow"; + case status::error_invalid_path: + return "Invalid path"; + case status::error_invalid_format_string: + return "Invalid format string"; + } + + return "(invalid)"; + } +} // namespace nes
\ No newline at end of file |
