26 Result::Result() noexcept {}
28 Result::Result (
const String& message) noexcept
29 : errorMessage (message)
33 Result::Result (
const Result& other)
34 : errorMessage (other.errorMessage)
38 Result& Result::operator= (
const Result& other)
40 errorMessage = other.errorMessage;
44 Result::Result (Result&& other) noexcept
45 : errorMessage (std::move (other.errorMessage))
49 Result& Result::operator= (Result&& other) noexcept
51 errorMessage = std::move (other.errorMessage);
55 bool Result::operator== (
const Result& other)
const noexcept
57 return errorMessage == other.errorMessage;
60 bool Result::operator!= (
const Result& other)
const noexcept
62 return errorMessage != other.errorMessage;
67 return Result (errorMessage.isEmpty() ?
"Unknown Error" : errorMessage);
76 Result::operator bool() const noexcept {
return errorMessage.isEmpty(); }
static Result fail(const String &errorMessage) noexcept
Creates a 'failure' result.
bool wasOk() const noexcept
Returns true if this result indicates a success.
const String & getErrorMessage() const noexcept
Returns the error message that was set when this result was created.
Represents the 'success' or 'failure' of an operation, and holds an associated error message to descr...
bool operator!() const noexcept
Returns true if this result indicates a failure.
bool failed() const noexcept
Returns true if this result indicates a failure.