mirror of
https://github.com/zeldaret/ss
synced 2026-05-24 07:10:53 -04:00
26af4db82d
* update from dtk-template and start work towards using clangd * include <a> -> "a" * Update build.yml * remove/add non-trivial class in union warning
38 lines
878 B
C++
38 lines
878 B
C++
#ifndef S_FSTATEFCT_H
|
|
#define S_FSTATEFCT_H
|
|
|
|
// clang-format off
|
|
#include "s/s_StateInterfaces.hpp"
|
|
#include "s/s_FState.hpp"
|
|
#include "s/s_StateID.hpp"
|
|
// clang-format on
|
|
|
|
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
|
|
// See include/s/README.txt for changes made
|
|
|
|
/// @brief A state factory for a given class.
|
|
/// @tparam T The class that this state belongs to.
|
|
/// @ingroup state
|
|
template <class T>
|
|
class sFStateFct_c : public sStateFctIf_c {
|
|
public:
|
|
sFStateFct_c(T &owner) : mState(owner) {}
|
|
|
|
virtual sStateIf_c *build(const sStateIDIf_c &id) {
|
|
if (!id.isNull()) {
|
|
mState.setID((const sFStateID_c<T> *)&id);
|
|
return &mState;
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
virtual void dispose(sStateIf_c *&id) {
|
|
id = nullptr;
|
|
}
|
|
|
|
private:
|
|
sFState_c<T> mState;
|
|
};
|
|
|
|
#endif
|