/////////////////////////////////////////////////////////////////////////////
// Name:        No names yet.
// Purpose:     Contrib. demo
// Author:      Aleksandras Gluchovas
// Modified by:
// Created:     2000/02/08
// RCS-ID:      $Id: strlist.cpp,v 1.3 2001/04/15 10:00:43 aleksandras Exp $
// Copyright:   (c) Aleksandras Gluchovas
// Licence:   	GPL (version 2.0 or later)
/////////////////////////////////////////////////////////////////////////////

#ifdef __GNUG__
    #pragma implementation "pmcmn.cpp"
    #pragma interface "pmcmn.h"
#endif

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

#include "strlist.h"

/***** Implementation for class strlist *****/

wxDynStrList::wxDynStrList()
{}

wxDynStrList::~wxDynStrList()
{
	Clear();
}

void wxDynStrList::Add( const wxString& str )
{
	mStrArray.Add( new wxString(str) );
}

void wxDynStrList::Remove( const wxString& str )
{
	for( size_t i = 0; i != mStrArray.Count(); ++i )

		if ( *mStrArray[i] == str )
		{
			delete mStrArray[i];
			mStrArray.Remove( i );
			break;
		}
}

void wxDynStrList::Remove( size_t index )
{
	delete mStrArray[ index ];
	mStrArray.Remove( index );
}

wxString& wxDynStrList::Item( size_t index ) const
{
	return *mStrArray[ index ];
}

wxString& wxDynStrList::operator[]( size_t index ) const
{
	return *mStrArray[ index ];
}

void wxDynStrList::Insert( const wxString& str, size_t uiIndex)
{
	mStrArray.Insert( new wxString( str ), uiIndex );
}

wxString& wxDynStrList::Last() const
{
	return *mStrArray[ mStrArray.Count() - 1 ];
}

bool wxDynStrList::IsEmpty() const
{
	return mStrArray.Count() == 0;
}

int wxDynStrList::GetCount() const
{
	return mStrArray.Count();
}

int wxDynStrList::Count() const
{
	return mStrArray.Count();
}

void wxDynStrList::Clear()
{
	WX_CLEAR_ARRAY( mStrArray );
}
