mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-26 01:17:55 -05:00
Add modified mxstl.h (#107)
This commit is contained in:
parent
4e0149361e
commit
87938e9b0e
4 changed files with 222 additions and 6 deletions
|
@ -18,13 +18,11 @@
|
|||
|
||||
// STL compatibility.
|
||||
#if defined(_MSC_VER) && _MSC_VER <= MSVC420_VERSION
|
||||
#include <STL.H>
|
||||
#include "mxstl.h"
|
||||
#else
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
using namespace std;
|
||||
template <class T>
|
||||
using List = list<T>;
|
||||
#endif
|
||||
|
||||
// We use `override` so newer compilers can tell us our vtables are valid,
|
||||
|
|
|
@ -28,10 +28,10 @@ class MxNotification
|
|||
MxParam *m_param; // 0x4
|
||||
};
|
||||
|
||||
class MxIdList : public List<MxU32>
|
||||
class MxIdList : public list<MxU32>
|
||||
{};
|
||||
|
||||
class MxNotificationPtrList : public List<MxNotification *>
|
||||
class MxNotificationPtrList : public list<MxNotification *>
|
||||
{};
|
||||
|
||||
// VTABLE 0x100dc078
|
||||
|
|
218
LEGO1/mxstl.h
Normal file
218
LEGO1/mxstl.h
Normal file
|
@ -0,0 +1,218 @@
|
|||
#ifndef MXSTL_H
|
||||
#define MXSTL_H
|
||||
|
||||
#include <use_ansi.h>
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <stack>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/*
|
||||
* Currently, all MS C compilers for Win32 platforms default to 8 byte
|
||||
* alignment.
|
||||
*/
|
||||
#pragma pack(push,8)
|
||||
#endif // _MSC_VER
|
||||
|
||||
template<class _TYPE>
|
||||
class Deque : public deque<_TYPE, allocator<_TYPE> >
|
||||
{
|
||||
public:
|
||||
typedef Deque<_TYPE> _Myt;
|
||||
typedef allocator<_TYPE> _A;
|
||||
|
||||
explicit Deque(const _A& _Al = _A()) : deque<_TYPE, _A>(_Al)
|
||||
{}
|
||||
|
||||
explicit Deque(size_type _N, const _TYPE& _V = _TYPE()) : deque<_TYPE, _A>(_N, _V)
|
||||
{}
|
||||
|
||||
void swap(_Myt& _X)
|
||||
{
|
||||
deque<_TYPE, _A>::swap((deque<_TYPE, _A>&)_X);
|
||||
}
|
||||
|
||||
friend void swap(_Myt& _X, _Myt& _Y)
|
||||
{
|
||||
_X.swap(_Y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _TYPE>
|
||||
class List : public list<_TYPE, allocator<_TYPE> >
|
||||
{
|
||||
public:
|
||||
typedef List<_TYPE> _Myt;
|
||||
typedef allocator<_TYPE> _A;
|
||||
|
||||
explicit List() : list<_TYPE, _A>()
|
||||
{}
|
||||
|
||||
explicit List(size_type _N, const _TYPE& _V = _TYPE()) : list<_TYPE, _A>(_N, _V)
|
||||
{}
|
||||
|
||||
void swap(_Myt& _X)
|
||||
{
|
||||
list<_TYPE, _A>::swap((list<_TYPE, _A>&)_X);
|
||||
}
|
||||
|
||||
friend void swap(_Myt& _X, _Myt& _Y)
|
||||
{
|
||||
_X.swap(_Y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _K, class _TYPE, class _Pr>
|
||||
class Map : public map<_K, _TYPE, _Pr, allocator<_TYPE> >
|
||||
{
|
||||
public:
|
||||
typedef Map<_K, _TYPE, _Pr> _Myt;
|
||||
typedef allocator<_TYPE> _A;
|
||||
|
||||
explicit Map(const _Pr& _Pred = _Pr())
|
||||
: map<_K, _TYPE, _Pr, _A>(_Pred)
|
||||
{}
|
||||
|
||||
void swap(_Myt& _X)
|
||||
{
|
||||
map<_K, _TYPE, _Pr, _A>::swap((map<_K, _TYPE, _Pr, _A>&)_X);
|
||||
}
|
||||
|
||||
friend void swap(_Myt& _X, _Myt& _Y)
|
||||
{
|
||||
_X.swap(_Y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _K, class _TYPE, class _Pr>
|
||||
class Multimap : public multimap<_K, _TYPE, _Pr, allocator<_TYPE> >
|
||||
{
|
||||
public:
|
||||
typedef Multimap<_K, _TYPE, _Pr> _Myt;
|
||||
typedef allocator<_TYPE> _A;
|
||||
|
||||
explicit Multimap(const _Pr& _Pred = _Pr()) : multimap<_K, _TYPE, _Pr, _A>(_Pred)
|
||||
{}
|
||||
|
||||
void swap(_Myt& _X)
|
||||
{
|
||||
multimap<_K, _TYPE, _Pr, _A>::swap((multimap<_K, _TYPE, _Pr, _A>&)_X);
|
||||
}
|
||||
|
||||
friend void swap(_Myt& _X, _Myt& _Y)
|
||||
{
|
||||
_X.swap(_Y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _K, class _Pr>
|
||||
class Set : public set<_K, _Pr, allocator<_K> >
|
||||
{
|
||||
public:
|
||||
typedef Set<_K, _Pr> _Myt;
|
||||
typedef allocator<_K> _A;
|
||||
|
||||
explicit Set(const _Pr& _Pred = _Pr()) : set<_K, _Pr, _A>(_Pred)
|
||||
{}
|
||||
|
||||
void swap(_Myt& _X)
|
||||
{
|
||||
set<_K, _Pr, _A>::swap((set<_K, _Pr, _A>&)_X);
|
||||
}
|
||||
|
||||
friend void swap(_Myt& _X, _Myt& _Y)
|
||||
{
|
||||
_X.swap(_Y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _K, class _Pr>
|
||||
class Multiset : public multiset<_K, _Pr, allocator<_K> >
|
||||
{
|
||||
public:
|
||||
typedef Multiset<_K, _Pr> _Myt;
|
||||
typedef allocator<_K> _A;
|
||||
|
||||
explicit Multiset(const _Pr& _Pred = _Pr())
|
||||
: multiset<_K, _Pr, _A>(_Pred)
|
||||
{}
|
||||
|
||||
void swap(_Myt& _X)
|
||||
{
|
||||
multiset<_K, _Pr, _A>::swap((multiset<_K, _Pr, _A>&)_X);
|
||||
}
|
||||
|
||||
friend void swap(_Myt& _X, _Myt& _Y)
|
||||
{
|
||||
_X.swap(_Y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _TYPE>
|
||||
class Vector : public vector<_TYPE, allocator<_TYPE> >
|
||||
{
|
||||
public:
|
||||
typedef Vector<_TYPE> _Myt;
|
||||
typedef allocator<_TYPE> _A;
|
||||
|
||||
explicit Vector(const _A& _Al = _A()) : vector<_TYPE, _A>(_Al)
|
||||
{}
|
||||
|
||||
void swap(_Myt& _X)
|
||||
{
|
||||
vector<_TYPE, _A>::swap((vector<_TYPE, _A>&)_X);
|
||||
}
|
||||
|
||||
friend void swap(_Myt& _X, _Myt& _Y)
|
||||
{
|
||||
_X.swap(_Y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _C, class _Pr>
|
||||
class Priority_queue : public priority_queue<_C::value_type, _C, _Pr, _C::allocator_type>
|
||||
{
|
||||
public:
|
||||
typedef _C::value_type _TYPE;
|
||||
typedef _C::allocator_type _A;
|
||||
typedef _C::allocator_type allocator_type;
|
||||
|
||||
explicit Priority_queue(const _Pr& _X = _Pr(), const _C::allocator_type& _Al = _C::allocator_type()) : priority_queue<_C::value_type, _C, _Pr, _C::allocator_type>(_X, _Al)
|
||||
{}
|
||||
};
|
||||
|
||||
template<class _C>
|
||||
class Queue : public queue<_C::value_type, _C, _C::allocator_type>
|
||||
{};
|
||||
|
||||
template<class _C>
|
||||
class Stack : public stack<_C::value_type, _C, _C::allocator_type>
|
||||
{};
|
||||
|
||||
#define deque Deque
|
||||
#define list List
|
||||
#define map Map
|
||||
#define multimap Multimap
|
||||
#define set Set
|
||||
#define multiset Multiset
|
||||
#define vector Vector
|
||||
#define priority_queue Priority_queue
|
||||
#define queue Queue
|
||||
#define stack Stack
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#endif // MXSTL_H
|
|
@ -53,7 +53,7 @@ class MxTickleClient
|
|||
MxU16 m_flags; // 0xc
|
||||
};
|
||||
|
||||
class MxTickleClientPtrList : public List<MxTickleClient *>
|
||||
class MxTickleClientPtrList : public list<MxTickleClient *>
|
||||
{};
|
||||
|
||||
// VTABLE 0x100d86d8
|
||||
|
|
Loading…
Reference in a new issue