LMMS
Loading...
Searching...
No Matches
juce_Result.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
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.
15
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.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
27
32
33Result::Result (const Result& other)
35{
36}
37
39{
41 return *this;
42}
43
45 : errorMessage (std::move (other.errorMessage))
46{
47}
48
50{
51 errorMessage = std::move (other.errorMessage);
52 return *this;
53}
54
55bool Result::operator== (const Result& other) const noexcept
56{
57 return errorMessage == other.errorMessage;
58}
59
60bool Result::operator!= (const Result& other) const noexcept
61{
62 return errorMessage != other.errorMessage;
63}
64
66{
67 return Result (errorMessage.isEmpty() ? "Unknown Error" : errorMessage);
68}
69
74
75bool Result::wasOk() const noexcept { return errorMessage.isEmpty(); }
76Result::operator bool() const noexcept { return errorMessage.isEmpty(); }
77bool Result::failed() const noexcept { return errorMessage.isNotEmpty(); }
78bool Result::operator!() const noexcept { return errorMessage.isNotEmpty(); }
79
80} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
static void message(int level, const char *fmt,...)
Definition adplugdb.cpp:120
bool operator!() const noexcept
Definition Result.cpp:71
const std::string & getErrorMessage() const noexcept
Definition Result.cpp:63
bool operator==(const Result &other) const noexcept
Definition Result.cpp:48
static Result fail(const std::string &errorMessage) noexcept
Definition Result.cpp:58
bool wasOk() const noexcept
Definition Result.cpp:68
bool failed() const noexcept
Definition Result.cpp:70
bool operator!=(const Result &other) const noexcept
Definition Result.cpp:53
Result & operator=(const Result &)
Definition Result.cpp:42
Result() noexcept
Definition Result.cpp:30
Result(const Result &)
Definition juce_Result.cpp:33
String errorMessage
Definition juce_Result.h:104
Definition juce_String.h:53
Definition carla_juce.cpp:31
#define const
Definition zconf.h:137