/* * SPDX-License-Identifier: GPL-3.0-only * MuseScore-CLA-applies * * MuseScore * Music Composition & Notation * * Copyright (C) 2021 MuseScore BVBA and others * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef MU_LEARN_LEARNERRORS_H #define MU_LEARN_LEARNERRORS_H #include "ret.h" #include "translation.h" namespace mu::learn { enum class Err { Undefined = int(Ret::Code::Undefined), NoError = int(Ret::Code::Ok), UnknownError = int(Ret::Code::LearnFirst), PlaylistIsEmpty, }; inline Ret make_ret(Err e) { int retCode = static_cast(e); switch (e) { case Err::Undefined: return Ret(retCode); case Err::NoError: return Ret(retCode); case Err::UnknownError: return Ret(retCode); case Err::PlaylistIsEmpty: return Ret(retCode, trc("learn", "Received an empty list of playlist items")); } return Ret(static_cast(e)); } } #endif // MU_LEARN_LEARNERRORS_H