2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
20 ==============================================================================
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
;
65 Result
Result::fail (const String
& errorMessage
) noexcept
67 return Result (errorMessage
.isEmpty() ? "Unknown Error" : errorMessage
);
70 const String
& Result::getErrorMessage() const noexcept
75 bool Result::wasOk() const noexcept
{ return errorMessage
.isEmpty(); }
76 Result::operator bool() const noexcept
{ return errorMessage
.isEmpty(); }
77 bool Result::failed() const noexcept
{ return errorMessage
.isNotEmpty(); }
78 bool Result::operator!() const noexcept
{ return errorMessage
.isNotEmpty(); }