Resa const la variabile botime

git-svn-id: svn://10.65.10.50/trunk@184 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-09-07 17:00:25 +00:00
parent 60064f97d3
commit c48cfadb7d
11 changed files with 321 additions and 301 deletions

View File

@ -446,8 +446,8 @@ bool TApplication::set_firm(long newfirm)
enable_menu_item(M_FILE_NEW);
if (k == K_ENTER)
{
newfirm = atol(mask.get(F_CODDITTA));
const int tipodir = atoi(mask.get(F_TIPO));
newfirm = mask.get_long(F_CODDITTA);
const int tipodir = mask.get_int(F_TIPO);
if (tipodir > 0)
{

View File

@ -9,10 +9,10 @@
#include <strings.h>
#include <utility.h>
#define DAYBIAS 36525L
#define NULLDATE -99999L
#define DAYBIAS 36525L
#define NULLDATE -99999L
TDate nodate, botime, eotime(31,12,2050);
const TDate nodate, botime, eotime(31,12,2050);
HIDDEN TDate __tmp_date;
HIDDEN char __date_tmp_string[20];

View File

@ -83,7 +83,7 @@ const char* itom(byte month); // Ritorna il nome del mese (1-12)
const char* itow(byte dayofweek); // Ritorna il nome del giorno (1-7)
// @DPUB
extern TDate nodate, botime, eotime;
extern const TDate nodate, botime, eotime;
// @END
#endif // __DATE_H

View File

@ -40,9 +40,6 @@
const int MAX_KEYS = 8;
// @END
class TBaseisamfile;
class TExtrectype;
// @C
// Classe TRectype : public TObject
//
@ -173,7 +170,7 @@ class TBaseisamfile : public TObject
friend class TIsamfile;
friend class TIsamtempfile;
friend class TRecfield;
// friend class TCursor;
// friend class TCursor;
// @END
// @FPRIV
// friend TRecnotype __buildcursor(TFilecursor* tic, TRecnotype rp);
@ -196,30 +193,30 @@ protected:
public:
// @FPUB
void setkey(int nkey); // Attiva una chiave
int getkey() const; // Ritorna la chiave
void setstatus(int status) { _lasterr = status;} // Setta _lasterr
void setkey(int nkey); // Attiva una chiave
int getkey() const; // Ritorna la chiave
void setstatus(int status) { _lasterr = status; } // Setta _lasterr
virtual int first(word lockop = _nolock);
virtual int last(word lockop = _nolock);
virtual int next(word lockop = _nolock);
virtual int next(TDate& atdate);
virtual int prev(word lockop = _nolock);
virtual int prev(TDate& atdate);
virtual int reread(word lockop = _nolock, TDate& atdate = botime);
virtual int reread(TRectype& rec, word lockop = _nolock, TDate& atdate = botime);
virtual int reread(word lockop = _nolock, TDate& atdate = (TDate&)botime);
virtual int reread(TRectype& rec, word lockop = _nolock, TDate& atdate = (TDate&)botime);
virtual int skip(TRecnotype nrec, word lockop = _nolock);
virtual int read(word op = _isequal, word lockop = _nolock, TDate& atdate = botime);
virtual int read(TRectype& rec, word op = _isequal, word lockop = _nolock, TDate& atdate = botime);
virtual int read(word op = _isequal, word lockop = _nolock, TDate& atdate = (TDate&)botime);
virtual int read(TRectype& rec, word op = _isequal, word lockop = _nolock, TDate& atdate = (TDate&)botime);
virtual int readat(TRecnotype nrec, word lockop = _nolock);
virtual int readat(TRectype& rec, TRecnotype nrec, word lockop = _nolock);
virtual int write(TDate& atdate = botime);
virtual int write(const TRectype& rec, TDate& atdate = botime);
virtual int rewrite(TDate& atdate = botime);
virtual int rewrite(const TRectype& rec, TDate& atdate = botime);
virtual int write(TDate& atdate = (TDate&)botime);
virtual int write(const TRectype& rec, TDate& atdate = (TDate&)botime);
virtual int rewrite(TDate& atdate = (TDate&)botime);
virtual int rewrite(const TRectype& rec, TDate& atdate = (TDate&)botime);
virtual int rewriteat(TRecnotype nrec);
virtual int rewriteat(const TRectype& rec, TRecnotype nrec);
virtual int remove(TDate& atdate = botime);
virtual int remove(const TRectype& rec, TDate& atdate = botime);
virtual int remove(TDate& atdate = (TDate&)botime);
virtual int remove(const TRectype& rec, TDate& atdate = (TDate&)botime);
virtual const char* name() const;
TRecnotype recno() const { return _recno;}

View File

@ -1,224 +1,225 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#define __PREFIX_CPP
#include <prefix.h>
#ifndef FOXPRO
#include <applicat.h>
#endif
#include <array.h>
#include <extcdecl.h>
#include <scanner.h>
#include <utility.h>
HIDDEN const char* const glockname = "xx";
TPrefix::TPrefix()
{
CHECK(prefhndl == NULL, "Can't create two prefix objects");
_prefix = ".";
_dirfl = dirfl;
_recfl = recfl;
_fdir = fdir;
_rdir = rdir;
}
TPrefix::~TPrefix()
{
set();
}
HIDDEN int closeall(bool changestudy, TBit_array& excl)
{
if (!openf) return 0;
TDir d;
d.get(1);
const int max = (int) d.eod();
int err = NOERR;
for (int i = 1; i < max; i++)
if (openf[i] != NULL)
{
isfdptr isfd = openf[i];
d.get(i + 1, _nolock, _nordir, _sysdirop);
if (changestudy || d.name()[0] != '%')
{
excl.set(i, isfd->f.LockMode == _excllock);
CClose(&isfd->f);
CBCloseFile(&isfd->i, &err);
exclunlock(CInsPref((char*) glockname, _nordir), FALSE);
}
}
return max;
}
HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax)
{
if (!openf) return ;
TDir d;
d.get(1);
const int max = (int) d.eod();
for (int i = max; i < oldmax; i++)
if (openf[i] != NULL)
{
d.get(i + 1, _nolock, _nordir, _sysdirop);
if (changestudy || d.name()[0] != '%')
fatal_box("Can't reopen file n. %d", i + 1);
}
int err = NOERR;
for (i = 1; i < max; i++)
if (openf[i] != NULL)
{
isfdptr isfd = openf[i];
d.get(i + 1, _nolock, _nordir, _sysdirop);
if (changestudy || d.name()[0] != '%')
{
isfd->ft = d.name()[0] == '%' ? _comdir : _nordir;
d.get(i + 1, _nolock, (TDirtype) isfd->ft);
*isfd->d = *d.filedesc();
TTrec r;
r.get(i + 1, (TDirtype) isfd->ft);
*isfd->r = *r.rec();
if (excllock(CInsPref((char*) glockname, NORDIR), FALSE) == -1 && errno == EACCES)
fatal_box("Can't reopen file n. %d : file in use", i + 1);
COpen(&isfd->f, isfd->d->SysName, isfd->d->LenR, 0, excl[i]);
if ((err = isfd->f.IOR) == NOERR)
CBOpenFile (&isfd->i, CGetIdxName(isfd->d->SysName), excl[i], &err);
if (err != NOERR)
fatal_box("Can't reopen file n. %d : error n. %d", i + 1, err);
}
}
}
void TPrefix::set(const char* name, bool force, TFilelock mode)
{
if (name == NULL)
{
CCloseDir(NORDIR);
CCloseDir(COMDIR);
CCloseRecDir(NORDIR);
CCloseRecDir(COMDIR);
return;
}
if (_prefix == name) return;
if (!force && !test(name)) return;
TBit_array excl;
int max = 0;
if (_prefix != ".")
{
max = closeall(FALSE, excl);
CCloseDir(NORDIR);
CCloseDir(COMDIR);
CCloseRecDir(NORDIR);
CCloseRecDir(COMDIR);
}
if (strcmp(name, "DEF") == 0)
{
CGetPref();
_prefix = cprefix;
const int l = strlen(__ptprf);
if (l > 0) _prefix.ltrim(l);
}
else
{
_prefix = name;
if (*__ptprf && *name) strcpy(cprefix, __ptprf);
else strcpy(cprefix, "");
strcat(cprefix, name);
}
if (!test(_prefix))
fatal_box("Impossibile utilizzare la ditta %s", name);
COpenDir((int) mode, NORDIR);
COpenDir((int) mode, COMDIR);
COpenRecDir((int) mode, NORDIR);
COpenRecDir((int) mode, COMDIR);
if (_prefix != ".")
openall(FALSE, excl, max);
}
bool TPrefix::test(const char* s) const
{
if (s && *s && strcmp(s, "DEF"))
{
TString80 s1; s1 << __ptprf << s << "/dir.gen";
if (!fexist(s1))
return error_box("Impossibile trovare il file '%s'", (const char*)s1);
}
if ((_dirfl[0] > 1) || (_dirfl[1] > 1) ||
(_recfl[0] > 1) || (_recfl[1] > 1))
return error_box("Impossibile cambiare ditta (dir.gen o trc.gen in uso)");
return TRUE;
}
void TPrefix::put()
{
CPutPref((char*)(const char*)_prefix);
}
bool TPrefix::test(long codditta) const
{
TString16 s; s.format("%05lda", codditta);
return test(s);
}
long TPrefix::get_codditta() const
{
const long codditta = atol((const char*)_prefix);
return codditta;
}
bool TPrefix::set_codditta(long codditta, bool force)
{
if (force || test(codditta))
{
TString16 s; s.format("%05lda", codditta);
set(s, force);
put();
return TRUE;
}
else return FALSE;
}
const char* firm2dir(long codditta)
{
TFixed_string dir(__tmp_string, 256);
dir.format("%05lda", codditta);
dir.insert(__ptprf, 0);
return __tmp_string;
}
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#define __PREFIX_CPP
#include <prefix.h>
#ifndef FOXPRO
#include <applicat.h>
#endif
#include <array.h>
#include <extcdecl.h>
#include <scanner.h>
#include <utility.h>
HIDDEN const char* const glockname = "xx";
TPrefix::TPrefix()
{
CHECK(prefhndl == NULL, "Can't create two prefix objects");
_prefix = ".";
_dirfl = dirfl;
_recfl = recfl;
_fdir = fdir;
_rdir = rdir;
}
TPrefix::~TPrefix()
{
set();
}
HIDDEN int closeall(bool changestudy, TBit_array& excl)
{
if (!openf) return 0;
TDir d;
d.get(1);
const int max = (int) d.eod();
int err = NOERR;
for (int i = 1; i < max; i++)
if (openf[i] != NULL)
{
isfdptr isfd = openf[i];
d.get(i + 1, _nolock, _nordir, _sysdirop);
if (changestudy || d.name()[0] != '%')
{
excl.set(i, isfd->f.LockMode == _excllock);
CClose(&isfd->f);
CBCloseFile(&isfd->i, &err);
exclunlock(CInsPref((char*) glockname, _nordir), FALSE);
}
}
return max;
}
HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax)
{
if (!openf) return ;
TDir d;
d.get(1);
const int max = (int) d.eod();
for (int i = max; i < oldmax; i++)
if (openf[i] != NULL)
{
d.get(i + 1, _nolock, _nordir, _sysdirop);
if (changestudy || d.name()[0] != '%')
fatal_box("Can't reopen file n. %d", i + 1);
}
int err = NOERR;
for (i = 1; i < max; i++)
if (openf[i] != NULL)
{
isfdptr isfd = openf[i];
d.get(i + 1, _nolock, _nordir, _sysdirop);
if (changestudy || d.name()[0] != '%')
{
isfd->ft = d.name()[0] == '%' ? _comdir : _nordir;
d.get(i + 1, _nolock, (TDirtype) isfd->ft);
*isfd->d = *d.filedesc();
TTrec r;
r.get(i + 1, (TDirtype) isfd->ft);
*isfd->r = *r.rec();
if (excllock(CInsPref((char*) glockname, NORDIR), FALSE) == -1 && errno == EACCES)
fatal_box("Can't reopen file n. %d : file in use", i + 1);
COpen(&isfd->f, isfd->d->SysName, isfd->d->LenR, 0, excl[i]);
if ((err = isfd->f.IOR) == NOERR)
CBOpenFile (&isfd->i, CGetIdxName(isfd->d->SysName), excl[i], &err);
if (err != NOERR)
fatal_box("Can't reopen file n. %d : error n. %d", i + 1, err);
}
}
}
void TPrefix::set(const char* name, bool force, TFilelock mode)
{
if (name == NULL)
{
CCloseDir(NORDIR);
CCloseDir(COMDIR);
CCloseRecDir(NORDIR);
CCloseRecDir(COMDIR);
return;
}
if (_prefix == name) return;
if (!force && !test(name)) return;
TBit_array excl;
int max = 0;
if (_prefix != ".")
{
max = closeall(FALSE, excl);
CCloseDir(NORDIR);
CCloseDir(COMDIR);
CCloseRecDir(NORDIR);
CCloseRecDir(COMDIR);
}
if (strcmp(name, "DEF") == 0)
{
CGetPref();
_prefix = cprefix;
const int l = strlen(__ptprf);
if (l > 0) _prefix.ltrim(l);
}
else
{
_prefix = name;
if (*__ptprf && *name) strcpy(cprefix, __ptprf);
else strcpy(cprefix, "");
strcat(cprefix, name);
}
if (!test(_prefix))
fatal_box("Impossibile utilizzare la ditta %s", name);
COpenDir((int) mode, NORDIR);
COpenDir((int) mode, COMDIR);
COpenRecDir((int) mode, NORDIR);
COpenRecDir((int) mode, COMDIR);
if (_prefix != ".")
openall(FALSE, excl, max);
}
bool TPrefix::test(const char* s) const
{
if (s && *s && strcmp(s, "DEF"))
{
TString80 s1(__ptprf);
s1 << s << "/dir.gen";
if (!fexist(s1))
return error_box("Impossibile trovare il file '%s'", (const char*)s1);
}
if ((_dirfl[0] > 1) || (_dirfl[1] > 1) ||
(_recfl[0] > 1) || (_recfl[1] > 1))
return error_box("Impossibile cambiare ditta (dir.gen o trc.gen in uso)");
return TRUE;
}
void TPrefix::put()
{
CPutPref((char*)(const char*)_prefix);
}
bool TPrefix::test(long codditta) const
{
TString16 s; s.format("%05lda", codditta);
return test(s);
}
long TPrefix::get_codditta() const
{
const long codditta = atol((const char*)_prefix);
return codditta;
}
bool TPrefix::set_codditta(long codditta, bool force)
{
if (force || test(codditta))
{
TString16 s; s.format("%05lda", codditta);
set(s, force);
put();
return TRUE;
}
else return FALSE;
}
const char* firm2dir(long codditta)
{
TFixed_string dir(__tmp_string, 256);
dir.format("%05lda", codditta);
dir.insert(__ptprf, 0);
return __tmp_string;
}

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.6 1994-09-01 13:31:24 alex Exp $
// $Id: relation.cpp,v 1.7 1994-09-07 17:00:16 guy Exp $
// relation.cpp
// fv 12/8/93
// relation class for isam files
@ -516,7 +516,7 @@ bool TRelation::next_match(int logicnum, const char* fieldlist, int nkey)
}
// Riposiziona gli eventuali files successivi
position_rels(_isequal, _nolock, botime, j+1);
position_rels(_isequal, _nolock, (TDate&)botime, j+1);
reldef(j)->_first_match = FALSE;
return ok;
@ -535,6 +535,9 @@ bool TRelation::is_first_match(int logicnum)
return err == NOERR;
}
#ifdef DBG
bool TRelation::isconsistent(bool reset)
{
const int MAXREL = 24;
@ -552,7 +555,7 @@ bool TRelation::isconsistent(bool reset)
if (bad)
return _errors = bad;
position_rels(_isequal, _nolock, botime);
position_rels(_isequal, _nolock, (TDate&)botime);
for (i = 0; i < _files.items(); i++)
if (file(i)->recno() != recnos[i])
{
@ -568,6 +571,9 @@ bool TRelation::isconsistent(bool reset)
return this->_errors = bad;
}
#endif
int TRelation::write(bool force, TDate& atdate)
{
_errors = NOERR;

View File

@ -1,4 +1,4 @@
/* $Id: relation.h,v 1.2 1994-08-26 14:06:07 alex Exp $ */
/* $Id: relation.h,v 1.3 1994-09-07 17:00:18 guy Exp $ */
// join.h
// fv 12/8/93
// join class for isam files
@ -47,7 +47,7 @@ protected:
// adatto su un file, svuota il record corrente e non ritorna errore.
// write etc. poi procedono normalmente
// @END
int position_rels(TIsamop op = _isequal, TReclock lockop = _nolock, TDate& atdate = botime, int first = 0);
int position_rels(TIsamop op = _isequal, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime, int first = 0);
friend class TCursor;
@ -62,7 +62,7 @@ public:
virtual int first(TReclock lockop = _nolock) { return file()->first(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int last(TReclock lockop = _nolock) { return file()->last(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int skip(TRecnotype nrec, TReclock lockop = _nolock) { return file()->skip(nrec, lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = botime) { return file()->read(op, lockop, atdate) == NOERR ? position_rels(_isequal, lockop, atdate) : file()->status();}
virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime) { return file()->read(op, lockop, atdate) == NOERR ? position_rels(_isequal, lockop, atdate) : file()->status();}
TLocalisamfile* lfile(int logicnum = 0) const;
TLocalisamfile* lfile(const char* name) const;
@ -88,9 +88,9 @@ public:
// @DES write methods
// @FPUB
virtual int write (bool force = TRUE, TDate& atdate = botime);
virtual int rewrite(bool force = TRUE, TDate& atdate = botime);
virtual int remove (TDate& atdate = botime);
virtual int write (bool force = TRUE, TDate& atdate = (TDate&)botime);
virtual int rewrite(bool force = TRUE, TDate& atdate = (TDate&)botime);
virtual int remove (TDate& atdate = (TDate&)botime);
// @DES checking methods
// @FPUB
@ -197,7 +197,7 @@ public:
TRectype& curr(int log = 0) const { return _if->curr(log); }
TRectype& curr(const char * tab) const
{ return _if->lfile(tab)->curr(); }
TRecnotype read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = botime);
TRecnotype read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime);
virtual bool ok() const;
const char* filter() const { return _filter; }

View File

@ -16,7 +16,7 @@
#include <utility.h>
HIDDEN const int MAXSTR = 257;
HIDDEN const int MAXSTR = 301;
HIDDEN char __spark[MAXSTR]; // Utility buffer
TFixed_string spark(__spark, MAXSTR);
@ -54,7 +54,7 @@ int TString::make_room(int s)
const int lun = len();
const int spare = size() - lun;
if (spare < s)
resize(size() + 2*s, TRUE);
resize(size() + 2*s, TRUE); // Melius abundare ...
return lun;
}
@ -97,7 +97,7 @@ TString& TString::operator <<(char c)
TString& TString::operator <<(int n)
{
const int pos = make_room(6);
const int pos = make_room(8);
sprintf(&_str[pos], "%d", n);
return *this;
}
@ -215,8 +215,7 @@ bool TString::match(const char* s) const
#if XVT_OS == XVT_OS_SCOUNIX
HIDDEN char* strstr(const char* string1, const char* string2)
{
int len = strlen(string2);
const int len = strlen(string2);
while (*string1)
{
if (strncmp(string1, string2, len) == 0) return (char*) string1;
@ -258,13 +257,13 @@ const char* TString::mid(int from, int count) const
{
const int l = len();
#ifdef DBG
if (from < 0)
{
#ifdef DBG
error_box("Ivalid MID parameter: from = %d", from);
#endif
from = 0;
}
#endif
if (from > l) from = l;
if (count < 1) count = l-from;
@ -274,7 +273,7 @@ const char* TString::mid(int from, int count) const
}
// Certified 90% (uses mid)
// Certified 100% (uses mid)
const char* TString::sub(int from, int to) const
{
const int count = to-from;
@ -346,7 +345,7 @@ TString& TString::trim()
return *this;
}
// Certified 99%
// Certified 100%
TString& TString::fill(char c, int n)
{
if (n < 0) n = size(); else
@ -356,7 +355,7 @@ TString& TString::fill(char c, int n)
return *this;
}
// Certified 100%
TString& TString::right_just(int n, char c)
{
if (n < 0) n = size();
@ -368,6 +367,7 @@ TString& TString::right_just(int n, char c)
return *this;
}
// Certified 100%
TString& TString::center_just(int n, char c)
{
if (n < 0) n = size();
@ -380,6 +380,7 @@ TString& TString::center_just(int n, char c)
return *this;
}
// Certified 100%
TString& TString::left_just(int n, char c)
{
if (n < 0) n = size();
@ -418,7 +419,7 @@ TString& TString::format(const char* fmt, ...)
const int tot = vsprintf(__spark, fmt, pars);
va_end(pars);
CHECK(tot >= 0 && tot < sizeof(__spark)-1, "Ue'! Quanto scrivi?");
CHECK(tot >= 0 && tot < spark.size(), "Ue'! Quanto scrivi?");
if (tot > size()) resize(tot, FALSE);
strcpy(_str, __spark);
@ -489,7 +490,7 @@ word TString::hash() const
TFixed_string::TFixed_string(const char* str, int size)
: TString((char*)str, (size < 1) ? strlen(str) : size-1)
{
if (size > 0 && memchr(str, 0, size) == NULL)
if (size > 0 && memchr(str, '\0', size) == NULL)
cut(0);
}
@ -503,8 +504,7 @@ TFixed_string::~TFixed_string()
void TFixed_string::resize(int size, bool)
{
#ifdef DBG
fatal_box("Impossibile ridimensionare una stringa fissa da %d a %d",
_size, size);
fatal_box("Impossibile ridimensionare una stringa fissa da %d a %d", _size, size);
#endif
}
@ -517,6 +517,20 @@ void TFixed_string::strncpy(const char* s, int n)
_str[i] = '\0';
}
// Certified 99%
// More efficient than TString::format, it does not use spark
TString& TFixed_string::format(const char* fmt, ...)
{
va_list pars;
va_start(pars, fmt);
const int tot = vsprintf(_str, fmt, pars);
va_end(pars);
CHECK(tot >= 0 && tot < size(), "Ue'! Quanto scrivi?");
return *this;
}
///////////////////////////////////////////////////////////
// Filename
///////////////////////////////////////////////////////////
@ -625,7 +639,7 @@ TToken_string::TToken_string(const char* s, char separator)
// Certified 100%
TToken_string::TToken_string(int n, char separator)
: TString(n), _separator(separator), _last(-2)
: TString(n), _separator(separator), _last(0)
{}
@ -662,8 +676,7 @@ const char* TToken_string::get()
{
const int k = find(_separator, start);
_last = (k >= 0) ? k+1 : -1;
if (k)
return sub(start, k);
return sub(start, k);
}
return "";
}
@ -671,15 +684,13 @@ const char* TToken_string::get()
// Certified 50%
const char* TToken_string::get(int n)
{
if (_last == -2) return NULL;
if (n < 0)
{
if (n == -2)
{
const char* sep = strrchr(_str, _separator);
_last = -1;
return sep ? sep+1 : NULL;
return sep ? sep+1 : _str;
}
else return get();
}
@ -732,7 +743,7 @@ int TToken_string::get_int(int n)
long TToken_string::get_long(int n)
{
const char* num = get(n);
return num ? atol(num) : 0;
return num ? atol(num) : 0L;
}
@ -785,9 +796,13 @@ bool TToken_string::empty_items() const
// Certified 80%
int TToken_string::items() const
{
if (_last == -2 || empty()) return 0;
int t = 1;
for (const char* s = _str; *s; s++) if (*s == _separator) t++;
int t = 0;
if (not_empty())
{
t++;
for (const char* s = _str; *s; s++)
if (*s == _separator) t++;
}
return t;
}

View File

@ -92,7 +92,7 @@ public:
TString& left_just(int n = -1, char c = ' '); // Giustifica a sinistra
TString& picture(const char* pic, const char* s);
TString& format(const char* fmt, ...);
virtual TString& format(const char* fmt, ...);
TString& cut(int n); // Inserisce un '\0' alla posizione n-esima.
@ -142,9 +142,10 @@ public:
TFixed_string(const char* str, int size = -1);
virtual ~TFixed_string();
virtual TString& format(const char* fmt, ...);
const TString& operator =(const TString& s) { return set((const char*)s); }
const TString& operator=(const char* s) { return set(s); }
void strncpy(const char* s, int n);
};

View File

@ -64,14 +64,15 @@ int TTable::last(word lockop)
int TTable::next(word lockop)
{
TRecfield codtab(curr(), "CODTAB");
read();
if (bad()) return status();
TRecnotype nrec = recno();
const TRecnotype nrec = recno();
if (nrec != filehnd()->RecNo)
{
read();
if (bad()) return status();
}
TBaseisamfile::next(lockop);
const char *c = (const char *) codtab;
@ -87,7 +88,6 @@ int TTable::next(word lockop)
int TTable::prev(word lockop)
{
TRecfield codtab(curr(), "CODTAB");

View File

@ -2,7 +2,7 @@
#define __TABUTIL_H
#ifndef __ISAM_H
#include <isam.h>
#include <isam.h>
#endif
/*
@ -30,19 +30,19 @@ public:
int last(word lockop = _nolock);
int next(word lockop = _nolock);
int prev(word lockop = _nolock);
int reread(word lockop = _nolock, TDate& = botime);
int reread(TRectype& rec, word lockop = _nolock, TDate& = botime);
int reread(word lockop = _nolock, TDate& = (TDate&)botime);
int reread(TRectype& rec, word lockop = _nolock, TDate& = (TDate&)botime);
int skip(TRecnotype nrec, word lockop = _nolock);
int read(word op = _isequal, word lockop = _nolock, TDate& = botime);
int read(TRectype& rec, word op = _isequal, word lockop = _nolock, TDate& = botime);
int read(word op = _isequal, word lockop = _nolock, TDate& = (TDate&)botime);
int read(TRectype& rec, word op = _isequal, word lockop = _nolock, TDate& = (TDate&)botime);
int readat(TRecnotype nrec, word lockop = _nolock);
int readat(TRectype& rec, TRecnotype nrec, word lockop = _nolock);
int write(TDate& = botime);
int write(const TRectype& rec, TDate& = botime);
int rewrite(TDate& = botime);
int rewrite(const TRectype& rec, TDate& = botime);
int remove(TDate& = botime);
int remove(const TRectype& rec, TDate& = botime);
int write(TDate& = (TDate&)botime);
int write(const TRectype& rec, TDate& = (TDate&)botime);
int rewrite(TDate& = (TDate&)botime);
int rewrite(const TRectype& rec, TDate& = (TDate&)botime);
int remove(TDate& = (TDate&)botime);
int remove(const TRectype& rec, TDate& = (TDate&)botime);
virtual const char* name() const { return (const char*) _tabname;}