| 1 | #pragma once |
| 2 | |
| 3 | #include <hostio/seadHostIOReflexible.h> |
| 4 | #include <prim/seadSafeString.h> |
| 5 | #include "utility/aglResParameter.h" |
| 6 | |
| 7 | namespace sead { |
| 8 | class XmlElement; |
| 9 | } |
| 10 | |
| 11 | namespace agl::utl { |
| 12 | |
| 13 | class IParameterObj; |
| 14 | class ParameterBase; |
| 15 | |
| 16 | class IParameterList { |
| 17 | public: |
| 18 | IParameterList(); |
| 19 | virtual ~IParameterList() { ; } |
| 20 | |
| 21 | void addList(IParameterList* child, const sead::SafeString& name); |
| 22 | void addObj(IParameterObj* child, const sead::SafeString& name); |
| 23 | void clearList(); |
| 24 | void clearObj(); |
| 25 | void removeList(IParameterList* child); |
| 26 | void removeObj(IParameterObj* child); |
| 27 | |
| 28 | IParameterObj* getChildObjHead() const { return mpChildObjHead; } |
| 29 | IParameterObj* getChildObjTail() const { return mpChildObjTail; } |
| 30 | IParameterList* getChildListHead() const { return mpChildListHead; } |
| 31 | IParameterList* getChildListTail() const { return mpChildListTail; } |
| 32 | IParameterList* getNext() const { return mNext; } |
| 33 | IParameterList* getParent() const { return mParent; } |
| 34 | |
| 35 | sead::SafeString getName() const; |
| 36 | u32 getNameHash() const { return mNameHash; } |
| 37 | |
| 38 | void applyResParameterList(ResParameterList list); |
| 39 | void applyResParameterList(ResParameterList list1, ResParameterList list2, f32 t); |
| 40 | |
| 41 | bool isComplete(ResParameterList res, bool) const; |
| 42 | |
| 43 | const char* getTagName(); |
| 44 | void createAttribute(sead::XmlElement* element, sead::Heap* heap) const; |
| 45 | void writeToXML(sead::XmlElement* element, sead::Heap* heap); |
| 46 | bool readFromXML(const sead::XmlElement& element, bool x); |
| 47 | |
| 48 | bool verify() const; |
| 49 | bool verifyList() const; |
| 50 | bool verifyObj() const; |
| 51 | bool verifyList(IParameterList* p_check, IParameterList* other) const; |
| 52 | bool verifyObj(IParameterObj* obj1, IParameterObj* obj2) const; |
| 53 | |
| 54 | void sortByHash(); |
| 55 | |
| 56 | #ifdef SEAD_DEBUG |
| 57 | void genMessageParameter(sead::hostio::Context* context); |
| 58 | void listenPropertyEventParameter(sead::hostio::Reflexible* reflexible, |
| 59 | const sead::hostio::PropertyEvent* event); |
| 60 | #endif |
| 61 | |
| 62 | protected: |
| 63 | virtual bool preWrite_() const { return true; } |
| 64 | virtual void postWrite_() const {} |
| 65 | virtual bool preRead_() { return true; } |
| 66 | virtual void postRead_() {} |
| 67 | virtual bool isApply_(ResParameterList list) const { |
| 68 | return list.getParameterListNameHash() == mNameHash; |
| 69 | } |
| 70 | virtual void callbackNotAppliable_(IParameterObj*, ParameterBase*, ResParameterObj) {} |
| 71 | virtual void callbackNotInterpolatable_(IParameterObj*, ParameterBase*, ResParameterObj, |
| 72 | ResParameterObj, ResParameter, ResParameter, f32) {} |
| 73 | |
| 74 | void setParameterListName_(const sead::SafeString& name); |
| 75 | void applyResParameterList_(bool interpolate, ResParameterList l1, ResParameterList l2, f32 t); |
| 76 | ResParameterObj searchResParameterObj_(ResParameterList res, const IParameterObj& obj) const; |
| 77 | IParameterObj* searchChildParameterObj_(ResParameterObj res, IParameterObj* obj) const; |
| 78 | void applyResParameterObjB_(bool interpolate, ResParameterList res, f32 t); |
| 79 | ResParameterList searchResParameterList_(ResParameterList res, |
| 80 | const IParameterList& list) const; |
| 81 | IParameterList* searchChildParameterList_(ResParameterList res) const; |
| 82 | void applyResParameterListB_(bool interpolate, ResParameterList res, f32 t); |
| 83 | |
| 84 | IParameterObj* mpChildObjHead = nullptr; |
| 85 | IParameterObj* mpChildObjTail = nullptr; |
| 86 | IParameterList* mpChildListHead = nullptr; |
| 87 | IParameterList* mpChildListTail = nullptr; |
| 88 | u32 mNameHash; |
| 89 | IParameterList* mNext = nullptr; |
| 90 | IParameterList* mParent = nullptr; |
| 91 | const char* mName; |
| 92 | }; |
| 93 | |
| 94 | class ParameterList : public IParameterList { |
| 95 | public: |
| 96 | using IParameterList::IParameterList; |
| 97 | ~ParameterList() override { ; } |
| 98 | }; |
| 99 | |
| 100 | } // namespace agl::utl |
| 101 | |