From 1b80643ca2315251cf16ccbfe536306cb05379da Mon Sep 17 00:00:00 2001 From: gianluca Date: Wed, 20 Sep 1995 16:56:10 +0000 Subject: [PATCH] Aggiunto metodo per rel.app. in cui cambiano le chiavi a run-time git-svn-id: svn://10.65.10.50/trunk@1868 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/maskfld.cpp | 10 ++++++++++ include/maskfld.h | 2 ++ include/relapp.cpp | 10 ++++++++-- include/relapp.h | 3 +++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/maskfld.cpp b/include/maskfld.cpp index c07c6ef4c..3976c4570 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -432,6 +432,16 @@ word TMask_field::last_key() const return (word)u; } + +// Certified 90% +void TMask_field::reset_key(byte key) +{ + CHECK(key>0, "Can't reset key 0"); + _keys.reset(long(key)); + if (last_key()==0) _keys.reset(0L); +} + + void TMask_field::set_dirty(bool d) { if (_flags.dirty == 3 && d == FALSE) diff --git a/include/maskfld.h b/include/maskfld.h index 1109507eb..b1d6503f8 100755 --- a/include/maskfld.h +++ b/include/maskfld.h @@ -317,6 +317,8 @@ public: // @cmember Setta il campo alla chiave

void set_key(byte key) { _keys.set(long(key)); _keys.set(0L);} + // @cmember Rimuove il campo dalla chiave

+ void reset_key(byte key); // @cmember Ritorna l'ultima chiave di appartenenza del campo word last_key() const; diff --git a/include/relapp.cpp b/include/relapp.cpp index 3699bef74..95d11ec09 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -1,4 +1,4 @@ -// $Id: relapp.cpp,v 1.65 1995-08-29 09:17:39 gianluca Exp $ +// $Id: relapp.cpp,v 1.66 1995-09-20 16:56:01 gianluca Exp $ #include #include #include @@ -519,7 +519,13 @@ bool TRelation_application::test_key(byte k, bool err) // Guy: doesn't change fields bool TRelation_application::find(byte k) -{ +{ + if (changing_keys()) + { + delete _maskeys; + _maskeys= new TKey_array(_mask); + } + const byte numkeys = _maskeys->items(); if (k == 0) diff --git a/include/relapp.h b/include/relapp.h index 3541325ed..f6faa46a9 100755 --- a/include/relapp.h +++ b/include/relapp.h @@ -74,6 +74,9 @@ protected: // la futura get_mask ritornera' una maschera diversa dalla corrente. virtual bool changing_mask(int mode) pure; virtual TMask* get_mask(int mode) pure; // Richiede la maschera da usare + + // metodo per far forzare la rigenerazione della lista interna di chiavi ad ogni find() + virtual bool changing_keys() const { return FALSE; } virtual TRelation* get_relation() const pure; // Relazione da modificare virtual int read(TMask& m); // Legge dalla relazione i valori nella maschera