struct Result

Same as TResult, but with no output object.

Public

Constructors

Result

Result() = default

Methods

IsSuccessful

bool IsSuccessful() const

Returns true if the result is one of the success states.

GetFullErrorMessage

String GetFullErrorMessage() const

Returns error message and additional error message as a combined string.

staticSuccess

Creates the success result object.

status
One of the successful result status code.

Returns: Newly created TResult object.

staticFail

static Result Fail(const char *errorMessage, ResultStatus status = ResultStatus::Failed, String additionalErrorMessage = StringUtility::kBlank)

Creates the fail result object.

errorMessage
Error message describing the failure.
status
One of the failure result status code.
additionalErrorMessage
Additional error message for information that cannot easily be stored in .

Returns: Newly created TResult object.

staticFail

static Result Fail(const char *errorMessage, Result &&childResult, const String &additionalErrorMessage = StringUtility::kBlank)

Creates the fail result object by inheriting the status from another result object.

Other result object error message is appended in the additional error message.

errorMessage
Error message describing the failure.
childResult
Result from which to inherit the failure status and append the error message.
additionalErrorMessage
Additional error message for information that cannot easily be stored in . The other result's error message will be appended to this error message.

Returns: Newly created TResult object.

Fields

Status

ErrorMessage

const char * ErrorMessage

AdditionalErrorMessage

String AdditionalErrorMessage

Private

Constructors

Result

Result(ResultStatus status, const char *errorMessage, String additionalErrorMessage = StringUtility::kBlank)

Result

Result(ResultStatus status)

Methods

staticCombineAdditionalErrorMessage

static String CombineAdditionalErrorMessage(const String &additionalErrorMessage, const char *childErrorMessage, const String &childAdditionalErrorMessage)

Combines error messages from two result objects into a string that can be used as an additional string object for the new result object.

additionalErrorMessage
Additional error message for the primary result object.
childErrorMessage
Error message from the child result object. Can be null.
childAdditionalErrorMessage
Additional error message from the child result object.

Returns: Combined string with all three error messages.

staticCombineErrorMessage

static String CombineErrorMessage(const char *errorMessage, const String &additionalErrorMessage)

Combines the error message and additional error message into a single string.