NDEVR
API Documentation
TimeException.h
1#pragma once
2#include <NDEVR/Exception.h>
3#include <NDEVR/Translator.h>
4namespace NDEVR
5{
9 class TimeFormatException : public Exception
10 {
11 public:
19 : Exception(_t("Time Format"), false)
23 {}
24
31 : Exception(_t("Time Format"), message, false)
34 , position(Constant<uint04>::Invalid)
35 {}
36
40 {
41 TranslatedString message = _td("invalid_time_position", "Time string, \"[string]\" has invalid format at position [position]. Expected: [format_string]");
42 message.replace("[string]", time_string);
43 message.replace("[position]", String(position));
44 message.replace("[format_string]", format_string);
45 setMessage(_t("Time Validation"));
46 }
47 public:
51 };
52}
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
String format_string
The expected format string that the time string should have matched.
void makeMessage()
Constructs a human-readable error message from the stored time string, format, and position.
uint04 position
The character position in the time string where parsing failed.
TimeFormatException(const StringView &time_string, const StringView &format_string, TranslatedString message)
Constructor initializing with a custom translated error message.
TimeFormatException(const StringView &time_string, const StringView &format_string, uint04 position)
Constructor initializing the exception with a time string, format, and failure position.
String time_string
The original time string that failed to parse.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
TranslatedString & replace(const StringView &sub_string, const TranslatedString &replacement)
Replaces occurrences of a placeholder substring with a translated replacement.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...