root/week1oplossing/IntLijst.h

User picture

Author: machiel.sleeuwaert

Revision: 13 («Previous)

(Oct 15 14:12 2008 UTC) Over 3 years ago


  

 
Show/hide line numbers
#pragma once
#include "GameEngine.h"
class IntLijst
{
	friend tstringstream& operator<<(tstringstream& stream, IntLijst& lijst);
	friend tstring operator+(tstring string, IntLijst& lijst);
	

public:
	IntLijst();
	
	virtual ~IntLijst();

	// Voeg toe aan het einde van de lijst
	void push_back(int value); 
	// Verwijder van het einde van de lijst en geef de waarde terug
	int pop_back();
	// Geef het element op die positie terug
	int at(int positie) const;
	// Voeg toe op die positie en schuif alle volgende elementen op
	void insert(int value, int positie);
	// Verander de waarde op deze positie
	void change(int positie, int newvalue);

	// Geef het aantal items terug
	int getLength() const;
	
	static const int BASE_SIZE=10;

	IntLijst(const IntLijst& p);							
	IntLijst& operator=(const IntLijst& p);
	IntLijst operator+(const IntLijst& p);
	IntLijst& operator+=(const IntLijst& p);
	bool operator==(const IntLijst& p);
	bool operator!=(const IntLijst& p);
	void operator>>(tstringstream &p);
	int& operator[] (int index);
private:	
	void vergrootArray();

	int *m_DynArrPtr;
	int m_AantalElementen,m_Capaciteit;


	
};