43 ::new (&
mResult) Type (std::move(inRHS.mResult));
65 mState = inRHS.mState;
89 mState = inRHS.mState;
94 ::new (&
mResult) Type (std::move(inRHS.mResult));
101 case EState::Invalid:
123 case EState::Invalid:
127 mState = EState::Invalid;
131 bool IsEmpty()
const {
return mState == EState::Invalid; }
134 bool IsValid()
const {
return mState == EState::Valid; }
140 void Set(
const Type &inResult) {
Clear(); ::new (&
mResult) Type(inResult); mState = EState::Valid; }
143 void Set(Type &&inResult) {
Clear(); ::new (&
mResult) Type(std::move(inResult)); mState = EState::Valid; }
146 bool HasError()
const {
return mState == EState::Error; }
164 enum class EState :
uint8
171 EState mState = EState::Invalid;
std::uint8_t uint8
Definition Core.h:454
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
std::basic_string< char, std::char_traits< char >, STLAllocator< char > > String
Definition STLAllocator.h:107
@ Invalid
Next token on the stream was not a valid data type.
Helper class that either contains a valid result or an error.
Definition Result.h:12
bool IsValid() const
Checks if the result is valid.
Definition Result.h:134
void SetError(String &&inError)
Definition Result.h:154
Result(const Result< Type > &inRHS)
Copy constructor.
Definition Result.h:18
void Clear()
Clear result or error.
Definition Result.h:111
void SetError(const char *inError)
Set an error value.
Definition Result.h:152
Type mResult
The actual result object.
Definition Result.h:159
void Set(const Type &inResult)
Set the result value.
Definition Result.h:140
bool HasError() const
Check if we had an error.
Definition Result.h:146
void Set(Type &&inResult)
Set the result value (move value)
Definition Result.h:143
const String & GetError() const
Get the error value.
Definition Result.h:149
Result()
Default constructor.
Definition Result.h:15
bool IsEmpty() const
Checks if the result is still uninitialized.
Definition Result.h:131
const Type & Get() const
Get the result value.
Definition Result.h:137
Result< Type > & operator=(const Result< Type > &inRHS)
Copy assignment.
Definition Result.h:61
~Result()
Destructor.
Definition Result.h:58
void SetError(const string_view &inError)
Definition Result.h:153
Result(Result< Type > &&inRHS) noexcept
Move constructor.
Definition Result.h:37
String mError
The error description if the result failed.
Definition Result.h:160