Aggiunto costruttore TArray(TArray&) che duplica tutto il contenuto
git-svn-id: svn://10.65.10.50/trunk@217 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2b1c61fb33
commit
946f6a4514
@ -1,9 +1,9 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <array.h>
|
#include <array.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
|
|
||||||
void TArray::resize(int arraysize)
|
void TArray::resize(int arraysize)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -47,7 +47,6 @@ bool TArray::destroy(int index, bool pack)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TArray::TArray(int arraysize) : _size(0), _items(0), _data(NULL)
|
TArray::TArray(int arraysize) : _size(0), _items(0), _data(NULL)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -58,6 +57,14 @@ TArray::TArray() : _size(0), _items(0), _data(NULL)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TArray::TArray(const TArray& a)
|
||||||
|
{
|
||||||
|
if (a.size()) resize(a.size());
|
||||||
|
for (_items = 0; _items < a.items(); _items++)
|
||||||
|
_data[_items] = a[_items].dup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TArray::~TArray()
|
TArray::~TArray()
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,8 @@ public:
|
|||||||
// @FPUB
|
// @FPUB
|
||||||
TArray(int arraysize); // Crea un array (chiama resize)
|
TArray(int arraysize); // Crea un array (chiama resize)
|
||||||
TArray(); // Crea un array (non chiama resize)
|
TArray(); // Crea un array (non chiama resize)
|
||||||
|
TArray(const TArray&); // copia tutto e duplica gli elementi
|
||||||
|
// (casino se non hanno dup() definita)
|
||||||
virtual ~TArray() ;
|
virtual ~TArray() ;
|
||||||
virtual const char* class_name() const ; // Ritorna il nome della classe
|
virtual const char* class_name() const ; // Ritorna il nome della classe
|
||||||
virtual word class_id() const ; // Ritorna il class-id
|
virtual word class_id() const ; // Ritorna il class-id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user