Multirec : corretto operatore di assegnamento

Varrec   : corretto opratori di assegnamento e costruttore dei variable_field


git-svn-id: svn://10.65.10.50/trunk@5319 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-10-02 16:56:32 +00:00
parent e5614d3ef3
commit 99b802889f
3 changed files with 21 additions and 15 deletions

View File

@ -253,7 +253,7 @@ void TMultiple_rectype::synchronize_bodies()
TMultiple_rectype & TMultiple_rectype::copy(const TMultiple_rectype& r)
{
// copia..
TAuto_variable_rectype::operator=(r);
TAuto_variable_rectype::operator=((TAuto_variable_rectype&)r);
_files = r._files;
_nuovo=r._nuovo;
_nfiles=r._nfiles; // file delle righe

View File

@ -10,8 +10,7 @@ TVariable_field::TVariable_field(
TTypeexp type,
int len) //
: _rec(NULL), _name(name), _e(NULL) , _getfunc(NULL),
_put_string(NULL), _destroy_expression(TRUE),
_in_get(FALSE),_lenght(len)
_put_string(NULL), _in_get(FALSE),_lenght(len)
{
if (expr && *expr)
{
@ -25,27 +24,25 @@ TVariable_field::TVariable_field(
VIRTUAL_GET_FUNCTION getfunc,
int len) //
: _name(name), _e(NULL) , _rec(NULL), _getfunc(getfunc),
_put_string(NULL), _destroy_expression(FALSE),
_in_get(FALSE),_lenght(len)
_put_string(NULL), _in_get(FALSE),_lenght(len)
{
CHECK(_getfunc, "You must pass a valid VIRTUAL_GET_FUNCTION");
}
TVariable_field::TVariable_field(
const char * name, //
TExpression * expr, //
const TExpression & expr, //
TTypeexp type,
int len) //
: _rec(NULL), _name(name), _e(expr) , _getfunc(NULL),
_put_string(NULL), _destroy_expression(FALSE),
_in_get(FALSE),_lenght(len)
{
: _rec(NULL), _name(name), _e(NULL) , _getfunc(NULL),
_put_string(NULL), _in_get(FALSE),_lenght(len)
{
_e = (TExpression *) expr.dup();
}
TVariable_field::TVariable_field(const TVariable_field & f)
: _rec(f._rec), _name(f._name), _e(NULL) , _getfunc(f._getfunc),
_put_string(NULL), _destroy_expression(f._destroy_expression),
_in_get(FALSE),_lenght(f._lenght)
_put_string(NULL), _in_get(FALSE),_lenght(f._lenght)
{
if (f._e)
_e = (TExpression *) f._e->dup();
@ -55,7 +52,7 @@ TVariable_field::TVariable_field(const TVariable_field & f)
TVariable_field::~TVariable_field()
{
if (_destroy_expression && _e) delete _e;
if (_e) delete _e;
if (_put_string) delete _put_string;
}

View File

@ -33,7 +33,6 @@ class TVariable_field : public TObject
TString _value;
TToken_string * _put_string;
VIRTUAL_GET_FUNCTION _getfunc;
bool _destroy_expression;
bool _in_get;
int _lenght;
@ -67,13 +66,14 @@ public:
// @cmember Ritorna la lunghezza del campo
int lenght() const
{return _lenght;}
TExpression * expression() const { return _e;}
// @ cmember Costruttore con una espressione di calcolo
TVariable_field(const char * name, const char * expr = "", TTypeexp type = _strexpr, int len=255);
// @ cmember Costruttore con una funzione
TVariable_field(const char * name, VIRTUAL_GET_FUNCTION getfunc, int len=255);
// @ cmember Costruttore con una espressione di calcolo
TVariable_field(const char * name, TExpression * expr, TTypeexp type = _strexpr, int len=255);
TVariable_field(const char * name, const TExpression & expr, TTypeexp type = _strexpr, int len=255);
// @ cmember Costruttore con un variable_field
TVariable_field(const TVariable_field & f);
// @ cmember Distruttore
@ -181,6 +181,15 @@ protected:
public:
// @cmember Costruttore Costruisce un record staccato da un file.
// Sarebbe meglio utilizzare una delle altre due
// @cmember Assegnazione tra TAuto_variable_rectype e TRectype
virtual TRectype & operator =(const TRectype& rec) { return TVariable_rectype::operator =(rec); }
// @cmember Assegnazione tra TAuto_variable_rectype e TVariable_rectype
virtual TVariable_rectype & operator =(const TVariable_rectype& rec) { return TVariable_rectype::operator =(rec); }
// @cmember Assegnazione tra TAuto_variable_rectype
virtual TAuto_variable_rectype & operator =(const TAuto_variable_rectype& rec) { return (TAuto_variable_rectype &) TVariable_rectype::operator =((TVariable_rectype &)rec); }
// @cmember Assegnazione tra TAuto_variable_rectype const char *
virtual TRectype & operator =(const char* rec) { return TVariable_rectype::operator =(rec); }
TAuto_variable_rectype(int logicnum) : TVariable_rectype(logicnum) {}
// @cmember Costruttore. Costruisce record e lo associa al file isam <p i>
TAuto_variable_rectype(const TBaseisamfile* i) : TVariable_rectype(i) {}