Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. Result::Result() noexcept {}
  24. Result::Result (const String& message) noexcept
  25. : errorMessage (message)
  26. {
  27. }
  28. Result::Result (const Result& other)
  29. : errorMessage (other.errorMessage)
  30. {
  31. }
  32. Result& Result::operator= (const Result& other)
  33. {
  34. errorMessage = other.errorMessage;
  35. return *this;
  36. }
  37. #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
  38. Result::Result (Result&& other) noexcept
  39. : errorMessage (static_cast<String&&> (other.errorMessage))
  40. {
  41. }
  42. Result& Result::operator= (Result&& other) noexcept
  43. {
  44. errorMessage = static_cast<String&&> (other.errorMessage);
  45. return *this;
  46. }
  47. #endif
  48. bool Result::operator== (const Result& other) const noexcept
  49. {
  50. return errorMessage == other.errorMessage;
  51. }
  52. bool Result::operator!= (const Result& other) const noexcept
  53. {
  54. return errorMessage != other.errorMessage;
  55. }
  56. Result Result::fail (const String& errorMessage) noexcept
  57. {
  58. return Result (errorMessage.isEmpty() ? "Unknown Error" : errorMessage);
  59. }
  60. const String& Result::getErrorMessage() const noexcept
  61. {
  62. return errorMessage;
  63. }
  64. bool Result::wasOk() const noexcept { return errorMessage.isEmpty(); }
  65. Result::operator bool() const noexcept { return errorMessage.isEmpty(); }
  66. bool Result::failed() const noexcept { return errorMessage.isNotEmpty(); }
  67. bool Result::operator!() const noexcept { return errorMessage.isNotEmpty(); }