Patch level :4.0 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento :aggiunti i metodi per la gestione del report di log in modo che faccia solo la preview e non stampi gli errori multipli git-svn-id: svn://10.65.10.50/trunk@15061 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2735f3c0d8
commit
c01719588e
@ -3041,6 +3041,13 @@ bool TReport::print_or_preview()
|
||||
return book.print_or_preview();
|
||||
}
|
||||
|
||||
bool TReport::preview()
|
||||
{
|
||||
TReport_book book;
|
||||
book.add(*this);
|
||||
return book.preview();
|
||||
}
|
||||
|
||||
bool TReport::archive()
|
||||
{
|
||||
TReport_book book;
|
||||
|
@ -575,6 +575,7 @@ public:
|
||||
void destroy();
|
||||
|
||||
bool print_or_preview();
|
||||
bool preview();
|
||||
bool archive();
|
||||
|
||||
TReport();
|
||||
|
@ -137,6 +137,17 @@ bool TLog_report::log(int sev, const char* msg)
|
||||
bool ok = csv != NULL;
|
||||
if (ok)
|
||||
{
|
||||
//controlla se la stringa esiste gia'
|
||||
if (_kill_duplicates)
|
||||
{
|
||||
for (bool go = csv->move_last(); go; go = csv->move_prev())
|
||||
{
|
||||
const TString& m = csv->get(1).as_string();
|
||||
if (m == msg)
|
||||
return true; // ignoro messaggio duplicato
|
||||
}
|
||||
}
|
||||
//aggiunge il messaggio
|
||||
ok = csv->new_rec() >= 0;
|
||||
if (ok)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
class TLog_report : public TReport
|
||||
{
|
||||
TString _title;
|
||||
bool _kill_duplicates;
|
||||
|
||||
protected:
|
||||
virtual bool use_mask() { return false; }
|
||||
@ -44,6 +45,7 @@ public:
|
||||
void reset();
|
||||
bool log(int severity, const char* msg); // severity: 0=normal; 1=warning; 2=error
|
||||
void set_title(const char* title);
|
||||
void kill_duplicates(bool k = true) {_kill_duplicates = k;}
|
||||
const TString& title() const { return _title; }
|
||||
TLog_report(const char* title, const char* name = "bagn010a");
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user