//---------------------- CSPVarArray.h ------------------------

//*************************************************************
//*****       Copyright ©2002 - 2004 Micronovae Ltd       *****
//*****                All rights reserved                *****
//*************************************************************

#ifndef _CSPVARARRAY
#define _CSPVARARRAY

#include "CSPConf.h"
#include "CSPLib.h"
#include "CSPVariant.h"
#pragma warning( disable : 4251 )

class CSPLIB_CLASS_EXPORT CSPVarArray : public CSPObject
{
	public:
		CSPVarArray();
		CSPVarArray( unsigned long ulSize );
		CSPVarArray( const CSPVarArray& VarArray );
		virtual ~CSPVarArray();

		void SetSize( unsigned long ulSize );
		void Resize( unsigned long ulSize );
		void Grow( unsigned long ulSize );
		void Shrink( unsigned long ulSize );
		unsigned long GetSize() const;
		void Empty();

		CSPVariant* GetPtr() const;
		CSPVarArray& operator = ( const CSPVarArray& VarArray );
		CSPVarArray& operator += ( const CSPVarArray& VarArray );
		bool operator == ( const CSPVarArray& VarArray ) const;
		bool operator != ( const CSPVarArray& VarArray ) const;
		CSPVariant& operator [] ( unsigned long x ) const;

		CSPVariant* Detach();
		void Attach( CSPVarArray& VarArray );
		void Attach( CSPVariant* p, unsigned long ulSize );
		void Copy( const CSPVarArray& VarArray );
		void Copy( const CSPVariant* p, unsigned long ulSize );
		void Add( const CSPVarArray& VarArray );
		void Add( const CSPVariant* p, unsigned long ulSize );
		CSPVariant& Get( unsigned long ulIndex ) const;
		void Set( unsigned long ulIndex, const CSPVariant& varValue );

	protected:
		CSPArray< CSPVariant > aArray;
};

#endif
