Atmosphere/libraries/libstratosphere/source/htcfs/htcfs_result.hpp

56 lines
1.9 KiB
C++
Raw Normal View History

2021-02-13 06:07:34 +00:00
/*
* Copyright (c) Atmosphère-NX
2021-02-13 06:07:34 +00:00
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stratosphere.hpp>
#include "htcfs_client_impl.hpp"
namespace ams::htcfs {
enum class HtcfsResult {
Success = 0,
UnknownError = 1,
UnsupportedProtocolVersion = 2,
InvalidRequest = 3,
InvalidHandle = 4,
OutOfHandle = 5,
Ready = 6,
2021-02-13 06:07:34 +00:00
};
inline Result ConvertHtcfsResult(HtcfsResult result) {
switch (result) {
case HtcfsResult::Success:
2022-03-26 07:14:36 +00:00
R_SUCCEED();
2021-02-13 06:07:34 +00:00
case HtcfsResult::UnknownError:
2022-03-26 07:14:36 +00:00
R_THROW(htcfs::ResultUnknownError());
2021-02-13 06:07:34 +00:00
case HtcfsResult::UnsupportedProtocolVersion:
2022-03-26 07:14:36 +00:00
R_THROW(htcfs::ResultUnsupportedProtocolVersion());
2021-02-13 06:07:34 +00:00
case HtcfsResult::InvalidRequest:
2022-03-26 07:14:36 +00:00
R_THROW(htcfs::ResultInvalidRequest());
2021-02-13 06:07:34 +00:00
case HtcfsResult::InvalidHandle:
2022-03-26 07:14:36 +00:00
R_THROW(htcfs::ResultInvalidHandle());
2021-02-13 06:07:34 +00:00
case HtcfsResult::OutOfHandle:
2022-03-26 07:14:36 +00:00
R_THROW(htcfs::ResultOutOfHandle());
2021-02-13 06:07:34 +00:00
default:
2022-03-26 07:14:36 +00:00
R_THROW(htcfs::ResultUnknownError());
2021-02-13 06:07:34 +00:00
}
}
inline Result ConvertHtcfsResult(s64 param) {
R_RETURN(ConvertHtcfsResult(static_cast<HtcfsResult>(param)));
2021-02-13 06:07:34 +00:00
}
}