#pragma implementation "dynarray.h"
#endif
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/dynarray.h"
-#include <wx/intl.h>
+#include "wx/intl.h"
#include <stdlib.h>
#include <string.h> // for memmove
// assignment operator
wxBaseArray& wxBaseArray::operator=(const wxBaseArray& src)
{
-#if 0
wxDELETEA(m_pItems);
-#else
- if ( (m_pItems)) {
- delete (m_pItems);
- (m_pItems) = 0;
- }
-#endif
m_nSize = // not src.m_nSize to save memory
m_nCount = src.m_nCount;
// pre-allocates memory (frees the previous data!)
void wxBaseArray::Alloc(size_t nSize)
{
- wxASSERT( nSize > 0 );
-
// only if old buffer was not big enough
if ( nSize > m_nSize ) {
wxDELETEA(m_pItems);
// add item at the given position
void wxBaseArray::Insert(long lItem, size_t nIndex)
{
- wxCHECK_RET( nIndex <= m_nCount, T("bad index in wxArray::Insert") );
+ wxCHECK_RET( nIndex <= m_nCount, wxT("bad index in wxArray::Insert") );
Grow();
}
// removes item from array (by index)
-void wxBaseArray::Remove(size_t nIndex)
+void wxBaseArray::RemoveAt(size_t nIndex)
{
- wxCHECK_RET( nIndex <= m_nCount, T("bad index in wxArray::Remove") );
+ wxCHECK_RET( nIndex <= m_nCount, wxT("bad index in wxArray::RemoveAt") );
memmove(&m_pItems[nIndex], &m_pItems[nIndex + 1],
(m_nCount - nIndex - 1)*sizeof(long));
int iIndex = Index(lItem);
wxCHECK_RET( iIndex != wxNOT_FOUND,
- T("removing inexistent item in wxArray::Remove") );
+ wxT("removing inexistent item in wxArray::Remove") );
- Remove((size_t)iIndex);
+ RemoveAt((size_t)iIndex);
}
// sort array elements using passed comparaison function