Aggiunti campi alternativi nei JOIN delle relazioni
git-svn-id: svn://10.65.10.50/trunk@839 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
23b904191b
commit
00cd69e1f6
@ -268,8 +268,9 @@ void TForm_item::enable(bool on)
|
|||||||
void TForm_item::string_at(int x, int y, const char* s)
|
void TForm_item::string_at(int x, int y, const char* s)
|
||||||
{
|
{
|
||||||
if (hidden()) return;
|
if (hidden()) return;
|
||||||
|
|
||||||
TPrintrow& row = _section->row(y-1); // Seleziona riga di stampa
|
_section->offset(x, y);
|
||||||
|
TPrintrow& row = _section->row(y-1); // Seleziona riga di stampa
|
||||||
|
|
||||||
if (_width > 0 && strlen(s) > (word)_width) // Tronca testo se necessario
|
if (_width > 0 && strlen(s) > (word)_width) // Tronca testo se necessario
|
||||||
{
|
{
|
||||||
@ -277,7 +278,7 @@ void TForm_item::string_at(int x, int y, const char* s)
|
|||||||
__tmp_string[width()] = '\0';
|
__tmp_string[width()] = '\0';
|
||||||
s = __tmp_string;
|
s = __tmp_string;
|
||||||
}
|
}
|
||||||
row.put(s, x-1); // Stampa testo
|
row.put(s, x-1); // Stampa testo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -297,7 +298,7 @@ void TForm_item::send_message(const TString& cmd, TForm_item& des) const
|
|||||||
{
|
{
|
||||||
if (cmd == "ADD" || cmd == "SUM" || cmd == "INC")
|
if (cmd == "ADD" || cmd == "SUM" || cmd == "INC")
|
||||||
{
|
{
|
||||||
const real n((cmd[0] != 'I') ? get() : "1.0");
|
const real n((cmd[0] == 'I') ? "1.0" : get());
|
||||||
real r(des.get());
|
real r(des.get());
|
||||||
r += n;
|
r += n;
|
||||||
des.set(r.string());
|
des.set(r.string());
|
||||||
@ -535,19 +536,24 @@ const char* TForm_string::get() const
|
|||||||
|
|
||||||
bool TForm_string::read()
|
bool TForm_string::read()
|
||||||
{
|
{
|
||||||
if (enabled() && _field.items())
|
bool ok = TRUE;
|
||||||
{
|
|
||||||
const char* s = "";
|
|
||||||
for (int i = 0; i < _field.items(); i++)
|
|
||||||
{
|
|
||||||
s = field(i).read(section()->form()->relation());
|
|
||||||
if (*s) break;
|
|
||||||
}
|
|
||||||
set(s);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
if (enabled())
|
||||||
|
{
|
||||||
|
if (_field.items())
|
||||||
|
{
|
||||||
|
const char* s = "";
|
||||||
|
const TRelation* r = section()->form()->relation();
|
||||||
|
for (int i = 0; i < _field.items(); i++)
|
||||||
|
{
|
||||||
|
s = field(i).read(r);
|
||||||
|
if (*s) break;
|
||||||
|
}
|
||||||
|
set(s);
|
||||||
|
}
|
||||||
|
} else ok = FALSE;
|
||||||
|
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TForm_string::put_paragraph(const char* s)
|
void TForm_string::put_paragraph(const char* s)
|
||||||
@ -567,10 +573,9 @@ void TForm_string::put_paragraph(const char* s)
|
|||||||
|
|
||||||
bool TForm_string::update()
|
bool TForm_string::update()
|
||||||
{
|
{
|
||||||
TForm_item::update();
|
|
||||||
|
|
||||||
if (read())
|
if (read())
|
||||||
{
|
{
|
||||||
|
TForm_item::update();
|
||||||
if (_picture.not_empty())
|
if (_picture.not_empty())
|
||||||
{
|
{
|
||||||
TString80 p;
|
TString80 p;
|
||||||
@ -595,7 +600,7 @@ protected:
|
|||||||
virtual bool parse_head(TScanner& scanner);
|
virtual bool parse_head(TScanner& scanner);
|
||||||
virtual bool update();
|
virtual bool update();
|
||||||
|
|
||||||
int decimals() const { return height(); }
|
int decimals() const { return _height; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TForm_number(TPrint_section* section) : TForm_string(section) {}
|
TForm_number(TPrint_section* section) : TForm_string(section) {}
|
||||||
@ -613,14 +618,14 @@ bool TForm_number::parse_head(TScanner& scanner)
|
|||||||
|
|
||||||
bool TForm_number::update()
|
bool TForm_number::update()
|
||||||
{
|
{
|
||||||
TForm_item::update();
|
|
||||||
if (read())
|
if (read())
|
||||||
{
|
{
|
||||||
|
TForm_item::update();
|
||||||
const char* s = get();
|
const char* s = get();
|
||||||
real n(s);
|
real n(s);
|
||||||
n.round(decimals());
|
n.round(decimals());
|
||||||
s = n.string(picture());
|
s = n.string(picture());
|
||||||
put_paragraph(s);
|
string_at(-1, _y, s);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -650,11 +655,8 @@ TForm_date::TForm_date(TPrint_section* section)
|
|||||||
bool TForm_date::read()
|
bool TForm_date::read()
|
||||||
{
|
{
|
||||||
bool ok = TForm_string::read();
|
bool ok = TForm_string::read();
|
||||||
if ((!ok || !get()[0]) && automagic())
|
if (ok && !get()[0] && automagic())
|
||||||
{
|
|
||||||
set(main_app().printer().getdate());
|
set(main_app().printer().getdate());
|
||||||
ok = TRUE;
|
|
||||||
}
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,6 +859,12 @@ TPrintrow& TPrint_section::row(int num)
|
|||||||
return *pr;
|
return *pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TPrint_section::offset(int& x, int& y) const
|
||||||
|
{
|
||||||
|
if (x >= 0) x += _x;
|
||||||
|
if (y >= 0) y += _y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TForm_item* TPrint_section::parse_item(const TString& s)
|
TForm_item* TPrint_section::parse_item(const TString& s)
|
||||||
{
|
{
|
||||||
@ -885,6 +893,8 @@ TForm_item* TPrint_section::parse_item(TScanner& scanner)
|
|||||||
bool TPrint_section::parse(TScanner& scanner)
|
bool TPrint_section::parse(TScanner& scanner)
|
||||||
{
|
{
|
||||||
_height = scanner.integer();
|
_height = scanner.integer();
|
||||||
|
_x = scanner.integer();
|
||||||
|
_y = scanner.integer();
|
||||||
|
|
||||||
while (scanner.popkey() != "EN")
|
while (scanner.popkey() != "EN")
|
||||||
{
|
{
|
||||||
@ -930,6 +940,8 @@ bool TPrint_section::edit(const char* title)
|
|||||||
m.set_caption(title);
|
m.set_caption(title);
|
||||||
|
|
||||||
m.set(F_HEIGHT, _height);
|
m.set(F_HEIGHT, _height);
|
||||||
|
m.set(F_X, _x);
|
||||||
|
m.set(F_Y, _y);
|
||||||
|
|
||||||
if (m.run() == K_ESC)
|
if (m.run() == K_ESC)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -937,7 +949,11 @@ bool TPrint_section::edit(const char* title)
|
|||||||
bool dirty = m.dirty() != 0;
|
bool dirty = m.dirty() != 0;
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
|
{
|
||||||
_height = m.get_int(F_HEIGHT);
|
_height = m.get_int(F_HEIGHT);
|
||||||
|
_x = m.get_int(F_X);
|
||||||
|
_y = m.get_int(F_Y);
|
||||||
|
}
|
||||||
|
|
||||||
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Riga|Col.|Gr.|Descrizione@40", 0xE);
|
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Riga|Col.|Gr.|Descrizione@40", 0xE);
|
||||||
|
|
||||||
@ -1002,7 +1018,7 @@ bool TPrint_section::edit(const char* title)
|
|||||||
|
|
||||||
void TPrint_section::print_on(ostream& out) const
|
void TPrint_section::print_on(ostream& out) const
|
||||||
{
|
{
|
||||||
out << ' ' << _height << endl;
|
out << ' ' << _height << ' ' << _x << ' ' << _y << endl;
|
||||||
for(word i = 0; i < fields(); i++)
|
for(word i = 0; i < fields(); i++)
|
||||||
out << field(i);
|
out << field(i);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ class TPrint_section : public TArray
|
|||||||
static TMask* _msk;
|
static TMask* _msk;
|
||||||
|
|
||||||
word _height; // Altezza della sezione
|
word _height; // Altezza della sezione
|
||||||
|
int _x, _y; // Offset di stampa
|
||||||
|
|
||||||
TForm* _form; // Form cui appartiene alla sezione
|
TForm* _form; // Form cui appartiene alla sezione
|
||||||
TArray _item; // Lista dei campi da stampare
|
TArray _item; // Lista dei campi da stampare
|
||||||
@ -46,6 +47,10 @@ public:
|
|||||||
TForm_item& field(int n) const { return (TForm_item&)_item[n]; }
|
TForm_item& field(int n) const { return (TForm_item&)_item[n]; }
|
||||||
word fields() const { return _item.items(); }
|
word fields() const { return _item.items(); }
|
||||||
word height() const { return _height; }
|
word height() const { return _height; }
|
||||||
|
int offset_x() const { return _x; }
|
||||||
|
int offset_y() const { return _y; }
|
||||||
|
void offset(int& x, int& y) const;
|
||||||
|
|
||||||
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: relation.cpp,v 1.29 1995-01-03 15:06:36 guy Exp $
|
// $Id: relation.cpp,v 1.30 1995-01-09 16:51:18 guy Exp $
|
||||||
// relation.cpp
|
// relation.cpp
|
||||||
// fv 12/8/93
|
// fv 12/8/93
|
||||||
// relation class for isam files
|
// relation class for isam files
|
||||||
@ -36,10 +36,11 @@ class TRelationdef : public TObject
|
|||||||
const TRelation* _rel; // Relazione padre
|
const TRelation* _rel; // Relazione padre
|
||||||
int _num; // Posizione file
|
int _num; // Posizione file
|
||||||
int _numto; // Posizione padre
|
int _numto; // Posizione padre
|
||||||
byte _alias; // Alias
|
int _alias; // Alias
|
||||||
byte _key; // Chiave
|
byte _key; // Chiave
|
||||||
TArray _fields; // Campi di join
|
TArray _fields; // Campi di join
|
||||||
TArray _exprs; // Condizioni di uguaglianza
|
TArray _exprs; // Condizioni di uguaglianza
|
||||||
|
TArray _altexprs; // Condizioni di uguaglianza alternative
|
||||||
TBit_array _forced;
|
TBit_array _forced;
|
||||||
bool _first_match : 1; // primo match (ed esiste)
|
bool _first_match : 1; // primo match (ed esiste)
|
||||||
bool _allow_lock : 1; // ?????
|
bool _allow_lock : 1; // ?????
|
||||||
@ -53,13 +54,14 @@ public:
|
|||||||
// @FPUB
|
// @FPUB
|
||||||
int num() const { return _num; }
|
int num() const { return _num; }
|
||||||
int link() const { return _numto; }
|
int link() const { return _numto; }
|
||||||
byte alias() const { return _alias; }
|
int alias() const { return _alias; }
|
||||||
bool write_enable() const { return _write_enable; }
|
bool write_enable() const { return _write_enable; }
|
||||||
void write_enable(bool we) { _write_enable = we; }
|
void write_enable(bool we) { _write_enable = we; }
|
||||||
TRectype& load_rec(TRectype& r, const TBaseisamfile& from) const;
|
TRectype& load_rec(TRectype& r, const TBaseisamfile& from) const;
|
||||||
|
const char* evaluate_expr(int j, const TLocalisamfile& to);
|
||||||
|
|
||||||
TRelationdef(const TRelation* rel, int file, byte key,
|
TRelationdef(const TRelation* rel, int file, byte key,
|
||||||
int linkto, const char* relexprs, byte alias,
|
int linkto, const char* relexprs, int alias,
|
||||||
bool allow_lock, bool write_enable = FALSE);
|
bool allow_lock, bool write_enable = FALSE);
|
||||||
virtual ~TRelationdef() {}
|
virtual ~TRelationdef() {}
|
||||||
};
|
};
|
||||||
@ -67,7 +69,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
|
TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
|
||||||
int idx_to, const char* relexprs, byte alias,
|
int idx_to, const char* relexprs, int alias,
|
||||||
bool allow_lock, bool write_enable)
|
bool allow_lock, bool write_enable)
|
||||||
: _num(idx_file), _key(key), _numto(idx_to),
|
: _num(idx_file), _key(key), _numto(idx_to),
|
||||||
_rel(rel), _fields(4), _exprs(4), _alias(alias),
|
_rel(rel), _fields(4), _exprs(4), _alias(alias),
|
||||||
@ -105,11 +107,17 @@ TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
|
|||||||
eq++;
|
eq++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// const TString80 xx(s);
|
_fields.add(new TFieldref(s, 0));
|
||||||
// _fields.add(new TFieldref(xx,0));
|
|
||||||
_fields.add(new TFieldref(s,0));
|
|
||||||
|
|
||||||
_exprs.add(new TExpression(r.mid(eq+1), _strexpr));
|
s = r.mid(eq+1);
|
||||||
|
const int par = s.find('(');
|
||||||
|
if (par > 0)
|
||||||
|
{
|
||||||
|
_exprs.add(new TExpression(s.left(par), _strexpr), i);
|
||||||
|
_altexprs.add(new TExpression(s.sub(par+1, s.len()-1), _strexpr), i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_exprs.add(new TExpression(s, _strexpr), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,12 +143,16 @@ void TRelationdef::print_on(ostream& out) const
|
|||||||
|
|
||||||
if (_key > 1) out << " KEY " << (int)_key;
|
if (_key > 1) out << " KEY " << (int)_key;
|
||||||
|
|
||||||
if (_alias > 0) out << " ALIAS " << (int)_alias;
|
if (_alias > 0) out << " ALIAS " << _alias;
|
||||||
|
|
||||||
for (int i = 0; i < _fields.items(); i++)
|
for (int i = 0; i < _fields.items(); i++)
|
||||||
{
|
{
|
||||||
if (i == 0) out << " INTO";
|
if (i == 0) out << " INTO";
|
||||||
out << ' ' << _fields[i] << '=' << _exprs[i];
|
out << ' ' << _fields[i] << '=';
|
||||||
|
if (_forced[i]) out << '=';
|
||||||
|
out << _exprs[i];
|
||||||
|
if (_altexprs.objptr(i))
|
||||||
|
out << '(' << _altexprs[i] << ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,11 +184,34 @@ void TRelationdef::print_on(TToken_string& out) const
|
|||||||
for (int i = 0; i < _fields.items(); i++)
|
for (int i = 0; i < _fields.items(); i++)
|
||||||
{
|
{
|
||||||
if (i) out << ' ';
|
if (i) out << ' ';
|
||||||
out << _fields[i] << '=' << _exprs[i];
|
out << _fields[i] << '=';
|
||||||
|
if (_forced[i]) out << '=';
|
||||||
|
out << _exprs[i];
|
||||||
|
if (_altexprs.objptr(i))
|
||||||
|
out << '(' << _altexprs[i] << ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char* TRelationdef::evaluate_expr(int j, const TLocalisamfile& to)
|
||||||
|
{
|
||||||
|
TExpression& expr = (TExpression&)_exprs[j];
|
||||||
|
for (int k = 0; k < expr.numvar(); k++)
|
||||||
|
expr.setvar(k, to.get(expr.varname(k)));
|
||||||
|
|
||||||
|
const char* val = expr;
|
||||||
|
|
||||||
|
if (*val == '\0' && _altexprs.objptr(j))
|
||||||
|
{
|
||||||
|
TExpression& altexpr = (TExpression&)_altexprs[j];
|
||||||
|
for (int k = 0; k < expr.numvar(); k++)
|
||||||
|
altexpr.setvar(k, to.get(altexpr.varname(k)));
|
||||||
|
val = altexpr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TRelation
|
// TRelation
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -271,7 +306,7 @@ int TRelation::log2ind(int log) const
|
|||||||
// NOTFOUND if not present
|
// NOTFOUND if not present
|
||||||
// sets error status
|
// sets error status
|
||||||
|
|
||||||
if (log < 0) return alias2ind(byte(-log));
|
if (log < 0) return alias2ind(-log);
|
||||||
|
|
||||||
const int num = _files.items();
|
const int num = _files.items();
|
||||||
if (log > 0)
|
if (log > 0)
|
||||||
@ -282,7 +317,7 @@ int TRelation::log2ind(int log) const
|
|||||||
return num ? 0 : NOTFOUND;
|
return num ? 0 : NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TRelation::alias2ind(byte alias) const
|
int TRelation::alias2ind(int alias) const
|
||||||
{
|
{
|
||||||
if (alias < 1) return 0;
|
if (alias < 1) return 0;
|
||||||
|
|
||||||
@ -341,7 +376,7 @@ void TRelation::write_enable(const char* name, const bool on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TRelation::add(int logicnum, const char* relexprs, int key,
|
bool TRelation::add(int logicnum, const char* relexprs, int key,
|
||||||
int linkto, byte alias, bool allow_lock)
|
int linkto, int alias, bool allow_lock)
|
||||||
{
|
{
|
||||||
const int idxto = log2ind(linkto);
|
const int idxto = log2ind(linkto);
|
||||||
if (idxto == NOTFOUND)
|
if (idxto == NOTFOUND)
|
||||||
@ -361,7 +396,7 @@ bool TRelation::add(int logicnum, const char* relexprs, int key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TRelation::add(const char* tabname, const char* relexprs, int key,
|
bool TRelation::add(const char* tabname, const char* relexprs, int key,
|
||||||
int linkto, byte alias, bool allow_lock)
|
int linkto, int alias, bool allow_lock)
|
||||||
|
|
||||||
{
|
{
|
||||||
// look for <to> file
|
// look for <to> file
|
||||||
@ -429,20 +464,18 @@ int TRelation::position_rels(TIsamop op, TReclock lockop,
|
|||||||
{
|
{
|
||||||
for (int j = 0 ; j < rd._fields.items(); j++) // for each field
|
for (int j = 0 ; j < rd._fields.items(); j++) // for each field
|
||||||
{
|
{
|
||||||
TExpression& expr = (TExpression&)rd._exprs[j];
|
/*
|
||||||
|
TExpression& expr = (TExpression&)rd._exprs[j];
|
||||||
// setvar for every variable
|
for (int k = 0; k < expr.numvar(); k++)
|
||||||
for (int k = 0; k < expr.numvar(); k++)
|
expr.setvar(k, to.get(expr.varname(k)));
|
||||||
expr.setvar(k, to.get(expr.varname(k)));
|
*/
|
||||||
|
const char* expr = rd.evaluate_expr(j, to);
|
||||||
// eval expression and put result in field
|
|
||||||
|
|
||||||
TFieldref& s = (TFieldref&) rd._fields[j];
|
TFieldref& s = (TFieldref&) rd._fields[j];
|
||||||
s.write(expr, from.curr());
|
s.write(expr, from.curr());
|
||||||
} // for each field
|
} // for each field
|
||||||
}
|
}
|
||||||
|
|
||||||
// read record: if not found, empty current record
|
// read record: if not found, zero current record
|
||||||
TRectype rec(from.curr());
|
TRectype rec(from.curr());
|
||||||
from.read(op, lck, atdate);
|
from.read(op, lck, atdate);
|
||||||
if (from.bad())
|
if (from.bad())
|
||||||
@ -458,11 +491,7 @@ int TRelation::position_rels(TIsamop op, TReclock lockop,
|
|||||||
{
|
{
|
||||||
TFieldref& fl = (TFieldref&)rd._fields[kk];
|
TFieldref& fl = (TFieldref&)rd._fields[kk];
|
||||||
const TString f_fr(fl.read(from.curr()));
|
const TString f_fr(fl.read(from.curr()));
|
||||||
|
eq = (f_fr == rd.evaluate_expr(kk, to));
|
||||||
TExpression& expr = (TExpression&)rd._exprs[kk];
|
|
||||||
for (int k = 0; k < expr.numvar(); k++)
|
|
||||||
expr.setvar(k, to.get(expr.varname(k)));
|
|
||||||
eq = (f_fr == (const char*)expr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (eq) from.setstatus(NOERR);
|
if (eq) from.setstatus(NOERR);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: relation.h,v 1.9 1994-12-20 15:11:23 guy Exp $ */
|
/* $Id: relation.h,v 1.10 1995-01-09 16:51:20 guy Exp $ */
|
||||||
// join.h
|
// join.h
|
||||||
// fv 12/8/93
|
// fv 12/8/93
|
||||||
// join class for isam files
|
// join class for isam files
|
||||||
@ -31,7 +31,7 @@ protected:
|
|||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
|
|
||||||
int log2ind(int logicnum) const;
|
int log2ind(int logicnum) const;
|
||||||
int alias2ind(byte alias) const;
|
int alias2ind(int alias) const;
|
||||||
int name2ind(const char* name) const;
|
int name2ind(const char* name) const;
|
||||||
|
|
||||||
TRelationdef& reldef(int i) const { return (TRelationdef&)_reldefs[i]; }
|
TRelationdef& reldef(int i) const { return (TRelationdef&)_reldefs[i]; }
|
||||||
@ -76,9 +76,9 @@ public:
|
|||||||
// @DES add relation
|
// @DES add relation
|
||||||
// @FPUB
|
// @FPUB
|
||||||
bool add(int logicnum, const char* relexprs, int key = 1,
|
bool add(int logicnum, const char* relexprs, int key = 1,
|
||||||
int linkto = 0, byte alias = 0, bool allow_lock = FALSE);
|
int linkto = 0, int alias = 0, bool allow_lock = FALSE);
|
||||||
bool add(const char* tabname, const char* relexprs, int key = 1,
|
bool add(const char* tabname, const char* relexprs, int key = 1,
|
||||||
int linkto = 0, byte alias = 0, bool allow_lock = FALSE);
|
int linkto = 0, int alias = 0, bool allow_lock = FALSE);
|
||||||
|
|
||||||
|
|
||||||
// @DES write methods
|
// @DES write methods
|
||||||
|
@ -401,12 +401,13 @@ TString& TString::picture(const char* pic, const char* s)
|
|||||||
|
|
||||||
set(pic);
|
set(pic);
|
||||||
|
|
||||||
int l = strlen(s)-1; // Prossimo carattere da sostituire a #
|
int l = strlen(s)-1; // Prossimo carattere da sostituire a # o @
|
||||||
|
|
||||||
for (int i = len()-1; i >= 0; i--)
|
for (int i = len()-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
const char k = pic[i];
|
const char k = pic[i];
|
||||||
if (k == '#') _str[i] = (l >= 0) ? s[l--] : ' ';
|
if (k == '#') _str[i] = (l >= 0) ? s[l--] : ' ';
|
||||||
|
else if (k == '@') _str[i] = (l >= 0) ? s[l--] : '0';
|
||||||
else if (k == '~') { _str[i] = ' '; l--; }
|
else if (k == '~') { _str[i] = ' '; l--; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user