VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / modules / juce_core / misc / juce_Result.cpp
blob1a09286e29f170ab11f9f79942e504bd1c212734
1 /*
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
8 licensing.
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
18 DISCLAIMED.
20 ==============================================================================
23 namespace juce
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;
41 return *this;
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);
52 return *this;
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
72 return errorMessage;
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(); }
80 } // namespace juce