|
moddef-cpp
Idiomatic C++ runtime for ModDef
|
Error type and Result<T> (spec §26.3/§26.4, §32). More...
#include <expected>#include <string_view>#include "moddef/err.h"Go to the source code of this file.
Namespaces | |
| namespace | moddef |
Typedefs | |
| template<class T > | |
| using | moddef::Result = std::expected< T, Error > |
The canonical result type across the API; Result<void> for actions. | |
Enumerations | |
| enum class | moddef::Error : int { moddef::Ok = MD_OK , moddef::Transport = MD_ERR_TRANSPORT , moddef::Parse = MD_ERR_PARSE , moddef::NotFound = MD_ERR_NOT_FOUND , moddef::ShortRead = MD_ERR_SHORT_READ , moddef::Buffer = MD_ERR_BUFFER , moddef::UnresolvedRef = MD_ERR_UNRESOLVED_REF , moddef::ZeroScaleDenominator = MD_ERR_ZERO_SCALE_DEN , moddef::ComposedBase = MD_ERR_COMPOSED_BASE , moddef::NotWritable = MD_ERR_NOT_WRITABLE , moddef::WrongType = MD_ERR_WRONG_TYPE , moddef::Unsupported = MD_ERR_UNSUPPORTED , moddef::ConstraintMin = MD_ERR_CONSTRAINT_MIN , moddef::ConstraintMax = MD_ERR_CONSTRAINT_MAX , moddef::ConstraintStep = MD_ERR_CONSTRAINT_STEP , moddef::ConstraintAllowed = MD_ERR_CONSTRAINT_ALLOWED , moddef::Discovery = MD_ERR_DISCOVERY , moddef::Unavailable = MD_ERR_UNAVAILABLE } |
Strongly typed mirror of md_err_t (same underlying values, so casts are free in both directions). More... | |
Functions | |
| Error | moddef::from_c (md_err_t e) noexcept |
| md_err_t | moddef::to_c (Error e) noexcept |
| std::string_view | moddef::to_string (Error e) noexcept |
| template<class T > | |
| Result< T > | moddef::ok_or (md_err_t e, T value) |
| Result< void > | moddef::check (md_err_t e) |
Error type and Result<T> (spec §26.3/§26.4, §32).
Thin, exception-free wrappers over the C core's md_err_t — embedded C++ commonly builds with -fno-exceptions, so the API returns std::expected instead of throwing.