Aggiunti costruttori a TFilename e TFixedstring
git-svn-id: svn://10.65.10.50/trunk@729 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f653e062d1
commit
74475d0641
@ -1,132 +1,132 @@
|
|||||||
#include <bagn001a.h>
|
#include <bagn001a.h>
|
||||||
|
|
||||||
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 76 13
|
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 76 13
|
||||||
|
|
||||||
RADIOBUTTON MSK_1_TYPE 1 70
|
RADIOBUTTON MSK_1_TYPE 1 70
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Stampa su..."
|
PROMPT 1 1 "Stampa su..."
|
||||||
HELP "Selezionare il tipo dove direzionare la stampa"
|
HELP "Selezionare il tipo dove direzionare la stampa"
|
||||||
ITEM "0|Stampante"
|
ITEM "0|Stampante"
|
||||||
MESSAGE HIDE,MSK_1_FILENAME
|
MESSAGE HIDE,MSK_1_FILENAME
|
||||||
MESSAGE SHOW,MSK_1_PRINTERS|ENABLE,MSK_1_PRINTERS
|
MESSAGE SHOW,MSK_1_PRINTERS|ENABLE,MSK_1_PRINTERS
|
||||||
MESSAGE ENABLE,MSK_1_CODES
|
MESSAGE ENABLE,MSK_1_CODES
|
||||||
MESSAGE ENABLE,MSK_1_SIZE
|
MESSAGE ENABLE,MSK_1_SIZE
|
||||||
MESSAGE ENABLE,MSK_1_LINES
|
MESSAGE ENABLE,MSK_1_LINES
|
||||||
MESSAGE ENABLE,DLG_SETPRINT
|
MESSAGE ENABLE,DLG_SETPRINT
|
||||||
ITEM "2|Visualizzazione"
|
ITEM "2|Visualizzazione"
|
||||||
MESSAGE HIDE,MSK_1_FILENAME
|
MESSAGE HIDE,MSK_1_FILENAME
|
||||||
MESSAGE SHOW,MSK_1_PRINTERS|DISABLE,MSK_1_PRINTERS
|
MESSAGE SHOW,MSK_1_PRINTERS|DISABLE,MSK_1_PRINTERS
|
||||||
MESSAGE DISABLE,MSK_1_CODES
|
MESSAGE DISABLE,MSK_1_CODES
|
||||||
MESSAGE DISABLE,MSK_1_SIZE
|
MESSAGE DISABLE,MSK_1_SIZE
|
||||||
MESSAGE DISABLE,MSK_1_LINES
|
MESSAGE DISABLE,MSK_1_LINES
|
||||||
MESSAGE DISABLE,DLG_SETPRINT
|
MESSAGE DISABLE,DLG_SETPRINT
|
||||||
ITEM "1|File su disco"
|
ITEM "1|File su disco"
|
||||||
MESSAGE SHOW,MSK_1_FILENAME
|
MESSAGE SHOW,MSK_1_FILENAME
|
||||||
MESSAGE HIDE,MSK_1_PRINTERS
|
MESSAGE HIDE,MSK_1_PRINTERS
|
||||||
MESSAGE ENABLE,MSK_1_CODES
|
MESSAGE ENABLE,MSK_1_CODES
|
||||||
MESSAGE DISABLE,MSK_1_SIZE
|
MESSAGE DISABLE,MSK_1_SIZE
|
||||||
MESSAGE DISABLE,MSK_1_LINES
|
MESSAGE DISABLE,MSK_1_LINES
|
||||||
MESSAGE DISABLE,DLG_SETPRINT
|
MESSAGE DISABLE,DLG_SETPRINT
|
||||||
FLAGS "Z"
|
FLAGS "Z"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST MSK_1_PRINTERS 50
|
LIST MSK_1_PRINTERS 50
|
||||||
BEGIN
|
BEGIN
|
||||||
/* viene riempito a run-time con nomi letti da config */
|
/* viene riempito a run-time con nomi letti da config */
|
||||||
PROMPT 4 5 "Stampante "
|
PROMPT 4 5 "Stampante "
|
||||||
HELP "Selezionare il tipo di stampante desiderata"
|
HELP "Selezionare il tipo di stampante desiderata"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING MSK_1_FILENAME 52
|
STRING MSK_1_FILENAME 52
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 4 5 "Nome file "
|
PROMPT 4 5 "Nome file "
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
VALIDATE FILENAME_FUNC
|
VALIDATE FILENAME_FUNC
|
||||||
FLAGS "A"
|
FLAGS "A"
|
||||||
HELP "Nome del file in cui memorizzare la stampa"
|
HELP "Nome del file in cui memorizzare la stampa"
|
||||||
WARNING "E' necessario specificare un nome di file"
|
WARNING "E' necessario specificare un nome di file"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST MSK_1_CODES 40
|
LIST MSK_1_CODES 40
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 4 6 "Tipo stampa "
|
PROMPT 4 6 "Tipo stampa "
|
||||||
HELP "Modalita' nelle quale si desidera la stampa"
|
HELP "Modalita' nelle quale si desidera la stampa"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST MSK_1_SIZE 3
|
LIST MSK_1_SIZE 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 31 6 "Carattere "
|
PROMPT 31 6 "Carattere "
|
||||||
ITEM "7|7"
|
ITEM "7|7"
|
||||||
ITEM "8|8"
|
ITEM "8|8"
|
||||||
ITEM "10|10"
|
ITEM "10|10"
|
||||||
ITEM "12|12"
|
ITEM "12|12"
|
||||||
ITEM "15|15"
|
ITEM "15|15"
|
||||||
ITEM "17|17"
|
ITEM "17|17"
|
||||||
HELP "Dimensioni del carattere di stampa"
|
HELP "Dimensioni del carattere di stampa"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST MSK_1_LINES 3
|
LIST MSK_1_LINES 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 52 6 "Linee/Inch "
|
PROMPT 52 6 "Linee/Inch "
|
||||||
ITEM "4|4"
|
ITEM "4|4"
|
||||||
ITEM "5|5"
|
ITEM "5|5"
|
||||||
ITEM "6|6"
|
ITEM "6|6"
|
||||||
ITEM "7|7"
|
ITEM "7|7"
|
||||||
ITEM "8|8"
|
ITEM "8|8"
|
||||||
ITEM "9|9"
|
ITEM "9|9"
|
||||||
ITEM "10|10"
|
ITEM "10|10"
|
||||||
HELP "Numero di linee per pollice"
|
HELP "Numero di linee per pollice"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST MSK_1_FONT 10
|
LIST MSK_1_FONT 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 4 6 "Font "
|
PROMPT 4 6 "Font "
|
||||||
HELP "Font di stampa su video o stampante"
|
HELP "Font di stampa su video o stampante"
|
||||||
ITEM "1|Courier"
|
ITEM "1|Courier"
|
||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER MSK_1_NPAGES 3 0
|
NUMBER MSK_1_NPAGES 3 0
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 54 8 "N.o copie "
|
PROMPT 54 8 "N.o copie "
|
||||||
HELP "Numero di copie da fare"
|
HELP "Numero di copie da fare"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN MSK_1_ISGRAPHICS
|
BOOLEAN MSK_1_ISGRAPHICS
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 4 8 "Stampa elementi grafici"
|
PROMPT 4 8 "Stampa elementi grafici"
|
||||||
HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
|
HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 74 4
|
GROUPBOX DLG_NULL 74 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 ""
|
PROMPT 1 9 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_SETPRINT 9 2
|
BUTTON DLG_SETPRINT 9 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -14 -2 "~Imposta"
|
PROMPT -14 -2 "~Imposta"
|
||||||
HELP "Chiama l'Impostazione Stampante di Windows"
|
HELP "Chiama l'Impostazione Stampante di Windows"
|
||||||
MESSAGE EXIT,DLG_SETPRINT
|
MESSAGE EXIT,DLG_SETPRINT
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_SAVEREC 9 2
|
BUTTON DLG_SAVEREC 9 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -24 -2 "~Registra"
|
PROMPT -24 -2 "~Registra"
|
||||||
MESSAGE EXIT,K_INS
|
MESSAGE EXIT,K_INS
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_OK 9 2
|
BUTTON DLG_OK 9 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -34 -2 ""
|
PROMPT -34 -2 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 9 2
|
BUTTON DLG_CANCEL 9 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -44 -2 ""
|
PROMPT -44 -2 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -1,92 +1,92 @@
|
|||||||
#ifndef __DEFMASK_H
|
#ifndef __DEFMASK_H
|
||||||
#define __DEFMASK_H
|
#define __DEFMASK_H
|
||||||
|
|
||||||
/* @M
|
/* @M
|
||||||
Identificativi predefiniti dei controlli di XVT
|
Identificativi predefiniti dei controlli di XVT
|
||||||
*/
|
*/
|
||||||
#define DLG_NULL -1
|
#define DLG_NULL -1
|
||||||
#define DLG_OK 1 /* TAG del bottone <Conferma> */
|
#define DLG_OK 1 /* TAG del bottone <Conferma> */
|
||||||
#define DLG_CANCEL 2 /* TAG del bottone <Annulla> */
|
#define DLG_CANCEL 2 /* TAG del bottone <Annulla> */
|
||||||
#define DLG_PGDN 5 /* TAG del bottone <PgDn> */
|
#define DLG_PGDN 5 /* TAG del bottone <PgDn> */
|
||||||
#define DLG_PGUP 6 /* TAG del bottone <PgUp> */
|
#define DLG_PGUP 6 /* TAG del bottone <PgUp> */
|
||||||
#define DLG_PAGE 7 /* TAG del bottone <PgUp/PgDn> */
|
#define DLG_PAGE 7 /* TAG del bottone <PgUp/PgDn> */
|
||||||
#define DLG_PAGETAGS 8 /* TAG del bottone <Pg n> */
|
#define DLG_PAGETAGS 8 /* TAG del bottone <Pg n> */
|
||||||
#define DLG_QUIT 9 /* TAG del bottone <Uscita> */
|
#define DLG_QUIT 9 /* TAG del bottone <Uscita> */
|
||||||
#define DLG_F9 10 /* TAG del bottone <Ricerca> */
|
#define DLG_F9 10 /* TAG del bottone <Ricerca> */
|
||||||
#define DLG_FIRSTREC 11 /* TAG del bottone <Primo> */
|
#define DLG_FIRSTREC 11 /* TAG del bottone <Primo> */
|
||||||
#define DLG_PREVREC 12 /* TAG del bottone <Precedente> */
|
#define DLG_PREVREC 12 /* TAG del bottone <Precedente> */
|
||||||
#define DLG_STOPREC 13 /* TAG del bottone <Stop> */
|
#define DLG_STOPREC 13 /* TAG del bottone <Stop> */
|
||||||
#define DLG_NEXTREC 14 /* TAG del bottone <Successivo> */
|
#define DLG_NEXTREC 14 /* TAG del bottone <Successivo> */
|
||||||
#define DLG_LASTREC 15 /* TAG del bottone <Ultimo> */
|
#define DLG_LASTREC 15 /* TAG del bottone <Ultimo> */
|
||||||
#define DLG_NEWREC 16 /* TAG del bottone <Nuovo> */
|
#define DLG_NEWREC 16 /* TAG del bottone <Nuovo> */
|
||||||
#define DLG_DELREC 17 /* TAG del bottone <Cancella> */
|
#define DLG_DELREC 17 /* TAG del bottone <Cancella> */
|
||||||
#define DLG_SAVEREC 18 /* TAG del bottone <Registra> */
|
#define DLG_SAVEREC 18 /* TAG del bottone <Registra> */
|
||||||
#define DLG_FINDREC 19 /* TAG del bottone <Ricerca> */
|
#define DLG_FINDREC 19 /* TAG del bottone <Ricerca> */
|
||||||
#define DLG_BAR 20 /* TAG del bottone <Barra> == <Annulla> */
|
#define DLG_BAR 20 /* TAG del bottone <Barra> == <Annulla> */
|
||||||
#define DLG_SELECT 21 /* TAG del bottone <Selezione> */
|
#define DLG_SELECT 21 /* TAG del bottone <Selezione> */
|
||||||
#define DLG_EDIT 22 /* TAG del bottone Edit */
|
#define DLG_EDIT 22 /* TAG del bottone Edit */
|
||||||
#define DLG_LINK 23 /* TAG del bottone Collega (applicazione) */
|
#define DLG_LINK 23 /* TAG del bottone Collega (applicazione) */
|
||||||
#define DLG_PRINT 24 /* TAG del bottone Stampa */
|
#define DLG_PRINT 24 /* TAG del bottone Stampa */
|
||||||
#define DLG_SETPRINT 25 /* TAG del bottone Imposta Stampa */
|
#define DLG_SETPRINT 25 /* TAG del bottone Imposta Stampa */
|
||||||
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
|
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
|
||||||
|
|
||||||
/* @M
|
/* @M
|
||||||
Funzioni di libreria per i validate delle maschere
|
Funzioni di libreria per i validate delle maschere
|
||||||
Nome descrizione Parametri
|
Nome descrizione Parametri
|
||||||
NUM_EXPR espressione numerica espressione
|
NUM_EXPR espressione numerica espressione
|
||||||
STR_EXPR espressione stringa espressione
|
STR_EXPR espressione stringa espressione
|
||||||
NOT_EMPTY_FUNC campo non vuoto
|
NOT_EMPTY_FUNC campo non vuoto
|
||||||
FIXLEN_FUNC lunghezza fissa lunghezza
|
FIXLEN_FUNC lunghezza fissa lunghezza
|
||||||
EMPTYCOPY_FUNC data id del campo da cui copiarsi se vuoto
|
EMPTYCOPY_FUNC data id del campo da cui copiarsi se vuoto
|
||||||
DATE_CMP_FUNC compara due date operatore,id.campo con l'altra
|
DATE_CMP_FUNC compara due date operatore,id.campo con l'altra
|
||||||
data
|
data
|
||||||
PI_FUNC controllo part.IVA ????
|
PI_FUNC controllo part.IVA ????
|
||||||
XTPI_FUNC controllo esteso
|
XTPI_FUNC controllo esteso
|
||||||
part.IVA ????
|
part.IVA ????
|
||||||
XTZPI_FUNC controllo esteso
|
XTZPI_FUNC controllo esteso
|
||||||
part.IVA anche vuota ????
|
part.IVA anche vuota ????
|
||||||
CF_FUNC controllo cod.fisc. ????
|
CF_FUNC controllo cod.fisc. ????
|
||||||
XTCF_FUNC controllo esteso
|
XTCF_FUNC controllo esteso
|
||||||
cod.fisc. ????
|
cod.fisc. ????
|
||||||
XTZCF_FUNC controllo esteso
|
XTZCF_FUNC controllo esteso
|
||||||
cod.fisc.anche vuoto ????
|
cod.fisc.anche vuoto ????
|
||||||
MTCHECK_FUNC mese corretto per
|
MTCHECK_FUNC mese corretto per
|
||||||
ditta mensile o
|
ditta mensile o
|
||||||
trimestrale
|
trimestrale
|
||||||
REQIF_FUNC richiesto se immesso un campo della lista
|
REQIF_FUNC richiesto se immesso un campo della lista
|
||||||
n.ro di campi lista di campi...
|
n.ro di campi lista di campi...
|
||||||
ONEREQ_FUNC almeno uno non vuoto
|
ONEREQ_FUNC almeno uno non vuoto
|
||||||
n.ro campi lista di campi
|
n.ro campi lista di campi
|
||||||
CHECK_FIELD esegue il check su di un altro campo
|
CHECK_FIELD esegue il check su di un altro campo
|
||||||
campo
|
campo
|
||||||
FILENAME_FUNC controlla se la stringa e' un nome di file
|
FILENAME_FUNC controlla se la stringa e' un nome di file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define EXPR_FUNC 0 2
|
#define EXPR_FUNC 0 2
|
||||||
#define EMPTYCOPY_FUNC 1 1
|
#define EMPTYCOPY_FUNC 1 1
|
||||||
#define PI_FUNC 2 1
|
#define PI_FUNC 2 1
|
||||||
#define CF_FUNC 3 1
|
#define CF_FUNC 3 1
|
||||||
#define NOT_EMPTY_FUNC 4 0
|
#define NOT_EMPTY_FUNC 4 0
|
||||||
#define DATE_CMP_FUNC 5 2
|
#define DATE_CMP_FUNC 5 2
|
||||||
#define XTPI_FUNC 6 3
|
#define XTPI_FUNC 6 3
|
||||||
#define XTCF_FUNC 7 4
|
#define XTCF_FUNC 7 4
|
||||||
#define XTZPI_FUNC 8 3
|
#define XTZPI_FUNC 8 3
|
||||||
#define XTZCF_FUNC 9 4
|
#define XTZCF_FUNC 9 4
|
||||||
#define FIXLEN_FUNC 10 1
|
#define FIXLEN_FUNC 10 1
|
||||||
#define MTCHECK_FUNC 11 0
|
#define MTCHECK_FUNC 11 0
|
||||||
#define REQIF_FUNC 12
|
#define REQIF_FUNC 12
|
||||||
#define AUTOEXIT_FUNC 13
|
#define AUTOEXIT_FUNC 13
|
||||||
#define NUMCALC_FUNC 14
|
#define NUMCALC_FUNC 14
|
||||||
#define STRCALC_FUNC 15
|
#define STRCALC_FUNC 15
|
||||||
#define ONEREQ_FUNC 16
|
#define ONEREQ_FUNC 16
|
||||||
#define CHECK_FIELD 17 1
|
#define CHECK_FIELD 17 1
|
||||||
#define FILENAME_FUNC 18
|
#define FILENAME_FUNC 18
|
||||||
|
|
||||||
#define VALEXPR VALIDATE EXPR_FUNC
|
#define VALEXPR VALIDATE EXPR_FUNC
|
||||||
#define NUM_EXPR VALEXPR 0
|
#define NUM_EXPR VALEXPR 0
|
||||||
#define STR_EXPR VALEXPR 1
|
#define STR_EXPR VALEXPR 1
|
||||||
#define NUM_CALC VALIDATE NUMCALC_FUNC 1
|
#define NUM_CALC VALIDATE NUMCALC_FUNC 1
|
||||||
#define STR_CALC VALIDATE STRCALC_FUNC 1
|
#define STR_CALC VALIDATE STRCALC_FUNC 1
|
||||||
#define THIS_FIELD 0
|
#define THIS_FIELD 0
|
||||||
/* @END */
|
/* @END */
|
||||||
#endif // __DEFMASK_H
|
#endif // __DEFMASK_H
|
||||||
|
388
include/mask.h
388
include/mask.h
@ -1,194 +1,194 @@
|
|||||||
#ifndef __MASK_H
|
#ifndef __MASK_H
|
||||||
#define __MASK_H
|
#define __MASK_H
|
||||||
|
|
||||||
#ifndef __WINDOW_H
|
#ifndef __WINDOW_H
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __MASKFLD_H
|
#ifndef __MASKFLD_H
|
||||||
#include <maskfld.h>
|
#include <maskfld.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __REAL_H
|
#ifndef __REAL_H
|
||||||
#include <real.h>
|
#include <real.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// @T
|
// @T
|
||||||
typedef bool (*MASK_HANDLER)(TMask& mask, KEY key);
|
typedef bool (*MASK_HANDLER)(TMask& mask, KEY key);
|
||||||
enum TMaskmode { NO_MODE, MODE_INS , MODE_MOD ,
|
enum TMaskmode { NO_MODE, MODE_INS , MODE_MOD ,
|
||||||
MODE_VIS , MODE_QUERY, MODE_QUERYINS };
|
MODE_VIS , MODE_QUERY, MODE_QUERYINS };
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
// Classe TMask : public TWindow
|
// Classe TMask : public TWindow
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
class TMask : public TWindow
|
class TMask : public TWindow
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @DPRIV
|
||||||
enum { MAX_PAGES = 12 }; // Massimo numero di pagine nella maschera
|
enum { MAX_PAGES = 12 }; // Massimo numero di pagine nella maschera
|
||||||
WINDOW _pagewin[MAX_PAGES+1]; // Windows of the pages
|
WINDOW _pagewin[MAX_PAGES+1]; // Windows of the pages
|
||||||
WINDOW _pagepag[MAX_PAGES]; // Windows of pgup/pgdn
|
WINDOW _pagepag[MAX_PAGES]; // Windows of pgup/pgdn
|
||||||
WINDOW _pagetag[MAX_PAGES]; // Windows of pagetags
|
WINDOW _pagetag[MAX_PAGES]; // Windows of pagetags
|
||||||
|
|
||||||
int _pages; // Number of pages of the mask
|
int _pages; // Number of pages of the mask
|
||||||
int _page; // Current page
|
int _page; // Current page
|
||||||
|
|
||||||
TBit_array _enabled; // Are pages enabled
|
TBit_array _enabled; // Are pages enabled
|
||||||
int _mode; // Mode of the mask
|
int _mode; // Mode of the mask
|
||||||
TArray _field; // Fields in the mask
|
TArray _field; // Fields in the mask
|
||||||
|
|
||||||
int _first_focus; // First control to have focus
|
int _first_focus; // First control to have focus
|
||||||
int _focus; // Control with focus
|
int _focus; // Control with focus
|
||||||
int _sheets; // Number of sheets
|
int _sheets; // Number of sheets
|
||||||
|
|
||||||
MASK_HANDLER _handler; // User defined key handler
|
MASK_HANDLER _handler; // User defined key handler
|
||||||
|
|
||||||
TFilename _source_file; // Source file of the mask
|
TFilename _source_file; // Source file of the mask
|
||||||
TFilename _workfile; // Name of savefile
|
TFilename _workfile; // Name of savefile
|
||||||
long _lastpos; // last read offset on savefile
|
long _lastpos; // last read offset on savefile
|
||||||
|
|
||||||
real _exchange; // Current value exhange
|
real _exchange; // Current value exhange
|
||||||
bool _sheetmask; // Mask owned by a sheet
|
bool _sheetmask; // Mask owned by a sheet
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Ritorna la finestra della pagina corrente (Usare con attenzione)
|
// Ritorna la finestra della pagina corrente (Usare con attenzione)
|
||||||
WINDOW win() const { return _page == -1 ? NULL_WIN : _pagewin[_page]; }
|
WINDOW win() const { return _page == -1 ? NULL_WIN : _pagewin[_page]; }
|
||||||
WINDOW toolwin() const { return _pagewin[MAX_PAGES]; }
|
WINDOW toolwin() const { return _pagewin[MAX_PAGES]; }
|
||||||
|
|
||||||
int find_field_win(WINDOW win) const; // number of field with window win
|
int find_field_win(WINDOW win) const; // number of field with window win
|
||||||
|
|
||||||
void set_mask_fields() const; // update screen
|
void set_mask_fields() const; // update screen
|
||||||
|
|
||||||
void load_checks() const; // load checks related fields
|
void load_checks() const; // load checks related fields
|
||||||
virtual void start_run(); // called when the mask starts to run
|
virtual void start_run(); // called when the mask starts to run
|
||||||
virtual TMask_field* parse_field(TScanner& scanner);
|
virtual TMask_field* parse_field(TScanner& scanner);
|
||||||
|
|
||||||
void init_mask();
|
void init_mask();
|
||||||
WINDOW read_page(TScanner& scanner, bool toolbar = FALSE);
|
WINDOW read_page(TScanner& scanner, bool toolbar = FALSE);
|
||||||
void read_mask(const char* name, int num, int max);
|
void read_mask(const char* name, int num, int max);
|
||||||
void add_buttons();
|
void add_buttons();
|
||||||
|
|
||||||
int find_parent_page(const TMask_field&) const;
|
int find_parent_page(const TMask_field&) const;
|
||||||
int find_first_field(WINDOW w, int dir) const;
|
int find_first_field(WINDOW w, int dir) const;
|
||||||
int find_active_field(int first, int dir) const;
|
int find_active_field(int first, int dir) const;
|
||||||
bool check_current_page(); // Check all the fields on the current page
|
bool check_current_page(); // Check all the fields on the current page
|
||||||
void next_page(int p); // Show next/previous page
|
void next_page(int p); // Show next/previous page
|
||||||
int curr_page() const { return _page; } // Current page number
|
int curr_page() const { return _page; } // Current page number
|
||||||
|
|
||||||
bool test_focus_change(WINDOW w = NULL_WIN);
|
bool test_focus_change(WINDOW w = NULL_WIN);
|
||||||
void control_handler(EVENT* ep);
|
void control_handler(EVENT* ep);
|
||||||
void handler(WINDOW win, EVENT* ep);
|
void handler(WINDOW win, EVENT* ep);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
// crea leggendo descrizione da file .msk
|
// crea leggendo descrizione da file .msk
|
||||||
TMask(const char* name, int num = 0, int max = MAX_PAGES);
|
TMask(const char* name, int num = 0, int max = MAX_PAGES);
|
||||||
|
|
||||||
// crea mask vuota con parametri dati
|
// crea mask vuota con parametri dati
|
||||||
TMask(const char* title, int pages, int cols, int rows, int xpos = -1,
|
TMask(const char* title, int pages, int cols, int rows, int xpos = -1,
|
||||||
int ypos = -1);
|
int ypos = -1);
|
||||||
|
|
||||||
virtual ~TMask();
|
virtual ~TMask();
|
||||||
|
|
||||||
const TFilename& source_file() const { return _source_file; }
|
const TFilename& source_file() const { return _source_file; }
|
||||||
|
|
||||||
// aggiunta campi a runtime
|
// aggiunta campi a runtime
|
||||||
void add_static (short id, int page, const char* prompt, int x, int y,
|
void add_static (short id, int page, const char* prompt, int x, int y,
|
||||||
const char* flags = "");
|
const char* flags = "");
|
||||||
void add_string (short id, int page, const char* prompt, int x, int y,
|
void add_string (short id, int page, const char* prompt, int x, int y,
|
||||||
int dim, const char* flags = "", int width = 0);
|
int dim, const char* flags = "", int width = 0);
|
||||||
void add_number (short id, int page, const char* prompt, int x, int y,
|
void add_number (short id, int page, const char* prompt, int x, int y,
|
||||||
int dim, const char* flags = "", int ndec = 0);
|
int dim, const char* flags = "", int ndec = 0);
|
||||||
void add_date (short id, int page, const char* prompt, int x, int y,
|
void add_date (short id, int page, const char* prompt, int x, int y,
|
||||||
const char* flags = "");
|
const char* flags = "");
|
||||||
void add_button (short id, int page, const char* prompt, int x, int y,
|
void add_button (short id, int page, const char* prompt, int x, int y,
|
||||||
int dx = 9, int dy = 1, const char* flags = "");
|
int dx = 9, int dy = 1, const char* flags = "");
|
||||||
|
|
||||||
void add_radio(short id, int page, const char* prompt, int x, int y,
|
void add_radio(short id, int page, const char* prompt, int x, int y,
|
||||||
int dx, const char* codes, const char* items, const char* flags = "");
|
int dx, const char* codes, const char* items, const char* flags = "");
|
||||||
|
|
||||||
int fields() const { return _field.items(); }
|
int fields() const { return _field.items(); }
|
||||||
int sheets() const { return _sheets; }
|
int sheets() const { return _sheets; }
|
||||||
|
|
||||||
void set_mode(int m) { _mode = m; }
|
void set_mode(int m) { _mode = m; }
|
||||||
int mode() const { return _mode; }
|
int mode() const { return _mode; }
|
||||||
|
|
||||||
void set_exchange(bool show_value, const real& nuo);
|
void set_exchange(bool show_value, const real& nuo);
|
||||||
const real& exchange() const { return _exchange; }
|
const real& exchange() const { return _exchange; }
|
||||||
|
|
||||||
bool check_fields();
|
bool check_fields();
|
||||||
void get_mask_fields(); // read screen contents
|
void get_mask_fields(); // read screen contents
|
||||||
virtual bool stop_run(KEY key); // called to close the mask
|
virtual bool stop_run(KEY key); // called to close the mask
|
||||||
virtual bool can_be_closed() const;
|
virtual bool can_be_closed() const;
|
||||||
|
|
||||||
virtual void open();
|
virtual void open();
|
||||||
virtual void close();
|
virtual void close();
|
||||||
virtual void enable(bool on) const;
|
virtual void enable(bool on) const;
|
||||||
|
|
||||||
int id2pos(short id) const;
|
int id2pos(short id) const;
|
||||||
TMask_field& fld(int i) const { return (TMask_field&)_field[i]; } // Ritorna il campo i-esimo della maschera
|
TMask_field& fld(int i) const { return (TMask_field&)_field[i]; } // Ritorna il campo i-esimo della maschera
|
||||||
TMask_field& field(short id) const; // field with given id
|
TMask_field& field(short id) const; // field with given id
|
||||||
TEdit_field& efield(short id) const; // edit-field with given id
|
TEdit_field& efield(short id) const; // edit-field with given id
|
||||||
|
|
||||||
void set(short fld_id, const char* str, bool hit=FALSE);
|
void set(short fld_id, const char* str, bool hit=FALSE);
|
||||||
void set(short fld_id, long num, bool hit=FALSE);
|
void set(short fld_id, long num, bool hit=FALSE);
|
||||||
const TString& get(short fld_id) const;
|
const TString& get(short fld_id) const;
|
||||||
long get_long(short fld_id) const;
|
long get_long(short fld_id) const;
|
||||||
int get_int(short fld_id) const { return (int)get_long(fld_id); }
|
int get_int(short fld_id) const { return (int)get_long(fld_id); }
|
||||||
bool get_bool(short fld_id) const;
|
bool get_bool(short fld_id) const;
|
||||||
|
|
||||||
int first_focus(short id);
|
int first_focus(short id);
|
||||||
void set_focus();
|
void set_focus();
|
||||||
void move_focus_field(int num);
|
void move_focus_field(int num);
|
||||||
void set_focus_win(WINDOW win, bool force);
|
void set_focus_win(WINDOW win, bool force);
|
||||||
int focus_field() const { return _focus;}
|
int focus_field() const { return _focus;}
|
||||||
|
|
||||||
virtual bool on_key(KEY key);
|
virtual bool on_key(KEY key);
|
||||||
void on_firm_change();
|
void on_firm_change();
|
||||||
|
|
||||||
void enable(short fld_id, bool on = TRUE); // Abilita un campo
|
void enable(short fld_id, bool on = TRUE); // Abilita un campo
|
||||||
void disable(short fld_id) { enable(fld_id, FALSE); }
|
void disable(short fld_id) { enable(fld_id, FALSE); }
|
||||||
void enable_default(short fld_id = -1);
|
void enable_default(short fld_id = -1);
|
||||||
|
|
||||||
void enable_page(byte p, bool on = TRUE);
|
void enable_page(byte p, bool on = TRUE);
|
||||||
void disable_page(byte p) { enable_page(p, FALSE); }
|
void disable_page(byte p) { enable_page(p, FALSE); }
|
||||||
bool page_enabled(byte p) const;
|
bool page_enabled(byte p) const;
|
||||||
|
|
||||||
byte num_keys() const;
|
byte num_keys() const;
|
||||||
void enable_key(byte key, bool on = TRUE);
|
void enable_key(byte key, bool on = TRUE);
|
||||||
void disable_key(byte key) { enable_key(key, FALSE); }
|
void disable_key(byte key) { enable_key(key, FALSE); }
|
||||||
short get_key_field(byte key, bool first) const;
|
short get_key_field(byte key, bool first) const;
|
||||||
bool key_valid(int key) const;
|
bool key_valid(int key) const;
|
||||||
|
|
||||||
void show(short fld_id = -1, bool on = TRUE);
|
void show(short fld_id = -1, bool on = TRUE);
|
||||||
void hide(short fld_id = -1) { show(fld_id, FALSE); }
|
void hide(short fld_id = -1) { show(fld_id, FALSE); }
|
||||||
void show_default(short fld_id = -1);
|
void show_default(short fld_id = -1);
|
||||||
|
|
||||||
void reset(short fld_id = -1);
|
void reset(short fld_id = -1);
|
||||||
void undo(short fld_id = -1);
|
void undo(short fld_id = -1);
|
||||||
|
|
||||||
void autoload(const TRelation* = NULL);
|
void autoload(const TRelation* = NULL);
|
||||||
void autosave(TRelation* = NULL) const;
|
void autosave(TRelation* = NULL) const;
|
||||||
|
|
||||||
void send_key(KEY key, short id, TMask_field* from = NULL);
|
void send_key(KEY key, short id, TMask_field* from = NULL);
|
||||||
void set_handler(short fld_id, CONTROL_HANDLER handler);
|
void set_handler(short fld_id, CONTROL_HANDLER handler);
|
||||||
void set_handler(MASK_HANDLER handler);
|
void set_handler(MASK_HANDLER handler);
|
||||||
void set_workfile(const char* workfile) { _workfile = workfile; _lastpos = 0L;}
|
void set_workfile(const char* workfile) { _workfile = workfile; _lastpos = 0L;}
|
||||||
bool save(bool append = FALSE) const;
|
bool save(bool append = FALSE) const;
|
||||||
bool load(bool reset = FALSE);
|
bool load(bool reset = FALSE);
|
||||||
|
|
||||||
short dirty() const; // Ritorna il primo campo dirty
|
short dirty() const; // Ritorna il primo campo dirty
|
||||||
bool is_sheetmask() const { return _sheetmask; }
|
bool is_sheetmask() const { return _sheetmask; }
|
||||||
|
|
||||||
bool no_mode() const { return _mode == NO_MODE; }
|
bool no_mode() const { return _mode == NO_MODE; }
|
||||||
bool query_mode() const { return _mode == MODE_QUERY || _mode == MODE_QUERYINS; }
|
bool query_mode() const { return _mode == MODE_QUERY || _mode == MODE_QUERYINS; }
|
||||||
bool edit_mode() const { return _mode == MODE_MOD; }
|
bool edit_mode() const { return _mode == MODE_MOD; }
|
||||||
bool insert_mode() const { return _mode == MODE_QUERYINS || _mode == MODE_INS; }
|
bool insert_mode() const { return _mode == MODE_QUERYINS || _mode == MODE_INS; }
|
||||||
|
|
||||||
virtual const char* get_caption() const;
|
virtual const char* get_caption() const;
|
||||||
virtual void set_caption(const char* c);
|
virtual void set_caption(const char* c);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __MASK_H
|
#endif // __MASK_H
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: maskfld.cpp,v 1.57 1994-12-02 13:30:09 guy Exp $
|
// $Id: maskfld.cpp,v 1.58 1994-12-05 14:23:15 guy Exp $
|
||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
@ -1901,26 +1901,30 @@ const char* TEdit_field::format(const char* d)
|
|||||||
fpark.trim();
|
fpark.trim();
|
||||||
|
|
||||||
if (fpark.not_empty())
|
if (fpark.not_empty())
|
||||||
{
|
{
|
||||||
if (fpark.len() > _size)
|
int len = fpark.len();
|
||||||
|
if (len > _size)
|
||||||
{
|
{
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
yesnofatal_box("Campo %d troppo lungo: %d > %d", dlg(), fpark.len(), _size);
|
yesnofatal_box("Campo %d troppo lungo: %d > %d", dlg(), fpark.len(), _size);
|
||||||
#endif
|
#endif
|
||||||
fpark.cut(_size);
|
fpark.cut(len = _size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (len < _size)
|
||||||
|
{
|
||||||
|
if (_flags.zerofilled)
|
||||||
|
{
|
||||||
|
if (isdigit(fpark[0]) && real::is_real(fpark))
|
||||||
|
fpark.right_just(_size, '0');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (_flags.rightjust)
|
||||||
|
fpark.right_just(_size);
|
||||||
|
}
|
||||||
|
|
||||||
if (_flags.uppercase)
|
if (_flags.uppercase)
|
||||||
fpark.upper();
|
fpark.upper();
|
||||||
|
|
||||||
if (_flags.zerofilled)
|
|
||||||
{
|
|
||||||
if (isdigit(fpark[0]) && real::is_real(fpark))
|
|
||||||
fpark.right_just(_size, '0');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (_flags.rightjust)
|
|
||||||
fpark.right_just(_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fpark;
|
return fpark;
|
||||||
|
@ -1081,7 +1081,7 @@ TSheet_field::~TSheet_field()
|
|||||||
void TSheet_field::reset()
|
void TSheet_field::reset()
|
||||||
{
|
{
|
||||||
_sheet->destroy();
|
_sheet->destroy();
|
||||||
_sheet->mask().reset();
|
_sheet->sheet_mask().reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
|
318
include/real.h
318
include/real.h
@ -1,159 +1,159 @@
|
|||||||
#ifndef __REAL_H
|
#ifndef __REAL_H
|
||||||
#define __REAL_H
|
#define __REAL_H
|
||||||
|
|
||||||
#ifndef GMDOTH
|
#ifndef GMDOTH
|
||||||
#include <gmsys1.h>
|
#include <gmsys1.h>
|
||||||
#include <gfd.h>
|
#include <gfd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __IOSTREAM_H
|
#ifndef __IOSTREAM_H
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __STDTYPES_H
|
#ifndef __STDTYPES_H
|
||||||
#include <stdtypes.h>
|
#include <stdtypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __ARRAY_H
|
#ifndef __ARRAY_H
|
||||||
#include <array.h>
|
#include <array.h>
|
||||||
#endif
|
#endif
|
||||||
// @C
|
// @C
|
||||||
class real : public TObject
|
class real : public TObject
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @DPRIV
|
||||||
DEC _dec;
|
DEC _dec;
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual TObject* dup() const;
|
virtual TObject* dup() const;
|
||||||
char* literals() const;
|
char* literals() const;
|
||||||
char* points(int decimals = 0) const;
|
char* points(int decimals = 0) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static char* eng2ita(char* s);
|
static char* eng2ita(char* s);
|
||||||
static char* ita2eng(const char* s);
|
static char* ita2eng(const char* s);
|
||||||
static bool is_real(const char* n);
|
static bool is_real(const char* n);
|
||||||
|
|
||||||
// @FPUB
|
// @FPUB
|
||||||
DEC* ptr() const { return (DEC*)&_dec; }
|
DEC* ptr() const { return (DEC*)&_dec; }
|
||||||
char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||||
char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||||
char* string(const char* picture) const;
|
char* string(const char* picture) const;
|
||||||
|
|
||||||
int precision() ;
|
int precision() ;
|
||||||
bool is_zero() const;
|
bool is_zero() const;
|
||||||
int sign() const;
|
int sign() const;
|
||||||
long integer() const; // operator int is too dangerous
|
long integer() const; // operator int is too dangerous
|
||||||
|
|
||||||
real& round(int prec = 0) ;
|
real& round(int prec = 0) ;
|
||||||
real& trunc(int prec = 0) ;
|
real& trunc(int prec = 0) ;
|
||||||
real& ceil(int prec = 0);
|
real& ceil(int prec = 0);
|
||||||
real& operator =(double a);
|
real& operator =(double a);
|
||||||
real& operator =(const real& b);
|
real& operator =(const real& b);
|
||||||
real& operator +=(const real& b);
|
real& operator +=(const real& b);
|
||||||
real& operator +=(double a);
|
real& operator +=(double a);
|
||||||
real& operator -=(const real& b);
|
real& operator -=(const real& b);
|
||||||
real& operator *=(const real& b);
|
real& operator *=(const real& b);
|
||||||
real& operator /=(const real& b);
|
real& operator /=(const real& b);
|
||||||
bool operator !() const { return is_zero(); }
|
bool operator !() const { return is_zero(); }
|
||||||
real operator -() const;
|
real operator -() const;
|
||||||
|
|
||||||
real();
|
real();
|
||||||
real(const real& b);
|
real(const real& b);
|
||||||
real(double a);
|
real(double a);
|
||||||
real(const char* s);
|
real(const char* s);
|
||||||
virtual ~real() {}
|
virtual ~real() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Math operators
|
// Math operators
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ostream& operator <<(ostream& out, const real& a) ;
|
ostream& operator <<(ostream& out, const real& a) ;
|
||||||
istream& operator >>(istream& in, real& a) ;
|
istream& operator >>(istream& in, real& a) ;
|
||||||
|
|
||||||
real operator +(const real& a, const real& b) ;
|
real operator +(const real& a, const real& b) ;
|
||||||
real operator +(double a, const real& b) ;
|
real operator +(double a, const real& b) ;
|
||||||
real operator +(const real& a, double b) ;
|
real operator +(const real& a, double b) ;
|
||||||
real operator -(const real& a, const real& b) ;
|
real operator -(const real& a, const real& b) ;
|
||||||
real operator -(double a, const real& b) ;
|
real operator -(double a, const real& b) ;
|
||||||
real operator -(const real& a, double b) ;
|
real operator -(const real& a, double b) ;
|
||||||
real operator *(const real& a, const real& b) ;
|
real operator *(const real& a, const real& b) ;
|
||||||
real operator *(double a, const real& b) ;
|
real operator *(double a, const real& b) ;
|
||||||
real operator *(const real& a, double b) ;
|
real operator *(const real& a, double b) ;
|
||||||
real operator /(const real& a, const real& b) ;
|
real operator /(const real& a, const real& b) ;
|
||||||
real operator /(double a, const real& b) ;
|
real operator /(double a, const real& b) ;
|
||||||
real operator /(const real& a, double b) ;
|
real operator /(const real& a, double b) ;
|
||||||
|
|
||||||
bool operator <(const real& a, const real& b) ;
|
bool operator <(const real& a, const real& b) ;
|
||||||
bool operator <(double a, const real& b) ;
|
bool operator <(double a, const real& b) ;
|
||||||
bool operator >(const real& a, const real& b) ;
|
bool operator >(const real& a, const real& b) ;
|
||||||
bool operator >(double a, const real& b) ;
|
bool operator >(double a, const real& b) ;
|
||||||
bool operator <=(const real& a, const real& b) ;
|
bool operator <=(const real& a, const real& b) ;
|
||||||
bool operator <=(double a, const real& b) ;
|
bool operator <=(double a, const real& b) ;
|
||||||
bool operator >=(const real& a, const real& b) ;
|
bool operator >=(const real& a, const real& b) ;
|
||||||
bool operator >=(double a, const real& b) ;
|
bool operator >=(double a, const real& b) ;
|
||||||
bool operator ==(const real& a, const real& b) ;
|
bool operator ==(const real& a, const real& b) ;
|
||||||
bool operator ==(double a, const real& b) ;
|
bool operator ==(double a, const real& b) ;
|
||||||
bool operator !=(const real& a, const real& b) ;
|
bool operator !=(const real& a, const real& b) ;
|
||||||
bool operator !=(double a, const real& b) ;
|
bool operator !=(double a, const real& b) ;
|
||||||
|
|
||||||
inline bool operator <(const real& a, double b) { return operator >(b, a); }
|
inline bool operator <(const real& a, double b) { return operator >(b, a); }
|
||||||
inline bool operator >(const real& a, double b) { return operator <(b, a); }
|
inline bool operator >(const real& a, double b) { return operator <(b, a); }
|
||||||
inline bool operator <=(const real& a, double b) { return operator >=(b, a); }
|
inline bool operator <=(const real& a, double b) { return operator >=(b, a); }
|
||||||
inline bool operator >=(const real& a, double b) { return operator <=(b, a); }
|
inline bool operator >=(const real& a, double b) { return operator <=(b, a); }
|
||||||
inline bool operator ==(const real& a, double b) { return operator ==(b, a); }
|
inline bool operator ==(const real& a, double b) { return operator ==(b, a); }
|
||||||
inline bool operator !=(const real& a, double b) { return operator !=(b, a); }
|
inline bool operator !=(const real& a, double b) { return operator !=(b, a); }
|
||||||
|
|
||||||
real operator %(const real& a, const long b) ;
|
real operator %(const real& a, const long b) ;
|
||||||
void swap(real& a, real& b) ;
|
void swap(real& a, real& b) ;
|
||||||
real fnc_min(const real& a, const real& b) ;
|
real fnc_min(const real& a, const real& b) ;
|
||||||
real fnc_max(const real& a, const real& b) ;
|
real fnc_max(const real& a, const real& b) ;
|
||||||
real sqrt(const real& a) ;
|
real sqrt(const real& a) ;
|
||||||
real sqr(const real& a) ;
|
real sqr(const real& a) ;
|
||||||
real exp10(const real& a) ;
|
real exp10(const real& a) ;
|
||||||
real pow(const real& a, const real& b) ;
|
real pow(const real& a, const real& b) ;
|
||||||
real exp(const real& a) ;
|
real exp(const real& a) ;
|
||||||
real log10(const real& a) ;
|
real log10(const real& a) ;
|
||||||
real log(const real& a) ;
|
real log(const real& a) ;
|
||||||
real sin(const real& a) ;
|
real sin(const real& a) ;
|
||||||
real cos(const real& a) ;
|
real cos(const real& a) ;
|
||||||
real tan(const real& a) ;
|
real tan(const real& a) ;
|
||||||
real abs(const real& a) ;
|
real abs(const real& a) ;
|
||||||
extern const real ZERO;
|
extern const real ZERO;
|
||||||
|
|
||||||
class TDistrib : public TObject
|
class TDistrib : public TObject
|
||||||
{
|
{
|
||||||
real _tot;
|
real _tot;
|
||||||
real _prog;
|
real _prog;
|
||||||
bool _ready;
|
bool _ready;
|
||||||
TArray _slices;
|
TArray _slices;
|
||||||
int _current;
|
int _current;
|
||||||
int _decs;
|
int _decs;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void add(real slice);
|
void add(real slice);
|
||||||
real get();
|
real get();
|
||||||
|
|
||||||
// se zap e' vero scancella tutte le percentuali immesse
|
// se zap e' vero scancella tutte le percentuali immesse
|
||||||
// altrimenti cambia solo il totale
|
// altrimenti cambia solo il totale
|
||||||
void init(const real& r, bool zap = FALSE);
|
void init(const real& r, bool zap = FALSE);
|
||||||
void operator =(const real& r) { init(r); }
|
void operator =(const real& r) { init(r); }
|
||||||
const real& last_slice() const
|
const real& last_slice() const
|
||||||
{
|
{
|
||||||
CHECK(_current,"TDistrib: slices not set");
|
CHECK(_current,"TDistrib: slices not set");
|
||||||
return (const real&)_slices[_current-1];
|
return (const real&)_slices[_current-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
TDistrib(const real& r, int round = UNDEFINED) :
|
TDistrib(const real& r, int round = UNDEFINED) :
|
||||||
_prog(0.0), _tot(r), _ready(FALSE),
|
_prog(0.0), _tot(r), _ready(FALSE),
|
||||||
_current(0), _decs(round), _slices(4)
|
_current(0), _decs(round), _slices(4)
|
||||||
{}
|
{}
|
||||||
virtual ~TDistrib() {}
|
virtual ~TDistrib() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __REAL_H
|
#endif // __REAL_H
|
||||||
|
228
include/relapp.h
228
include/relapp.h
@ -1,114 +1,114 @@
|
|||||||
#ifndef __RELAPP_H
|
#ifndef __RELAPP_H
|
||||||
#define __RELAPP_H
|
#define __RELAPP_H
|
||||||
|
|
||||||
#ifndef __APPLICAT_H
|
#ifndef __APPLICAT_H
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __RELATION_H
|
#ifndef __RELATION_H
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __MASK_H
|
#ifndef __MASK_H
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class TKey_array;
|
class TKey_array;
|
||||||
|
|
||||||
class TRelation_application : public TApplication
|
class TRelation_application : public TApplication
|
||||||
{
|
{
|
||||||
TMask * _mask;
|
TMask * _mask;
|
||||||
TKey_array* _maskeys;
|
TKey_array* _maskeys;
|
||||||
TRecnotype _first, _last;
|
TRecnotype _first, _last;
|
||||||
int _search_id;
|
int _search_id;
|
||||||
|
|
||||||
TString16 _autoins_caller;
|
TString16 _autoins_caller;
|
||||||
long _recins;
|
long _recins;
|
||||||
|
|
||||||
bool _lnflag;
|
bool _lnflag;
|
||||||
TToken_string _fixed;
|
TToken_string _fixed;
|
||||||
|
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
|
|
||||||
bool filter();
|
bool filter();
|
||||||
bool test_key(byte k, bool err);
|
bool test_key(byte k, bool err);
|
||||||
bool save(bool check_dirty);
|
bool save(bool check_dirty);
|
||||||
void enable_query();
|
void enable_query();
|
||||||
void set_toolbar(bool all);
|
void set_toolbar(bool all);
|
||||||
|
|
||||||
int set_mode(int mode); // Seleziona il nuovo modo e ritorna il vecchio
|
int set_mode(int mode); // Seleziona il nuovo modo e ritorna il vecchio
|
||||||
void set_limits(byte what = 0x3);
|
void set_limits(byte what = 0x3);
|
||||||
void query_insert_mode() { query_mode(TRUE); }
|
void query_insert_mode() { query_mode(TRUE); }
|
||||||
void insert_mode(); // Entra in modo inserimento
|
void insert_mode(); // Entra in modo inserimento
|
||||||
virtual bool main_loop(); // Ciclo principale
|
virtual bool main_loop(); // Ciclo principale
|
||||||
bool relation_remove(); // Cancella il record corrente
|
bool relation_remove(); // Cancella il record corrente
|
||||||
TMask_field* get_search_field() const;
|
TMask_field* get_search_field() const;
|
||||||
|
|
||||||
bool autonum(TMask* m, bool rec);
|
bool autonum(TMask* m, bool rec);
|
||||||
bool has_filtered_cursor() const { return filtered() || force_cursor_usage();}
|
bool has_filtered_cursor() const { return filtered() || force_cursor_usage();}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TLocalisamfile& file() const { return get_relation()->lfile(); } // File principale della relazione
|
TLocalisamfile& file() const { return get_relation()->lfile(); } // File principale della relazione
|
||||||
TRecnotype first() const { return _first;}
|
TRecnotype first() const { return _first;}
|
||||||
TRecnotype last() const { return _first;}
|
TRecnotype last() const { return _first;}
|
||||||
TMask& curr_mask() const { return *_mask; }
|
TMask& curr_mask() const { return *_mask; }
|
||||||
const TString& autoins_caller() const { return _autoins_caller;}
|
const TString& autoins_caller() const { return _autoins_caller;}
|
||||||
virtual bool menu(MENU_TAG m);
|
virtual bool menu(MENU_TAG m);
|
||||||
|
|
||||||
virtual bool user_create() pure; // Inizializzazione dati utente
|
virtual bool user_create() pure; // Inizializzazione dati utente
|
||||||
virtual bool user_destroy() pure; // Distruzione dati utente
|
virtual bool user_destroy() pure; // Distruzione dati utente
|
||||||
|
|
||||||
void set_fixed(); // Fissa i campi non modificabili
|
void set_fixed(); // Fissa i campi non modificabili
|
||||||
bool search_mode(); // Attiva la maschera di ricerca
|
bool search_mode(); // Attiva la maschera di ricerca
|
||||||
void query_mode(bool pre_ins = FALSE); // Entra in modo ricerca
|
void query_mode(bool pre_ins = FALSE); // Entra in modo ricerca
|
||||||
bool modify_mode(); // Entra in modo modifica
|
bool modify_mode(); // Entra in modo modifica
|
||||||
void setkey();
|
void setkey();
|
||||||
bool lnflag() const { return _lnflag;}
|
bool lnflag() const { return _lnflag;}
|
||||||
// La richiesta della maschera da utilizzare per ogni fase di lavoro (ricerca, inserimento,
|
// La richiesta della maschera da utilizzare per ogni fase di lavoro (ricerca, inserimento,
|
||||||
// modifica avviene sempre in due tempi: changing_mask e get_mask. Cio' serve per gestire
|
// modifica avviene sempre in due tempi: changing_mask e get_mask. Cio' serve per gestire
|
||||||
// Correttamente le applicazioni con mashere multiple. La prima funzione serve a sapere se
|
// Correttamente le applicazioni con mashere multiple. La prima funzione serve a sapere se
|
||||||
// la futura get_mask ritornera' una maschera diversa dalla corrente.
|
// la futura get_mask ritornera' una maschera diversa dalla corrente.
|
||||||
virtual bool changing_mask(int mode) pure;
|
virtual bool changing_mask(int mode) pure;
|
||||||
virtual TMask* get_mask(int mode) pure; // Richiede la maschera da usare
|
virtual TMask* get_mask(int mode) pure; // Richiede la maschera da usare
|
||||||
|
|
||||||
virtual TRelation* get_relation() const pure; // Relazione da modificare
|
virtual TRelation* get_relation() const pure; // Relazione da modificare
|
||||||
virtual int read(TMask& m); // Legge dalla relazione i valori nella maschera
|
virtual int read(TMask& m); // Legge dalla relazione i valori nella maschera
|
||||||
virtual int write(const TMask& m); // Scrive sulla relazione i valori dalla maschera
|
virtual int write(const TMask& m); // Scrive sulla relazione i valori dalla maschera
|
||||||
virtual int rewrite(const TMask& m); // Riscrive sulla relazione i valori dalla maschera
|
virtual int rewrite(const TMask& m); // Riscrive sulla relazione i valori dalla maschera
|
||||||
virtual bool remove(); // Cancella il record corrente
|
virtual bool remove(); // Cancella il record corrente
|
||||||
|
|
||||||
// Richiede una stringa nella forma CAMPO1|VALORE1|CAMPO2|VALORE2|...|CAMPOn|VALOREn
|
// Richiede una stringa nella forma CAMPO1|VALORE1|CAMPO2|VALORE2|...|CAMPOn|VALOREn
|
||||||
// contenente le coppie NUMERO_CAMPO_MASCHERA - VALORE_DA_ASSEGNARE che descrivono il
|
// contenente le coppie NUMERO_CAMPO_MASCHERA - VALORE_DA_ASSEGNARE che descrivono il
|
||||||
// prossimo codice libero da utilizzare per la autonumerazione.
|
// prossimo codice libero da utilizzare per la autonumerazione.
|
||||||
// Nel caso di banale numerazione progressiva potrebbe essere implementata come
|
// Nel caso di banale numerazione progressiva potrebbe essere implementata come
|
||||||
// return format("%d|%s", F_NUM, get_relation()->items());
|
// return format("%d|%s", F_NUM, get_relation()->items());
|
||||||
virtual const char* get_next_key() { return ""; }
|
virtual const char* get_next_key() { return ""; }
|
||||||
|
|
||||||
// Richiede se il record corrente e' protetto (non cancellabile)
|
// Richiede se il record corrente e' protetto (non cancellabile)
|
||||||
virtual bool protected_record(TRectype&) { return FALSE; }
|
virtual bool protected_record(TRectype&) { return FALSE; }
|
||||||
|
|
||||||
virtual void init_query_mode(TMask&) { } // Inizializza la maschera per il modo ricerca
|
virtual void init_query_mode(TMask&) { } // Inizializza la maschera per il modo ricerca
|
||||||
virtual void init_query_insert_mode(TMask& m) { init_query_mode(m); }
|
virtual void init_query_insert_mode(TMask& m) { init_query_mode(m); }
|
||||||
virtual void init_insert_mode(TMask&) { } // Inizializza la maschera per il modo inserimento
|
virtual void init_insert_mode(TMask&) { } // Inizializza la maschera per il modo inserimento
|
||||||
virtual void init_modify_mode(TMask&) { } // Inizializza la maschera per il modo modifica
|
virtual void init_modify_mode(TMask&) { } // Inizializza la maschera per il modo modifica
|
||||||
|
|
||||||
virtual bool force_cursor_usage() const { return FALSE;}
|
virtual bool force_cursor_usage() const { return FALSE;}
|
||||||
virtual void write_enable(const bool on = TRUE) { get_relation()->write_enable(-1, on); }
|
virtual void write_enable(const bool on = TRUE) { get_relation()->write_enable(-1, on); }
|
||||||
void write_disable() { write_enable(FALSE); }
|
void write_disable() { write_enable(FALSE); }
|
||||||
|
|
||||||
virtual bool save_and_new() const;
|
virtual bool save_and_new() const;
|
||||||
|
|
||||||
void set_search_field(short id) { _search_id = id;} // Impone il campo da utilizzare col bottone Ricerca
|
void set_search_field(short id) { _search_id = id;} // Impone il campo da utilizzare col bottone Ricerca
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TRelation_application();
|
TRelation_application();
|
||||||
virtual ~TRelation_application();
|
virtual ~TRelation_application();
|
||||||
bool filtered() const { return _fixed.not_empty(); }
|
bool filtered() const { return _fixed.not_empty(); }
|
||||||
bool find(byte key = 0);
|
bool find(byte key = 0);
|
||||||
void set_link(TMask & m, const char * keyexpr);
|
void set_link(TMask & m, const char * keyexpr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -686,13 +686,12 @@ const TFilename& TFilename::tempdir()
|
|||||||
// Certified 50%
|
// Certified 50%
|
||||||
const TFilename& TFilename::temp(const char* prefix)
|
const TFilename& TFilename::temp(const char* prefix)
|
||||||
{
|
{
|
||||||
const TFilename dirpref(tempdir());
|
TFilename dirpref(tempdir());
|
||||||
char* t = NULL;
|
|
||||||
|
|
||||||
if (prefix)
|
if (prefix && *prefix)
|
||||||
{
|
{
|
||||||
set(prefix); // Copia prefisso e ...
|
set(prefix); // Copia prefisso e ...
|
||||||
strip("$#"); // ... toglie caratteri jolly
|
strip("$#*?."); // ... toglie caratteri jolly
|
||||||
|
|
||||||
const TFixed_string f(prefix);
|
const TFixed_string f(prefix);
|
||||||
#if XVT_OS==XVT_OS_SCOUNIX
|
#if XVT_OS==XVT_OS_SCOUNIX
|
||||||
@ -707,19 +706,24 @@ const TFilename& TFilename::temp(const char* prefix)
|
|||||||
*this << pid;
|
*this << pid;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
t = tempnam((char*)(const char*)dirpref, (char*)_str);
|
|
||||||
}
|
}
|
||||||
else
|
else cut(0);
|
||||||
t = tempnam((char*)(const char*)dirpref, NULL);
|
|
||||||
|
|
||||||
|
TFilename oldtmp(getenv("TMP"));
|
||||||
|
dirpref.insert("TMP=", 0);
|
||||||
|
putenv(dirpref);
|
||||||
|
|
||||||
|
char* t = tempnam(NULL, (char*)_str);
|
||||||
|
CHECK(t != NULL, "Can't execute tempnam");
|
||||||
set(t);
|
set(t);
|
||||||
|
free(t);
|
||||||
|
oldtmp.insert("TMP=", 0);
|
||||||
|
putenv(oldtmp);
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (fexist(_str))
|
if (fexist(_str))
|
||||||
fatal_box("Il file '%s' esiste gia'", _str);
|
fatal_box("Il file '%s' esiste gia'", _str);
|
||||||
#endif
|
#endif
|
||||||
if (t) free(t);
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -1,289 +1,290 @@
|
|||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#define __STRINGS_H
|
#define __STRINGS_H
|
||||||
|
|
||||||
#ifndef __STRING_H
|
#ifndef __STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __OBJECT_H
|
#ifndef __OBJECT_H
|
||||||
#include <object.h>
|
#include <object.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
// Classe TString : public TObject
|
// Classe TString : public TObject
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
class TString : public TObject
|
class TString : public TObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
// @DPROT
|
// @DPROT
|
||||||
char* _str; // Puntatore alla stringa
|
char* _str; // Puntatore alla stringa
|
||||||
int _size; // Lunghezza
|
int _size; // Lunghezza
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
// @FPROT
|
// @FPROT
|
||||||
int make_room(int size); // Cerca spazio per altri size caratteri
|
int make_room(int size); // Cerca spazio per altri size caratteri
|
||||||
TString& set(const char*); // Inizializza con la stringa puntata da char* di lunghezza size
|
TString& set(const char*); // Inizializza con la stringa puntata da char* di lunghezza size
|
||||||
|
|
||||||
TString(char* str, int size) : _str(str), _size(size) {}
|
TString(char* str, int size) : _str(str), _size(size) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
virtual void resize(int size, bool cpy); // Ri/alloca la stringa
|
virtual void resize(int size, bool cpy); // Ri/alloca la stringa
|
||||||
|
|
||||||
TString();
|
TString();
|
||||||
TString(int size); // Default constructor for a string of given size
|
TString(int size); // Default constructor for a string of given size
|
||||||
TString(const char* s); // Costruttore a partire da una stringa s
|
TString(const char* s); // Costruttore a partire da una stringa s
|
||||||
TString(const TString& s); // Costruttore da un oggetto TString s
|
TString(const TString& s); // Costruttore da un oggetto TString s
|
||||||
virtual ~TString(); // Deallocates the string
|
virtual ~TString(); // Deallocates the string
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// @DES Methods derived from TObject
|
// @DES Methods derived from TObject
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// @FPUB
|
// @FPUB
|
||||||
virtual const char* class_name() const; // Ritorna il nome della classe
|
virtual const char* class_name() const; // Ritorna il nome della classe
|
||||||
virtual word class_id() const; // Ritorna l'identificatore della classe
|
virtual word class_id() const; // Ritorna l'identificatore della classe
|
||||||
virtual bool ok() const { return _str != NULL; }
|
virtual bool ok() const { return _str != NULL; }
|
||||||
virtual TObject* dup() const;
|
virtual TObject* dup() const;
|
||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
virtual void read_from(istream& in);
|
virtual void read_from(istream& in);
|
||||||
virtual word hash() const; // Return hash value
|
virtual word hash() const; // Return hash value
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// @DES Query methods
|
// @DES Query methods
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// @FPUB
|
// @FPUB
|
||||||
operator const char*() const { return (const char*)_str; } // *(TString) -> _str
|
operator const char*() const { return (const char*)_str; } // *(TString) -> _str
|
||||||
char& operator[](int i) // TString[i] -> _str[i]
|
char& operator[](int i) // TString[i] -> _str[i]
|
||||||
{
|
{
|
||||||
CHECKD(i >= 0 && i <= _size, "Bad string subscript: ", i);
|
CHECKD(i >= 0 && i <= _size, "Bad string subscript: ", i);
|
||||||
return _str[i];
|
return _str[i];
|
||||||
}
|
}
|
||||||
char operator[](int i) const // TString[i] -> _str[i]
|
char operator[](int i) const // TString[i] -> _str[i]
|
||||||
{
|
{
|
||||||
CHECKD(i >= 0 && i <= _size, "Bad string subscript: ", i);
|
CHECKD(i >= 0 && i <= _size, "Bad string subscript: ", i);
|
||||||
return _str[i];
|
return _str[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int size() const { return _size; }
|
int size() const { return _size; }
|
||||||
int len() const { return strlen(_str); }
|
int len() const { return strlen(_str); }
|
||||||
bool empty() const { return *_str == '\0'; }
|
bool empty() const { return *_str == '\0'; }
|
||||||
bool not_empty() const { return *_str != '\0'; }
|
bool not_empty() const { return *_str != '\0'; }
|
||||||
|
|
||||||
int find(char, int from = 0) const; // Ritorna la posizione del carattere char nell'oggetto TString
|
int find(char, int from = 0) const; // Ritorna la posizione del carattere char nell'oggetto TString
|
||||||
int find(const char* s, int from = 0) const; // Ritorna la posizione della stringa s nell'oggetto TString
|
int find(const char* s, int from = 0) const; // Ritorna la posizione della stringa s nell'oggetto TString
|
||||||
|
|
||||||
const TString& left(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da sinistra
|
const TString& left(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da sinistra
|
||||||
const TString& mid(int from, int count = -1) const; // Ritorna l'oggetto TString composto dai count caratteri a partire da from
|
const TString& mid(int from, int count = -1) const; // Ritorna l'oggetto TString composto dai count caratteri a partire da from
|
||||||
const TString& sub(int from, int to = -1) const; // Ritorna la stringa da FROM a TO (escluso)
|
const TString& sub(int from, int to = -1) const; // Ritorna la stringa da FROM a TO (escluso)
|
||||||
const TString& right(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da destra
|
const TString& right(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da destra
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// @DES Modifying methods
|
// @DES Modifying methods
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// @FPUB
|
// @FPUB
|
||||||
|
|
||||||
TString& fill(char c, int n = -1); // Riempie con n caratteri c
|
TString& fill(char c, int n = -1); // Riempie con n caratteri c
|
||||||
TString& spaces(int n = -1) { return fill(' ', n); }
|
TString& spaces(int n = -1) { return fill(' ', n); }
|
||||||
TString& overwrite(const char* s, int pos = 0); // Sovrascrive la stringa s dalla posizione pos
|
TString& overwrite(const char* s, int pos = 0); // Sovrascrive la stringa s dalla posizione pos
|
||||||
TString& insert(const char* s, int pos = 0); // Inserisce la stringa s dalla posizione pos
|
TString& insert(const char* s, int pos = 0); // Inserisce la stringa s dalla posizione pos
|
||||||
|
|
||||||
TString& strip(const char* k); // Elimina tutti i caratteri contenuti in k
|
TString& strip(const char* k); // Elimina tutti i caratteri contenuti in k
|
||||||
TString& strip_spaces(); // Elimina tutti gli spazi non contenuti tra apici singoli o doppi
|
TString& strip_spaces(); // Elimina tutti gli spazi non contenuti tra apici singoli o doppi
|
||||||
TString& ltrim(int n = 0); // Elimina gli spazi da sinistra se n=0 altrimenti elimina i primi n caratteri (da sinistra).
|
TString& ltrim(int n = 0); // Elimina gli spazi da sinistra se n=0 altrimenti elimina i primi n caratteri (da sinistra).
|
||||||
TString& rtrim(int n = 0); // Elimina gli spazi da destra se n=0 altrimenti elimina i primi n caratteri (da destra).
|
TString& rtrim(int n = 0); // Elimina gli spazi da destra se n=0 altrimenti elimina i primi n caratteri (da destra).
|
||||||
TString& trim(); // ltrim e rtrim
|
TString& trim(); // ltrim e rtrim
|
||||||
|
|
||||||
TString& right_just(int n = -1, char c = ' '); // Giustifica a destra
|
TString& right_just(int n = -1, char c = ' '); // Giustifica a destra
|
||||||
TString& center_just(int n = -1, char c = ' '); // Centra
|
TString& center_just(int n = -1, char c = ' '); // Centra
|
||||||
TString& left_just(int n = -1, char c = ' '); // Giustifica a sinistra
|
TString& left_just(int n = -1, char c = ' '); // Giustifica a sinistra
|
||||||
|
|
||||||
TString& picture(const char* pic, const char* s);
|
TString& picture(const char* pic, const char* s);
|
||||||
virtual TString& format(const char* fmt, ...);
|
virtual TString& format(const char* fmt, ...);
|
||||||
|
|
||||||
TString& cut(int n); // Inserisce un '\0' alla posizione n-esima.
|
TString& cut(int n); // Inserisce un '\0' alla posizione n-esima.
|
||||||
|
|
||||||
TString& upper(); // Mette la stringa in maiuscolo
|
TString& upper(); // Mette la stringa in maiuscolo
|
||||||
TString& lower(); // Mette la stringa in minuscolo
|
TString& lower(); // Mette la stringa in minuscolo
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// @DES Standard operators
|
// @DES Standard operators
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// @FPUB
|
// @FPUB
|
||||||
|
|
||||||
const TString& operator =(const TString& s) { return set(s._str); }
|
const TString& operator =(const TString& s) { return set(s._str); }
|
||||||
const TString& operator =(const char* s) { return set(s); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
|
|
||||||
TString& operator <<(const char*);
|
TString& operator <<(const char*);
|
||||||
TString& operator <<(char);
|
TString& operator <<(char);
|
||||||
TString& operator <<(int);
|
TString& operator <<(int);
|
||||||
TString& operator <<(long);
|
TString& operator <<(long);
|
||||||
TString& operator <<(double);
|
TString& operator <<(double);
|
||||||
TString& operator <<(const TObject& obj);
|
TString& operator <<(const TObject& obj);
|
||||||
TString& operator <<(const TString& str); // For efficiency only
|
TString& operator <<(const TString& str); // For efficiency only
|
||||||
|
|
||||||
bool operator ==(const char* s) const { return strcmp(_str, s) == 0; }
|
bool operator ==(const char* s) const { return strcmp(_str, s) == 0; }
|
||||||
bool operator ==(char* s) const { return strcmp(_str, s) == 0; }
|
bool operator ==(char* s) const { return strcmp(_str, s) == 0; }
|
||||||
bool operator ==(const TString& s) const { return strcmp(_str, s._str) == 0; }
|
bool operator ==(const TString& s) const { return strcmp(_str, s._str) == 0; }
|
||||||
bool operator !=(const char* s) const { return strcmp(_str, s) != 0; }
|
bool operator !=(const char* s) const { return strcmp(_str, s) != 0; }
|
||||||
bool operator !=(char* s) const { return strcmp(_str, s) != 0; }
|
bool operator !=(char* s) const { return strcmp(_str, s) != 0; }
|
||||||
bool operator !=(const TString& s) const { return strcmp(_str, s._str) != 0; }
|
bool operator !=(const TString& s) const { return strcmp(_str, s._str) != 0; }
|
||||||
bool operator <(const char* s) const { return strcmp(_str, s) < 0; }
|
bool operator <(const char* s) const { return strcmp(_str, s) < 0; }
|
||||||
bool operator >(const char* s) const { return strcmp(_str, s) > 0; }
|
bool operator >(const char* s) const { return strcmp(_str, s) > 0; }
|
||||||
bool operator >=(const char* s) const { return strcmp(_str, s) >= 0; }
|
bool operator >=(const char* s) const { return strcmp(_str, s) >= 0; }
|
||||||
bool operator <=(const char* s) const { return strcmp(_str, s) <= 0; }
|
bool operator <=(const char* s) const { return strcmp(_str, s) <= 0; }
|
||||||
bool match(const char* s) const;
|
bool match(const char* s) const;
|
||||||
bool compare(const char* s, int max = -1, bool ignorecase = FALSE) const;
|
bool compare(const char* s, int max = -1, bool ignorecase = FALSE) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
// Classe TFixed_string : public TString
|
// Classe TFixed_string : public TString
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
class TFixed_string : public TString
|
class TFixed_string : public TString
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void resize(int size, bool cpy); // Causa un errore fatale!
|
virtual void resize(int size, bool cpy); // Causa un errore fatale!
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TFixed_string(const char* str, int size = -1);
|
TFixed_string(const char* str, int size = -1);
|
||||||
virtual ~TFixed_string();
|
virtual ~TFixed_string();
|
||||||
|
|
||||||
virtual TString& format(const char* fmt, ...);
|
virtual TString& format(const char* fmt, ...);
|
||||||
|
|
||||||
const TString& operator =(const TString& s) { return set((const char*)s); }
|
const TString& operator =(const TString& s) { return set((const char*)s); }
|
||||||
const TString& operator=(const char* str) { return set(str); }
|
const TString& operator=(const char* str) { return set(str); }
|
||||||
void strncpy(const char* s, int n);
|
void strncpy(const char* s, int n);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TString16 : public TFixed_string
|
class TString16 : public TFixed_string
|
||||||
{
|
{
|
||||||
char _str16[17];
|
char _str16[17];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TString16(const char* str = "") : TFixed_string(_str16, 17) { set(str); }
|
TString16(const char* s = "") : TFixed_string(_str16, 17) { set(s); }
|
||||||
TString16(const TString& s) : TFixed_string(_str16, 17) { set(s); }
|
TString16(const TString& s) : TFixed_string(_str16, 17) { set(s); }
|
||||||
const TString& operator =(const TString& s) { return set((const char*)s); }
|
const TString& operator =(const TString& s) { return set((const char*)s); }
|
||||||
const TString& operator =(const char* str) { return set(str); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TString80 : public TFixed_string
|
class TString80 : public TFixed_string
|
||||||
{
|
{
|
||||||
char _str80[81];
|
char _str80[81];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TString80(const char* str = "") : TFixed_string(_str80, 81) { set(str); }
|
TString80(const char* s = "") : TFixed_string(_str80, 81) { set(s); }
|
||||||
TString80(const TString& s) : TFixed_string(_str80, 81) { set(s); }
|
TString80(const TString& s) : TFixed_string(_str80, 81) { set(s); }
|
||||||
const TString& operator =(const char* str) { return set(str); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
const TString& operator =(const TString& s) { return set((const char*)s); }
|
const TString& operator =(const TString& s) { return set((const char*)s); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TString256 : public TFixed_string
|
class TString256 : public TFixed_string
|
||||||
{
|
{
|
||||||
char _str256[257];
|
char _str256[257];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TString256(const char* str = "") : TFixed_string(_str256, 257) { set(str); }
|
TString256(const char* s = "") : TFixed_string(_str256, 257) { set(s); }
|
||||||
TString256(const TString& s) : TFixed_string(_str256, 257) { set(s); }
|
TString256(const TString& s) : TFixed_string(_str256, 257) { set(s); }
|
||||||
const TString& operator =(const char* str) { return set(str); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
const TString& operator =(const TString& s) { return set((const char*)s); }
|
const TString& operator =(const TString& s) { return set((const char*)s); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
// Classe TFilename : public TString80 (256 su Windows'95)
|
// Classe TFilename : public TString80 (256 su Windows'95)
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
class TFilename : public TString80
|
class TFilename : public TString80
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
|
|
||||||
TFilename(const char* n = "") : TString80(n) {}
|
TFilename(const char* n = "") : TString80(n) {}
|
||||||
TFilename(const TString& n) : TString80(n) {}
|
TFilename(const TString& n) : TString80((const char*)n) {}
|
||||||
|
TFilename(const TFilename& n) : TString80((const char*)n) {}
|
||||||
// assegnazione tra TFile e stringa
|
|
||||||
const TString& operator =(const char* s) { return set(s); }
|
// assegnazione tra TFile e stringa
|
||||||
const TString& operator =(const TString& s) { return set((const char*)s); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
|
const TString& operator =(const TString& s) { return set((const char*)s); }
|
||||||
virtual bool ok() const; // Controlla il formato del nome del file
|
|
||||||
|
virtual bool ok() const; // Controlla il formato del nome del file
|
||||||
const char* ext() const; // Ritorna l'estensione
|
|
||||||
void ext(const char*); // Imposta come estensione la stringa puntata da char*
|
const char* ext() const; // Ritorna l'estensione
|
||||||
|
void ext(const char*); // Imposta come estensione la stringa puntata da char*
|
||||||
const char* name() const; // Ritorna il nome del file
|
|
||||||
const char* path() const; // Ritorna il nome del direttorio
|
const char* name() const; // Ritorna il nome del file
|
||||||
const TFilename& temp(const char* prefix = NULL); // Genera il nome di un file temporaneo
|
const char* path() const; // Ritorna il nome del direttorio
|
||||||
const TFilename& tempdir(); // Genera il nome della directory temporanea
|
const TFilename& temp(const char* prefix = NULL); // Genera il nome di un file temporaneo
|
||||||
};
|
const TFilename& tempdir(); // Genera il nome della directory temporanea
|
||||||
|
};
|
||||||
// @C
|
|
||||||
// Classe TToken_string : public TString
|
// @C
|
||||||
// @END
|
// Classe TToken_string : public TString
|
||||||
|
// @END
|
||||||
class TToken_string : public TString
|
|
||||||
{
|
class TToken_string : public TString
|
||||||
// @DPRIV
|
{
|
||||||
char _separator; // Carattere separatore
|
// @DPRIV
|
||||||
int _last; // Puntatore all'ultimo
|
char _separator; // Carattere separatore
|
||||||
|
int _last; // Puntatore all'ultimo
|
||||||
protected:
|
|
||||||
// @FPROT
|
protected:
|
||||||
|
// @FPROT
|
||||||
virtual TObject* dup() const; // Crea un duplicato della token string
|
|
||||||
bool set_item(const char* v, int n);
|
virtual TObject* dup() const; // Crea un duplicato della token string
|
||||||
|
bool set_item(const char* v, int n);
|
||||||
public:
|
|
||||||
// @FPUB
|
public:
|
||||||
TToken_string(const char* = "", char separator = '|');
|
// @FPUB
|
||||||
TToken_string(int n, char separator = '|');
|
TToken_string(const char* = "", char separator = '|');
|
||||||
TToken_string(const TToken_string& s);
|
TToken_string(int n, char separator = '|');
|
||||||
|
TToken_string(const TToken_string& s);
|
||||||
void separator(char s) { _separator = s; } // Setta il separatore a s
|
|
||||||
|
void separator(char s) { _separator = s; } // Setta il separatore a s
|
||||||
void restart() { _last = empty() ? -1 : 0; } // Rimette all'inizio il puntatore
|
|
||||||
const TString& operator =(const char* s) { set(s);restart();return *this; }
|
void restart() { _last = empty() ? -1 : 0; } // Rimette all'inizio il puntatore
|
||||||
const TString& operator =(const TString& s) { set(s);restart();return *this; }
|
const TString& operator =(const char* s) { set(s);restart();return *this; }
|
||||||
|
const TString& operator =(const TString& s) { set(s);restart();return *this; }
|
||||||
void add(const char* s, int n = -1); // Aggiunge una stringa
|
|
||||||
void add(char c, int pos = -1); // Aggiunge un char
|
void add(const char* s, int n = -1); // Aggiunge una stringa
|
||||||
void add(long n, int pos = -1); // Aggiunge un intero
|
void add(char c, int pos = -1); // Aggiunge un char
|
||||||
void add(int n, int pos = -1); // Aggiunge un intero
|
void add(long n, int pos = -1); // Aggiunge un intero
|
||||||
void destroy(int pos); // Toglie la stringa pos
|
void add(int n, int pos = -1); // Aggiunge un intero
|
||||||
const char* get(); // Ritorna il prossimo token
|
void destroy(int pos); // Toglie la stringa pos
|
||||||
const char* get(int n); // Ritorna un token (-1 = prossimo; -2 = ultimo; n = ennesimo)
|
const char* get(); // Ritorna il prossimo token
|
||||||
char get_char(int n = -1); // Ritorna un carattere
|
const char* get(int n); // Ritorna un token (-1 = prossimo; -2 = ultimo; n = ennesimo)
|
||||||
int get_int(int n = -1); // Ritorna un intero
|
char get_char(int n = -1); // Ritorna un carattere
|
||||||
long get_long(int n = -1); // Ritorna un intero esteso
|
int get_int(int n = -1); // Ritorna un intero
|
||||||
int get_pos(const char* s); // Ritorna la posizione dell'item s
|
long get_long(int n = -1); // Ritorna un intero esteso
|
||||||
int items() const; // Ritorna il numero di token presenti
|
int get_pos(const char* s); // Ritorna la posizione dell'item s
|
||||||
bool empty_items() const; // Controlla se tutti i token sono nulli
|
int items() const; // Ritorna il numero di token presenti
|
||||||
};
|
bool empty_items() const; // Controlla se tutti i token sono nulli
|
||||||
|
};
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// @DES Paragraph
|
///////////////////////////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////
|
// @DES Paragraph
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
class TParagraph_string : public TToken_string
|
|
||||||
{
|
class TParagraph_string : public TToken_string
|
||||||
int _width;
|
{
|
||||||
bool _fixed;
|
int _width;
|
||||||
|
bool _fixed;
|
||||||
protected:
|
|
||||||
void tokenize();
|
protected:
|
||||||
|
void tokenize();
|
||||||
public:
|
|
||||||
TParagraph_string(const char* s, int width);
|
public:
|
||||||
const TString& operator =(const char* s);
|
TParagraph_string(const char* s, int width);
|
||||||
void set_width(int width) { _width = width; }
|
const TString& operator =(const char* s);
|
||||||
};
|
void set_width(int width) { _width = width; }
|
||||||
|
};
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user