Aggiunto operator= ai TArray (che sfracella l'array e lo trasforma
in una copia esatta dell'argomento; gli items devono avere dup()) git-svn-id: svn://10.65.10.50/trunk@233 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
dfc7c0a805
commit
0d54eca268
@ -57,13 +57,19 @@ TArray::TArray() : _size(0), _items(0), _data(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
TArray::TArray(const TArray& a) : _size(0), _data(NULL)
|
||||
TArray::TArray(const TArray& a) : _size(0), _items(0), _data(NULL)
|
||||
{
|
||||
if (a.size()) resize(a.size());
|
||||
(*this) = a;
|
||||
}
|
||||
|
||||
TArray& TArray::operator= (const TArray& a)
|
||||
{
|
||||
if (_items > 0) destroy();
|
||||
if (_size < a.size()) resize(a.size());
|
||||
for (_items = 0; _items < a.items(); _items++)
|
||||
_data[_items] = a[_items].dup();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TArray::~TArray()
|
||||
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
TArray(int arraysize); // Crea un array (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 const char* class_name() const ; // Ritorna il nome della classe
|
||||
@ -43,6 +44,7 @@ public:
|
||||
|
||||
TObject& operator[] (int index) const ; // [] ritorna l'oggetto puntato da index
|
||||
TObject* objptr(int index) const ; // Ritorna l'oggetto di posto [index]
|
||||
TArray& operator= (const TArray& a);
|
||||
|
||||
virtual bool destroy(int index = -1, bool pack = FALSE); // Rimuove uno o tutti gli elementi (default)
|
||||
virtual int add(TObject* obj, int index = -1) ; // Aggiunge un oggetto ad un array.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: printapp.cpp,v 1.6 1994-09-14 07:33:25 villa Exp $
|
||||
// $Id: printapp.cpp,v 1.7 1994-09-14 10:43:51 villa Exp $
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -787,7 +787,7 @@ void TPrint_application::print()
|
||||
{
|
||||
if (preprocess_page (0, cnt2))
|
||||
{
|
||||
set_page (0, cnt2);
|
||||
(0, cnt2);
|
||||
ok = print_one (0);
|
||||
}
|
||||
}
|
||||
@ -850,7 +850,7 @@ bool TPrint_application::print_tree (link_item * head)
|
||||
|| !_print_defined)
|
||||
{
|
||||
reset_print ();
|
||||
set_page (head->_logicnum, head->_cnt);
|
||||
set_page(head->_logicnum, head->_cnt);
|
||||
_cur_file = head->_logicnum;
|
||||
}
|
||||
int cnt2 = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user