Patch level : 2.1 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Fogate galattiche necessarie all'editor di query e report


git-svn-id: svn://10.65.10.50/trunk@11816 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-03-09 14:34:46 +00:00
parent 3d88151f4d
commit 1f52426e43
4 changed files with 50 additions and 8 deletions

View File

@ -1,7 +1,9 @@
#include <config.h>
#include <diction.h>
#include <expr.h>
#include <extcdecl.h>
#include <prefix.h>
#include <progind.h>
#include <relation.h>
#include <sheet.h>
#include <sort.h>
@ -1644,6 +1646,42 @@ bool TCursor::is_first_match(int ln)
(_pos == 0 && file().good()) : (_if->is_first_match(ln));
}
bool TCursor::scan(CURSOR_SCAN_FUNC func, void* pJolly, const char* msg)
{
TRecnotype tot = 0; // Temporarily
if (msg == NULL || *msg == '\0')
msg = TR("Elaborazione in corso...");
TProgind pi(tot, msg, true, true);
{
TWait_cursor hourglass;
tot = items();
}
bool ok = true;
if (tot > 0)
{
freeze();
pi.setmax(tot);
for (*this = 0; pos() < tot; ++*this)
{
pi.addstatus(1);
if (pi.iscancelled())
{
ok = false;
break;
}
if (!func(*relation(), pJolly))
{
ok = false;
break;
}
}
freeze(false);
}
return ok;
}
///////////////////////////////////////////////////////////
// TSorted_cursor
@ -1963,8 +2001,6 @@ TSorted_cursor::~TSorted_cursor()
{
}
///////////////////////////////////////////////////////////
// TFieldRef
///////////////////////////////////////////////////////////

View File

@ -212,6 +212,9 @@ class TExpression;
// @type FILTERFUNCTION | Prototipo funzione che controlla se il record debba essere incluso nel cursore
typedef bool (*FILTERFUNCTION)(const TRelation* r);
typedef bool (*CURSOR_SCAN_FUNC)(const TRelation& rel, void* pJolly);
// @doc EXTERNAL
// @class TCursor | Classe per la definizione di un cursore su di una relazione
@ -435,6 +438,8 @@ public:
// @cmember Restituisce se il è sorted (default = FALSE)
virtual bool is_sorted() const { return FALSE; }
bool scan(CURSOR_SCAN_FUNC func, void* pJolly = NULL, const char* msg = "");
// @cmember Costruttore
TCursor(TRelation* f, const char* filter = "", int key = 1, const TRectype* from = NULL, const TRectype* to = NULL, int tilde = 0x0);
// @cmember Distruttore

View File

@ -457,6 +457,12 @@ void TXmlItem::Save(const char* strFilename) const
Write(outf, 0);
}
bool TXmlItem::Load(const char* strFilename)
{
ifstream qry(strFilename);
return Read(qry);
}
static bool FindFirstCallback(TXmlItem& item, long jolly)
{
const char* strTag = (const char*)jolly;

View File

@ -65,6 +65,7 @@ public:
void AsString(TString& str) const;
void Save(const char* strFilename) const;
bool Load(const char* strFilename);
TXmlItem* ForEach(XmlItemCallback cb, long jolly = 0);
TXmlItem* FindFirst(const char* strTag) const;
@ -74,15 +75,9 @@ public:
};
TXmlItem& operator<<(TXmlItem& item, const char* str);
ostream& operator<<(ostream& outf, const char* str);
ostream& operator<<(ostream& outf, TString str);
istream& operator>>(istream& inf, TString& str);
void Spaces(ostream& outf, int nSpaces);
void WriteXmlString(ostream& outf, const char* str);
int hex2int(const char* str);
#define endl "\r\n";
#endif