Common types¶
Numbers¶
In order to preserve type information – which matters for binary formats such as BYML – when passing types between oead and Python code, several number wrapper classes are used.
In C++, using the wrappers requires no special treatment since they are constructible from and implicitly convertible to numbers.
-
template<typename
T>
structNumber¶ Strongly typed wrapper around arithmetic types to make types clear especially for Python bindings.
Public Functions
-
constexpr
Number()¶
-
constexpr
Number(T v)¶
-
constexpr
operator T() const¶
-
constexpr Number &
operator=(T v)¶
-
constexpr Number &
operator++(int)¶
-
constexpr Number &
operator--(int)¶
-
constexpr Number &
operator++()¶
-
constexpr Number &
operator--()¶
-
constexpr Number &
operator+=(T rhs)¶
-
constexpr Number &
operator-=(T rhs)¶
-
constexpr Number &
operator*=(T rhs)¶
-
constexpr Number &
operator/=(T rhs)¶
-
constexpr Number &
operator%=(T rhs)¶
-
template<>
constexpr Number &operator&=(T rhs)¶
-
constexpr Number &
operator|=(T rhs)¶
-
constexpr Number &
operator<<=(T rhs)¶
-
constexpr Number &
operator>>=(T rhs)¶
Public Members
-
T
value¶
-
constexpr
-
using
oead::U8= Number<std::uint8_t>¶
-
using
oead::U16= Number<std::uint16_t>¶
-
using
oead::U32= Number<std::uint32_t>¶
-
using
oead::U64= Number<std::uint64_t>¶
-
using
oead::S8= Number<std::int8_t>¶
-
using
oead::S16= Number<std::int16_t>¶
-
using
oead::S32= Number<std::int32_t>¶
-
using
oead::S64= Number<std::int64_t>¶
-
using
oead::F32= Number<float>¶
-
using
oead::F64= Number<double>¶
Utils¶
-
template<typename
T>
structVector2¶ 2D vector.
-
using
oead::Vector2f= Vector2<float>¶
-
template<typename
T>
structVector3¶ 3D vector.
-
using
oead::Vector3f= Vector3<float>¶
-
template<typename
T>
structVector4¶ 4D vector.
-
using
oead::Vector4f= Vector4<float>¶
-
template<typename
T>
structQuat¶ Quaternion.
-
using
oead::Quatf= Quat<float>¶
-
struct
Color4f¶ RGBA color (Red/Green/Blue/Alpha).
Strings¶
Note
Any string that is too long to be stored in a FixedSafeString is truncated.
-
template<size_t
N>
structFixedSafeString¶ A string class with its own inline, fixed-size storage.
Public Functions
-
FixedSafeString()¶
-
FixedSafeString(std::string_view str)¶
-
auto &
operator=(const FixedSafeString &other)¶
-
auto &
operator=(std::string_view str)¶
-
operator std::string_view() const¶
-
bool
operator==(const FixedSafeString &other) const¶
-
bool
operator!=(const FixedSafeString &other) const¶
-
Note
In sead, this is actually a derived class of sead::BufferedSafeString
which is in turn derived from sead::SafeString.
Since the latter is essentially a {vptr, const char* cstr} pair and the former is a std::string_view, we will not bother implementing those base classes.