MxRegion: initial implementation (#218)

* MxRegion structures

* MxRegion structures

* Remove junk

* Refactor

* WIP

* Use MxRect32 ctor

* Refactor

* Add MxSize32, match MxRegion ctor

* Add two template annotations

* Fix missing instructions

* Fix another bug

* Refactor

* Add GetPoint

* Implement/match MxRegionTopBottom::MxRegionTopBottom

* Implement/match more functions

* More implementation

* Don't expose internal match

* Fix indent

* Add template annotations

* Implement remaining functions

* Fix comment

* Match loops

* Simplify function

* Merge

* Remove junk

* Format

* Format

* match MxRegion::vtable1c

* revert vtable1c match-hack

This reverts commit 7b88625988.

---------

Co-authored-by: Ramen2X <64166386+Ramen2X@users.noreply.github.com>
This commit is contained in:
Christian Semmler
2023-10-31 11:30:13 -04:00
committed by GitHub
parent cb286520e5
commit 9ac9fe2761
8 changed files with 393 additions and 37 deletions

View File

@@ -97,10 +97,15 @@ public:
MxBool Find(T p_obj);
void Detach();
void Destroy();
MxBool Next(T& p_obj);
MxBool Current(T& p_obj);
void Advance();
MxBool HasMatch() { return m_match != NULL; }
void SetValue(T p_obj);
void Head() { m_match = m_list->m_first; }
void Reset() { m_match = NULL; }
void Prepend(T p_newobj);
private:
MxList<T>* m_list;
@@ -215,6 +220,12 @@ inline void MxListCursor<T>::Detach()
m_match = NULL;
}
template <class T>
inline void MxListCursor<T>::Destroy()
{
m_list->m_customDestructor(m_match->GetValue());
}
template <class T>
inline MxBool MxListCursor<T>::Next(T& p_obj)
{
@@ -229,6 +240,24 @@ inline MxBool MxListCursor<T>::Next(T& p_obj)
return m_match != NULL;
}
template <class T>
inline MxBool MxListCursor<T>::Current(T& p_obj)
{
if (m_match)
p_obj = m_match->GetValue();
return m_match != NULL;
}
template <class T>
inline void MxListCursor<T>::Advance()
{
if (!m_match)
m_match = m_list->m_first;
else
m_match = m_match->m_next;
}
template <class T>
inline void MxListCursor<T>::SetValue(T p_obj)
{
@@ -236,4 +265,11 @@ inline void MxListCursor<T>::SetValue(T p_obj)
m_match->m_obj = p_obj;
}
template <class T>
inline void MxListCursor<T>::Prepend(T p_newobj)
{
if (m_match)
m_list->_InsertEntry(p_newobj, m_match->m_prev, m_match);
}
#endif // MXLIST_H