mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-10-12 02:13:06 +00:00
Now that the project targets C++23, use the standard library's std::expected instead of the vendored tl::expected polyfill: - tl::expected -> std::expected, tl::unexpected/tl::make_unexpected -> std::unexpected - .map()/.map_error() -> .transform()/.transform_error() - #include <expected.hpp> -> #include <expected>, grouped with std headers - Remove 3rdParty/tl/expected.hpp (the tl target remains for function_ref.hpp) Co-Authored-By: Claude Fable 5 <[email protected]>
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <expected>
|
|
#include <string>
|
|
|
|
#include "clx_sprite.hpp"
|
|
#include "utils/status_macros.hpp"
|
|
|
|
namespace devilution {
|
|
|
|
OwnedClxSpriteListOrSheet LoadClxListOrSheet(const char *path);
|
|
|
|
std::expected<OwnedClxSpriteListOrSheet, std::string> LoadClxListOrSheetWithStatus(const char *path);
|
|
|
|
inline OwnedClxSpriteList LoadClx(const char *path)
|
|
{
|
|
return LoadClxListOrSheet(path).list();
|
|
}
|
|
|
|
inline std::expected<OwnedClxSpriteList, std::string> LoadClxWithStatus(const char *path)
|
|
{
|
|
ASSIGN_OR_RETURN(OwnedClxSpriteListOrSheet result, LoadClxListOrSheetWithStatus(path));
|
|
return std::move(result).list();
|
|
}
|
|
|
|
inline OwnedClxSpriteSheet LoadClxSheet(const char *path)
|
|
{
|
|
return LoadClxListOrSheet(path).sheet();
|
|
}
|
|
|
|
OptionalOwnedClxSpriteListOrSheet LoadOptionalClxListOrSheet(const char *path);
|
|
|
|
inline OptionalOwnedClxSpriteList LoadOptionalClx(const char *path)
|
|
{
|
|
OptionalOwnedClxSpriteListOrSheet result = LoadOptionalClxListOrSheet(path);
|
|
if (!result)
|
|
return std::nullopt;
|
|
return std::move(*result).list();
|
|
}
|
|
|
|
} // namespace devilution
|