From cf802fcba0049fd95a6cf234d96e2a0830224bb2 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 11 Mar 2012 21:33:54 -0700 Subject: [PATCH] Remove a bunch of unused custom STL code. --- Sources/Plasma/CoreLib/hsStlUtils.h | 183 ---------------------------- 1 file changed, 183 deletions(-) diff --git a/Sources/Plasma/CoreLib/hsStlUtils.h b/Sources/Plasma/CoreLib/hsStlUtils.h index 94429bec..f419f997 100644 --- a/Sources/Plasma/CoreLib/hsStlUtils.h +++ b/Sources/Plasma/CoreLib/hsStlUtils.h @@ -53,184 +53,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include -/***************************************************************************** -* -* derived stl classes that use our heap manager -* -***/ - - // TEMPLATE CLASS cyallocator -template - class cyallocator - : public std::allocator<_Ty> - { // generic cyallocator for objects of class _Ty -public: - typedef std::allocator<_Ty> _Mybase; - typedef typename _Mybase::value_type value_type; - - - typedef value_type* pointer; - typedef value_type& reference; - typedef const value_type* const_pointer; - typedef const value_type& const_reference; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - template - struct rebind - { // convert an cyallocator<_Ty> to an cyallocator <_Other> - typedef cyallocator<_Other> other; - }; - - pointer address(reference _Val) const - { // return address of mutable _Val - return (&_Val); - } - - const_pointer address(const_reference _Val) const - { // return address of nonmutable _Val - return (&_Val); - } - - cyallocator() - { // construct default cyallocator (do nothing) - } - - cyallocator(const cyallocator<_Ty>&) - { // construct by copying (do nothing) - } - - template - cyallocator(const cyallocator<_Other>&) - { // construct from a related cyallocator (do nothing) - } - - template - cyallocator<_Ty>& operator=(const cyallocator<_Other>&) - { // assign from a related cyallocator (do nothing) - return (*this); - } - - void deallocate(pointer _Ptr, size_type) - { // deallocate object at _Ptr, ignore size - free(_Ptr); - } - - pointer allocate(size_type _Count) - { // allocate array of _Count elements - return (pointer)malloc(_Count * sizeof(_Ty)); - } - - pointer allocate(size_type _Count, const void*) - { // allocate array of _Count elements, ignore hint - return (allocate(_Count)); - } - - void construct(pointer _Ptr, const _Ty& _Val) - { // construct object at _Ptr with value _Val - std::_Construct(_Ptr, _Val); - } - - void destroy(pointer _Ptr) - { // destroy object at _Ptr - std::_Destroy(_Ptr); - } - - size_t max_size() const - { // estimate maximum array size - size_t _Count = (size_t)(-1) / sizeof (_Ty); - return (0 < _Count ? _Count : 1); - } - }; - - // cyallocator TEMPLATE OPERATORS -template inline - bool operator==(const cyallocator<_Ty>&, const cyallocator<_Other>&) - { // test for cyallocator equality (always true) - return (true); - } - -template inline - bool operator!=(const cyallocator<_Ty>&, const cyallocator<_Other>&) - { // test for cyallocator inequality (always false) - return (false); - } - -#ifndef _CRTIMP2 -#define _CRTIMP2 -#endif - - // CLASS cyallocator -template<> class _CRTIMP2 cyallocator - { // generic cyallocator for type void -public: - typedef void _Ty; - typedef _Ty* pointer; - typedef const _Ty* const_pointer; - typedef _Ty value_type; - - template - struct rebind - { // convert an cyallocator to an cyallocator <_Other> - typedef cyallocator<_Other> other; - }; - - cyallocator() - { // construct default cyallocator (do nothing) - } - - cyallocator(const cyallocator<_Ty>&) - { // construct by copying (do nothing) - } - - template - cyallocator(const cyallocator<_Other>&) - { // construct from related cyallocator (do nothing) - } - - template - cyallocator<_Ty>& operator=(const cyallocator<_Other>&) - { // assign from a related cyallocator (do nothing) - return (*this); - } - }; - - -/***************************************************************************** -* -* Drop-in replacements for stl classes. Uses our allocator instead of the default one. -* -***/ - -typedef std::basic_string, cyallocator > cystring; -typedef std::basic_string, cyallocator > cywstring; -// cyistring and cyiwstring declared later in this file - - // TEMPLATE CLASS cyvector -template -class cyvector : public std::vector<_Ty, cyallocator<_Ty> > { -}; - - // TEMPLATE CLASS cymap -template > -class cymap : public std::map<_Kty, _Ty, _Pr, cyallocator > > { -}; - - // TEMPLATE CLASS cylist -template -class cylist : public std::list<_Ty, cyallocator<_Ty> > { -}; - - // TEMPLATE CLASS cyset -template > -class cyset : public std::set<_Kty, _Pr, cyallocator< _Kty > > { -}; - - - /***************************************************************************** * * stl extensions @@ -347,11 +169,6 @@ struct wstricmp_char_traits : public std::char_traits< wchar_t > typedef std::basic_string istring; typedef std::basic_string iwstring; -// cyallocator version of istring -typedef std::basic_string > cyistring; -typedef std::basic_string > cyiwstring; - - // std::string trim std::string & trimleft(std::string & s, const char * charset=" \t\n\r"); std::wstring & trimleft(std::wstring & s, const wchar_t * charset=L" \t\n\r");