OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
juce::Result Class Reference

`#include <juce_Result.h>`

## Public Member Functions
bool | wasOk () const noexcept
bool | failed () const noexcept
| operator bool () const noexcept
bool | operator! () const noexcept
const String & | getErrorMessage () const noexcept
| Result (const Result &)
Result & | operator= (const Result &)
| Result (Result &&) noexcept
Result & | operator= (Result &&) noexcept
bool | operator== (const Result &other) const noexcept
bool | operator!= (const Result &other) const noexcept

## Static Public Member Functions
static Result | ok () noexcept
static Result | fail (const String &errorMessage) noexcept

## Detailed Description

Represents the 'success' or 'failure' of an operation, and holds an associated error message to describe the error when there's a failure.

E.g.

Result myOperation()
{
if (doSomeKindOfFoobar())
return Result::ok();
else
return Result::fail ("foobar didn't work!");
}
const Result result (myOperation());
if (result.wasOk())
{
...it's all good...
}
else
{
warnUserAboutFailure ("The foobar operation failed! Error message was: "
+ result.getErrorMessage());
}
juce::Result
Definition: juce_Result.h:57
juce::Result::fail
static Result fail(const String &errorMessage) noexcept
Definition: juce_Result.cpp:65
juce::Result::ok
static Result ok() noexcept
Definition: juce_Result.h:61

Definition at line 56 of file juce_Result.h.

## Constructor & Destructor Documentation

## ◆ Result() [1/2]

juce::Result::Result | ( | const Result & | other | ) |

Definition at line 33 of file juce_Result.cpp.

## ◆ Result() [2/2]

juce::Result::Result | ( | Result && | other | ) |
| noexcept

Definition at line 44 of file juce_Result.cpp.

## Member Function Documentation

## ◆ fail()

Result juce::Result::fail | ( | const String & | errorMessage | ) |
| static noexcept

Creates a 'failure' result. If you pass a blank error message in here, a default "Unknown Error" message will be used instead.

Definition at line 65 of file juce_Result.cpp.

Referenced by juce::JavascriptEngine::callFunction(), juce::JavascriptEngine::callFunctionObject(), juce::File::create(), juce::File::createDirectory(), juce::JavascriptEngine::evaluate(), juce::JavascriptEngine::execute(), juce::JSON::parseQuotedString(), and juce::ZipFile::uncompressEntry().

## ◆ failed()

bool juce::Result::failed | ( |  | ) | const
| noexcept

Returns true if this result indicates a failure. You can use getErrorMessage() to retrieve the error message associated with the failure.

Definition at line 77 of file juce_Result.cpp.

Referenced by juce::XmlElement::writeTo().

## ◆ getErrorMessage()

const String & juce::Result::getErrorMessage | ( |  | ) | const
| noexcept

Returns the error message that was set when this result was created. For a successful result, this will be an empty string;

Definition at line 70 of file juce_Result.cpp.

## ◆ ok()

static Result juce::Result::ok | ( |  | ) |
| inline static noexcept

Creates and returns a 'successful' result.

Definition at line 61 of file juce_Result.h.

Referenced by juce::JavascriptEngine::callFunction(), juce::JavascriptEngine::callFunctionObject(), juce::File::create(), juce::File::createDirectory(), juce::JavascriptEngine::evaluate(), juce::JavascriptEngine::execute(), juce::JSON::parse(), juce::JSON::parseQuotedString(), juce::ZipFile::uncompressEntry(), and juce::ZipFile::uncompressTo().

## ◆ operator bool()

juce::Result::operator bool | ( |  | ) | const
| noexcept

Returns true if this result indicates a success. This is equivalent to calling wasOk().

Definition at line 76 of file juce_Result.cpp.

## ◆ operator!()

bool juce::Result::operator! | ( |  | ) | const
| noexcept

Returns true if this result indicates a failure. This is equivalent to calling failed().

Definition at line 78 of file juce_Result.cpp.

## ◆ operator!=()

bool juce::Result::operator!= | ( | const Result & | other | ) | const
| noexcept

Definition at line 60 of file juce_Result.cpp.

## ◆ operator=() [1/2]

Result & juce::Result::operator= | ( | const Result & | other | ) |

Definition at line 38 of file juce_Result.cpp.

## ◆ operator=() [2/2]

Result & juce::Result::operator= | ( | Result && | other | ) |
| noexcept

Definition at line 49 of file juce_Result.cpp.

## ◆ operator==()

bool juce::Result::operator== | ( | const Result & | other | ) | const
| noexcept

Definition at line 55 of file juce_Result.cpp.

## ◆ wasOk()

bool juce::Result::wasOk | ( |  | ) | const
| noexcept

Returns true if this result indicates a success.

Definition at line 75 of file juce_Result.cpp.

The documentation for this class was generated from the following files:

- juce_Result.h
- juce_Result.cpp