Inserita la lunghezza del campo nei costruttori di TVariable_field

git-svn-id: svn://10.65.10.50/trunk@4496 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
augusto 1997-06-03 09:47:48 +00:00
parent fb0c044fcd
commit 7e4bf2b28b
2 changed files with 18 additions and 11 deletions

View File

@ -7,10 +7,11 @@
TVariable_field::TVariable_field( TVariable_field::TVariable_field(
const char * name, // const char * name, //
const char * expr, // const char * expr, //
TTypeexp type) // TTypeexp type,
int len) //
: _rec(NULL), _name(name), _e(NULL) , _getfunc(NULL), : _rec(NULL), _name(name), _e(NULL) , _getfunc(NULL),
_put_string(NULL), _destroy_expression(TRUE), _put_string(NULL), _destroy_expression(TRUE),
_in_get(FALSE) _in_get(FALSE),_lenght(len)
{ {
if (expr && *expr) if (expr && *expr)
{ {
@ -21,10 +22,11 @@ TVariable_field::TVariable_field(
TVariable_field::TVariable_field( TVariable_field::TVariable_field(
const char * name, // const char * name, //
VIRTUAL_GET_FUNCTION getfunc) // VIRTUAL_GET_FUNCTION getfunc,
int len) //
: _name(name), _e(NULL) , _rec(NULL), _getfunc(getfunc), : _name(name), _e(NULL) , _rec(NULL), _getfunc(getfunc),
_put_string(NULL), _destroy_expression(FALSE), _put_string(NULL), _destroy_expression(FALSE),
_in_get(FALSE) _in_get(FALSE),_lenght(len)
{ {
CHECK(_getfunc, "You must pass a valid VIRTUAL_GET_FUNCTION"); CHECK(_getfunc, "You must pass a valid VIRTUAL_GET_FUNCTION");
} }
@ -32,17 +34,18 @@ TVariable_field::TVariable_field(
TVariable_field::TVariable_field( TVariable_field::TVariable_field(
const char * name, // const char * name, //
TExpression * expr, // TExpression * expr, //
TTypeexp type) // TTypeexp type,
int len) //
: _rec(NULL), _name(name), _e(expr) , _getfunc(NULL), : _rec(NULL), _name(name), _e(expr) , _getfunc(NULL),
_put_string(NULL), _destroy_expression(FALSE), _put_string(NULL), _destroy_expression(FALSE),
_in_get(FALSE) _in_get(FALSE),_lenght(len)
{ {
} }
TVariable_field::TVariable_field(const TVariable_field & f) TVariable_field::TVariable_field(const TVariable_field & f)
: _rec(f._rec), _name(f._name), _e(NULL) , _getfunc(f._getfunc), : _rec(f._rec), _name(f._name), _e(NULL) , _getfunc(f._getfunc),
_put_string(NULL), _destroy_expression(f._destroy_expression), _put_string(NULL), _destroy_expression(f._destroy_expression),
_in_get(FALSE) _in_get(FALSE),_lenght(f._lenght)
{ {
if (f._e) if (f._e)
_e = (TExpression *) f._e->dup(); _e = (TExpression *) f._e->dup();
@ -238,7 +241,7 @@ int TVariable_rectype::length(const char* fieldname) const
{ {
if (_virtual_fields.objptr(fieldname)) if (_virtual_fields.objptr(fieldname))
return 255; return ((TVariable_field *)_virtual_fields.objptr(fieldname))->lenght();
return TRectype::length(fieldname); return TRectype::length(fieldname);
} }

View File

@ -35,6 +35,7 @@ class TVariable_field : public TObject
VIRTUAL_GET_FUNCTION _getfunc; VIRTUAL_GET_FUNCTION _getfunc;
bool _destroy_expression; bool _destroy_expression;
bool _in_get; bool _in_get;
int _lenght;
public: public:
// @access Public Member // @access Public Member
@ -63,13 +64,16 @@ public:
// @cmember il campo non ha formule o funzioni collegate // @cmember il campo non ha formule o funzioni collegate
bool plain() const bool plain() const
{ return _e == NULL && _getfunc == NULL;} { return _e == NULL && _getfunc == NULL;}
// @cmember Ritorna la lunghezza del campo
int lenght() const
{return _lenght;}
// @ cmember Costruttore con una espressione di calcolo // @ cmember Costruttore con una espressione di calcolo
TVariable_field(const char * name, const char * expr = "", TTypeexp type = _strexpr); TVariable_field(const char * name, const char * expr = "", TTypeexp type = _strexpr, int len=255);
// @ cmember Costruttore con una funzione // @ cmember Costruttore con una funzione
TVariable_field(const char * name, VIRTUAL_GET_FUNCTION getfunc); TVariable_field(const char * name, VIRTUAL_GET_FUNCTION getfunc, int len=255);
// @ cmember Costruttore con una espressione di calcolo // @ cmember Costruttore con una espressione di calcolo
TVariable_field(const char * name, TExpression * expr, TTypeexp type = _strexpr); TVariable_field(const char * name, TExpression * expr, TTypeexp type = _strexpr, int len=255);
// @ cmember Costruttore con un variable_field // @ cmember Costruttore con un variable_field
TVariable_field(const TVariable_field & f); TVariable_field(const TVariable_field & f);
// @ cmember Distruttore // @ cmember Distruttore