openshot-audio  0.1.7
Public Member Functions | Static Public Member Functions | List of all members
juce::Result Class Reference

#include <juce_core.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 &)
 
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());
}

Constructor & Destructor Documentation

◆ Result()

Result::Result ( const Result &  other)

Member Function Documentation

◆ fail()

Result Result::fail ( const String &  errorMessage)
staticnoexcept

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

◆ failed()

bool 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.

◆ getErrorMessage()

const String & 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;

◆ ok()

static Result juce::Result::ok ( )
inlinestaticnoexcept

Creates and returns a 'successful' result.

◆ operator bool()

Result::operator bool ( ) const
noexcept

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

◆ operator!()

bool Result::operator! ( ) const
noexcept

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

◆ operator!=()

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

◆ operator=()

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

◆ operator==()

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

◆ wasOk()

bool Result::wasOk ( ) const
noexcept

Returns true if this result indicates a success.


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