diff --git a/include/alleg.h b/include/alleg.h index d4879fd2a..1b7ae1e23 100755 --- a/include/alleg.h +++ b/include/alleg.h @@ -23,7 +23,6 @@ DEFFLD(DATAREG) DEFFLD(MODPAG) DEFFLD(IMPORTO) DEFFLD(IMPOSTA) -DEFFLD(NATOPE) DEFFLD(TIPOPE) DEFFLD(CONTRATTO) diff --git a/include/applicat.cpp b/include/applicat.cpp index 0c58efce4..1679eac48 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -500,7 +500,6 @@ void TApplication::run( // @comm E' in questa fase che si controlla se esiste la chiave e' attaccata { - CHECK(_application == NULL, "Sorry, multitasking not implemented yet"); // Devo metterla qui per far funzionare la TDongle::network_login _application = this; diff --git a/include/applicat.h b/include/applicat.h index 9442c6b07..37f3e134f 100755 --- a/include/applicat.h +++ b/include/applicat.h @@ -5,6 +5,10 @@ #include #endif +#ifndef __ASSOC_H +#include +#endif + #ifndef __DICTION_H #include #endif @@ -17,9 +21,6 @@ #define CHK_DONGLE 0 // dongle authorization checks //#define CHK_USER 1 // user authorization checks -#ifndef __ASSOC_H -class TAssoc_array; -#endif // @doc EXTERNAL // @class TApplication | Classe per la gestione di tutte le applicazioni PRASSI diff --git a/include/archives.h b/include/archives.h index e756855b7..177d1d6c2 100755 --- a/include/archives.h +++ b/include/archives.h @@ -1,6 +1,10 @@ #ifndef __ARCHIVES_H #define __ARCHIVES_H +#ifndef __ARRAY_H +#include +#endif + #ifndef __STRINGS_H #include #endif diff --git a/include/array.cpp b/include/array.cpp index 9477bb7ae..508156682 100755 --- a/include/array.cpp +++ b/include/array.cpp @@ -1,7 +1,4 @@ -#include -#include -#include - +#include #include void TContainer::for_each( OPERATION_FUNCTION op ) @@ -555,14 +552,111 @@ static int sortable_compare( void TArray::sort( COMPARE_FUNCTION compare) // @parm Funzione indicante il criterio di ordinamento (default TSortable) - // @comm Nel caso non venga passata nessuna funzione che permetta di conforntare - // i due oggetti viene utilizzato il criterio + // @comm Nel caso non venga passata nessuna funzione che permetta di confrontare + // i due oggetti viene utilizzato il criterio { typedef int (*qsortfunc)(const void*, const void*); if (compare == NULL) compare = sortable_compare; pack(); - qsort(_data, items(), sizeof(TObject*), (qsortfunc)compare); + qsort(_data, last()+1, sizeof(TObject*), (qsortfunc)compare); +} + + +static COMPARE_FUNCTION_EX _cmp_func = NULL; +static void* _cmp_jolly = NULL; + +static int compare_ex(const void* p1, const void* p2) +{ + if (p1 == p2) + return 0; + const TSortable& o1 = **(const TSortable**)p1; + const TSortable& o2 = **(const TSortable**)p2; + return _cmp_func(o1, o2, _cmp_jolly); +} + +void TArray::sort( + COMPARE_FUNCTION_EX compare, // @parm Funzione indicante il criterio di ordinamento (default TSortable) + void* jolly) + + // @comm Nel caso non venga passata nessuna funzione che permetta di conforntare + // i due oggetti viene utilizzato il criterio +{ + _cmp_func = compare; + _cmp_jolly = jolly ? jolly : this; + pack(); + qsort(_data, last()+1, sizeof(TObject*), compare_ex); +} + + +/////////////////////////////////////////////////////////// +// TString_array +/////////////////////////////////////////////////////////// + +int TString_array::add(const char* s, int n) +{ + if (objptr(n) == NULL) + n = TArray::add(new TToken_string(s), n); + else + row(n) = s; + return n; +} + +int TString_array::add(TToken_string* s, int n) +{ return TArray::add(s, n); } + +int TString_array::add(const TToken_string& s, int n) +{ + if (objptr(n) == NULL) + n = TArray::add(s, n); + else + row(n) = s; + return n; +} + +const TString_array& TString_array::operator=(const TString_array& a) +{ + destroy(); + FOR_EACH_ARRAY_ROW_BACK(a, i, riga) + add(*riga, i); + return *this; +} + +// @doc EXTERNAL + +// @mfunc Cerca una stringa nell'array +// +// @rdesc Ritorna la posizione nell'array in cui si trova la stringa (-1 se non +// e' stata trovata) +int TString_array::find( + const char* s, // @parm Stringa da cercare + int from) const // @parm Posizione dalla quale cercare la stringa +{ + int found = -1; + for (int i = from; i < items(); i++) + if (row(i).compare(s, -1, true) == 0) + { + found = i; + break; + } + return found; +} + +HIDDEN int ascending_string(const TObject** o1, const TObject** o2) +{ + const TString* s1 = (const TString*)*o1; + const TString* s2 = (const TString*)*o2; + return strcmp(*s1, *s2); +} + +HIDDEN int descending_string(const TObject** o1, const TObject** o2) +{ + return -ascending_string(o1, o2); +} + +void TString_array::sort(bool ascending) +{ + TArray::sort(ascending ? ascending_string : descending_string); } /////////////////////////////////////////////////////////// diff --git a/include/array.h b/include/array.h index 976697285..2648950a2 100755 --- a/include/array.h +++ b/include/array.h @@ -14,6 +14,7 @@ // @type COMPARE_FUNCTION | Prototipo funzione di confronto tra elementi della // classe da passare al metodo sort dei typedef int (*COMPARE_FUNCTION)(const TObject**, const TObject**); +typedef int (*COMPARE_FUNCTION_EX)(const TSortable&, const TSortable&, void*); // @doc EXTERNAL @@ -196,6 +197,7 @@ public: virtual void pack(); // @cmember Ordina i TObject secondo il criterio definito in void sort(COMPARE_FUNCTION = NULL); + void sort(COMPARE_FUNCTION_EX cmp, void* jolly); }; inline TObject* TArray::objptr(int index) const @@ -218,6 +220,70 @@ inline TObject& TArray::operator[] (int index) const (__obj = (__arr).objptr(__r)) != NULL; \ __r = (__arr).pred(__r)) +/////////////////////////////////////////////////////////// +// TString_array +/////////////////////////////////////////////////////////// + +#ifndef __STRINGS_H +class TToken_string; +#endif + +// @doc EXTERNAL + +// @class TString_array | Array di stringhe +// +// @base public | TArray +class TString_array : public TArray +// @author:(INTERNAL) Guido +{ + // @access Public Member +public: + // @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore) + TToken_string& row(int n) + { return (TToken_string&)operator[](n); } + // @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore) + const TToken_string& row(int n) const + { return (const TToken_string&)operator[](n); } + // @cmember Restituisce il puntatore alla stringa n dell'array (NULL se non esiste) + TToken_string* rowptr(int n) + { return (TToken_string*)objptr(n); } + // @cmember assegnamento di un array + const TString_array& operator=(const TString_array& a); + // @cmember Aggiunge una Token string all'array (chiama ) + int add(TToken_string* s, int n = -1); + // @cmember Aggiunge un oggetto stringa all'array (chiama ) + int add(const TToken_string& s, int n = -1); + // @cmember Aggiunge una stringa all'array (chiama ) + int add(const char* s, int n = -1); + // @cmember Cerca una stringa nell'array + int find(const char* s, int from = 0) const; + // @cmember Ordina alfabeticamente l'array + void sort(bool ascendig = true); + // @cmember Ritorna l'ultima riga (deve esistere!) + TToken_string& last_row() + { return (TToken_string&)operator[](last()); } + + // @cmember Costruttore + TString_array(int size = 8) : TArray(size) + {} + // @cmember Distruttore + virtual ~TString_array() + {} +}; + +#define FOR_EACH_ARRAY_ROW(__arr, __r, __riga) \ + TToken_string* __riga; \ + int __r; \ + for (__r = (__arr).first(); \ + (__riga = (TToken_string*)(__arr).objptr(__r)); \ + __r = (__arr).succ(__r)) + +#define FOR_EACH_ARRAY_ROW_BACK(__arr, __r, __riga) \ + TToken_string* __riga; \ + int __r; \ + for (__r = (__arr).last(); \ + (__riga = (TToken_string*)(__arr).objptr(__r)); \ + __r = (__arr).pred(__r)) class TPointer_array : public TArray { diff --git a/include/assoc.h b/include/assoc.h index 7d64d44e3..7c473f099 100755 --- a/include/assoc.h +++ b/include/assoc.h @@ -1,6 +1,10 @@ #ifndef __ASSOC_H #define __ASSOC_H +#ifndef __ARRAY_H +#include +#endif + #ifndef __STRINGS_H #include #endif diff --git a/include/currency.h b/include/currency.h index 58dcb3184..4aada452d 100755 --- a/include/currency.h +++ b/include/currency.h @@ -5,6 +5,11 @@ #include #endif +#ifndef __STRINGS_H +#include +#endif + + #ifndef TRectype class TRectype; #endif diff --git a/include/dongle.cpp b/include/dongle.cpp index 73a84ec33..3f172aac9 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -937,6 +937,10 @@ class TEnigma_machine : public TObject protected: void init_key(char key[8]) const; bool decode_string(const TString& datain, TString& dataout) const; + bool encode_string(const TString& linein, TString& lineout) const; + + bool init(); + void uninit(); public: virtual bool ok() const { return _scan != NULL && !_scan->eof(); } @@ -945,6 +949,8 @@ public: bool find_serno(long serno); int year_assist() const { return _year_assist; } + bool encode(const TString& txtfile); // dninst.txt -> dninst.zip + TEnigma_machine(); ~TEnigma_machine(); }; @@ -970,6 +976,22 @@ bool TEnigma_machine::decode_string(const TString& datain, TString& dataout) con return dataout.full(); } +bool TEnigma_machine::encode_string(const TString& linein, TString& lineout) const +{ + lineout.cut(0); + if (linein.full() && !linein.starts_with("//")) + { + char key[8]; init_key(key); + char* buf = lineout.get_buffer(linein.len()); + size_t i = 0; + for (i = 0; linein[i]; i++) + buf[i] = linein[i] + (i < 8 ? key[i] : linein[i - 8]); + buf[i] = '\0'; + } + return lineout.full(); +} + + bool TEnigma_machine::line(TString& data) { return _scan != NULL ? decode_string(_scan->line(), data) : false; } @@ -999,9 +1021,47 @@ bool TEnigma_machine::find_serno(long serno) return false; } -TEnigma_machine::TEnigma_machine() - : _scan(NULL), _year_assist(0) +bool TEnigma_machine::encode(const TString& txtfile) { + uninit(); + + ofstream o(DNINST_PATH); + + TString lineout; + + TScanner s(txtfile); + const TString& year = s.line(); + ::srand(883); + encode_string(year, lineout); + o << lineout << endl; + ::srand(atoi(year)); + while (s.good()) + { + const TString& linein = s.line(); + if (linein.empty()) + break; + encode_string(linein, lineout); + o << lineout << endl; + } + + init(); + + return o.good(); +} + +void TEnigma_machine::uninit() +{ + _year_assist = 0; + if (_scan != NULL) + { + delete _scan; + _scan = NULL; + } +} + +bool TEnigma_machine::init() +{ + uninit(); if (fexist(DNINST_PATH)) { _scan = new TScanner(DNINST_PATH); @@ -1010,13 +1070,15 @@ TEnigma_machine::TEnigma_machine() _year_assist = atoi(l1); ::srand(_year_assist); } + return _scan != NULL; } +TEnigma_machine::TEnigma_machine() + : _scan(NULL), _year_assist(0) +{ init(); } + TEnigma_machine::~TEnigma_machine() -{ - if (_scan != NULL) - delete _scan; -} +{ uninit(); } int Tdninst::assistance_year2solar(int ay) const { return (ay/1000)*1000 + (ay%1000)/10; } @@ -1300,6 +1362,64 @@ bool Tdninst::find_expiring(int days, TString& module, TDate& expires) const return module.full(); } +int Tdninst::check_customer() const +{ + int error = 2; // Not found + + const word serno = dongle().number(); + if (serno == 0) + error = is_power_station() ? 0 : 2; + else + { + TEnigma_machine em; + if (em.ok() && em.year_assist() > 2100 && em.find_serno(serno)) + { + error = 0; + const TDate oggi(TODAY); + TToken_string l(80, '='); + TString16 str; + TDate ds; + while (em.line(l) && error == 0) + { + if (l.empty() || l[0] == '[') + break; + if (parse_date(l, str, ds)) + { + if (ds >= oggi) + { + if (str == "*") + error = 2; else + if (str == "MustCall") + error = 1; + } + } + } + } + } + + return error; +} + +bool Tdninst::decode(const TString& f) const +{ + ofstream o(f); + + TEnigma_machine em; + o << em.year_assist() << endl; + + TString256 l; + while (em.line(l)) + o << l << endl; + + return em.ok(); +} + +bool Tdninst::encode(const TString& f) const +{ + TEnigma_machine em; + return em.encode(f); +} + Tdninst::Tdninst() : _year_assist(0) { TEnigma_machine s; diff --git a/include/dongle.h b/include/dongle.h index 05e8cd8b5..20c8366ff 100755 --- a/include/dongle.h +++ b/include/dongle.h @@ -1,6 +1,10 @@ #ifndef __DONGLE_H #define __DONGLE_H +#ifndef __ARRAY_H +#include +#endif + #ifndef __DATE_H #include #endif @@ -118,6 +122,10 @@ public: bool find_serno() const; bool find_killed(TToken_string& kill_list) const; bool find_expiring(int days, TString& module, TDate& expires) const; + int check_customer() const; + + bool decode(const TString& txt) const; // dninst.zip -> dninst.txt + bool encode(const TString& txt) const; // dninst.txt -> dninst.zip Tdninst(); }; diff --git a/include/expr.h b/include/expr.h index c914d0829..1c7b40e10 100755 --- a/include/expr.h +++ b/include/expr.h @@ -9,6 +9,9 @@ #include #endif +#ifndef __STRINGS_H +#include +#endif // @doc INTERNAL diff --git a/include/fraction.cpp b/include/fraction.cpp index daf1326b3..7fbc38cf5 100755 --- a/include/fraction.cpp +++ b/include/fraction.cpp @@ -1,5 +1,8 @@ #include + #include +#include + static __int64 mcd(__int64 a, __int64 b) { diff --git a/include/golem.h b/include/golem.h index 94b5a4b49..f8dedd29a 100755 --- a/include/golem.h +++ b/include/golem.h @@ -5,8 +5,8 @@ #include #endif -#ifndef __STRINGS_H -#include +#ifndef __ARRAY_H +#include #endif bool goto_url(const char* url); diff --git a/include/mailbox.h b/include/mailbox.h index 1ebeccfb0..b854a0b8b 100755 --- a/include/mailbox.h +++ b/include/mailbox.h @@ -1,6 +1,10 @@ #ifndef __MAILBOX_H #define __MAILBOX_H +#ifndef __ARRAY_H +#include +#endif + #ifndef __STRINGS_H #include #endif @@ -15,10 +19,7 @@ // // @base public | TObject class TMessage : public TObject - // @author:(INTERNAL) Villa - - { // @cfriend TMailbox friend class TMailbox; diff --git a/include/odbcrset.cpp b/include/odbcrset.cpp index f870b0c28..5c38fa17b 100755 --- a/include/odbcrset.cpp +++ b/include/odbcrset.cpp @@ -383,7 +383,7 @@ void TODBC_recordset::parsed_text(TString& sql) const TString pwd = conn.get(); pwd.strip("\""); TString dir = conn.get(); dir.strip("\""); if (!((TODBC_recordset*)this)->connect(dsn, usr, pwd, dir)) - error_box(TR("Impossibile connettersi al DSN %s"), (const char*)dsn); + error_box(FR("Impossibile connettersi al DSN %s"), (const char*)dsn); } } } diff --git a/include/real.cpp b/include/real.cpp index 7eafb491a..a5431dabc 100755 --- a/include/real.cpp +++ b/include/real.cpp @@ -1,5 +1,6 @@ #include #include +#include const real ZERO(0.0); const real UNO(1.0); diff --git a/include/real.h b/include/real.h index 5c3ef9a86..2949ce7c9 100755 --- a/include/real.h +++ b/include/real.h @@ -1,8 +1,8 @@ #ifndef __REAL_H #define __REAL_H -#ifndef __STRINGS_H -#include +#ifndef __ARRAY_H +#include #endif #define ALL_DECIMALS 883 diff --git a/include/recset.cpp b/include/recset.cpp index 72ff89ef8..b23661887 100755 --- a/include/recset.cpp +++ b/include/recset.cpp @@ -1657,6 +1657,6 @@ long TRecordset_sheet::get_items() const } TRecordset_sheet::TRecordset_sheet(TRecordset& query, const char* title, byte buttons) - : TSheet(-1, -1, -2, -4, title, query.sheet_head(), buttons), _query(query) + : TSheet(-1, -1, -2, -5, title, query.sheet_head(), buttons, 1), _query(query) { } diff --git a/include/relapp.cpp b/include/relapp.cpp index dd7ca4b10..b6292939d 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -255,10 +255,16 @@ void TRelation_application::enable_query() set_fixed(); } +bool TRelation_application::can_I_write(const TRelation* rel) const +{ return user_can_write(rel); } + +bool TRelation_application::can_I_read(const TRelation* rel) const +{ return user_can_write(rel); } + void TRelation_application::set_toolbar() { const int mode = _mask->mode(); - const bool can_edit_some = user_can_write(NULL); + const bool can_edit_some = can_I_write(NULL); const bool can_nav = _lnflag == 0 && _curr_transaction != TRANSACTION_LINK; int pos = _mask->id2pos(DLG_SAVEREC); @@ -266,7 +272,7 @@ void TRelation_application::set_toolbar() { bool enabsave=mode != MODE_QUERY; if (enabsave) - enabsave = user_can_write(get_relation()); + enabsave = can_I_write(get_relation()); _mask->fld(pos).enable(enabsave); } pos = _mask->id2pos(DLG_DELREC); @@ -474,9 +480,9 @@ void TRelation_application::insert_mode() r->zero(); _mask->autosave(*r); - if (!user_can_write(r)) + if (!can_I_write(r)) { - warning_box(FR("L'utente %s non puo' inserire in questo archivio"), (const char*)user()); + warning_box(FR("L'utente %s non puo' inserire %s"), (const char*)user(), r->file().description()); return; } @@ -514,14 +520,14 @@ void TRelation_application::insert_mode() bool TRelation_application::modify_mode() { TRelation* rel = get_relation(); - if (!user_can_read(rel)) + if (!can_I_read(rel)) { warning_box(TR("I dati non sono accessibili per l'utente %s"), (const char*)user()); query_mode(); return FALSE; } - const TReclock block = user_can_write(rel) ? _testandlock : _nolock; + const TReclock block = can_I_write(rel) ? _testandlock : _nolock; int err = rel->read(_isequal, block); if (err != NOERR) { @@ -1409,7 +1415,7 @@ void TRelation_application::main_loop() } else { - if (save_and_new()) + if (save_and_new() && can_I_write(NULL)) { if (_mask->insert_mode()) insert_mode(); diff --git a/include/relapp.h b/include/relapp.h index ed4f59269..985c95846 100755 --- a/include/relapp.h +++ b/include/relapp.h @@ -199,6 +199,9 @@ protected: // @cmember Richiede se il record corrente e' protetto (non cancellabile) virtual bool protected_record(TRelation &); + + virtual bool can_I_write(const TRelation* rel) const; + virtual bool can_I_read(const TRelation* rel) const; // @cmember Inizializza la maschera per il modo ricerca virtual void init_query_mode(TMask&) diff --git a/include/strings.cpp b/include/strings.cpp index 8952ef3d9..40f585a86 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -2060,76 +2060,6 @@ void TParagraph_string::tokenize() } } -/////////////////////////////////////////////////////////// -// TString_array -/////////////////////////////////////////////////////////// - -int TString_array::add(const char* s, int n) -{ - if (objptr(n) == NULL) - n = TArray::add(new TToken_string(s), n); - else - row(n) = s; - return n; -} - -int TString_array::add(const TToken_string& s, int n) -{ - if (objptr(n) == NULL) - n = TArray::add(s, n); - else - row(n) = s; - return n; -} - -const TString_array& TString_array::operator=(const TString_array& a) -{ - destroy(); - for (int i = a.last(); i >= 0; i = a.pred(i)) - { - const TToken_string& s = a.row(i); - add(s, i); - } - return a; -} - -// @doc EXTERNAL - -// @mfunc Cerca una stringa nell'array -// -// @rdesc Ritorna la posizione nell'array in cui si trova la stringa (-1 se non -// e' stata trovata) -int TString_array::find( - const char* s, // @parm Stringa da cercare - int from) const // @parm Posizione dalla quale cercare la stringa -{ - int found = -1; - for (int i = from; i < items(); i++) - if (row(i).compare(s, -1, true) == 0) - { - found = i; - break; - } - return found; -} - -HIDDEN int ascending_string(const TObject** o1, const TObject** o2) -{ - const TString* s1 = (const TString*)*o1; - const TString* s2 = (const TString*)*o2; - return strcmp(*s1, *s2); -} - -HIDDEN int descending_string(const TObject** o1, const TObject** o2) -{ - return -ascending_string(o1, o2); -} - -void TString_array::sort(bool ascending) -{ - TArray::sort(ascending ? ascending_string : descending_string); -} - // Temporary strings generator: a little step for a man, a big step for campo! TToken_string& get_tmp_string(int len) diff --git a/include/strings.h b/include/strings.h index e5f427abc..ab6ec9ee4 100755 --- a/include/strings.h +++ b/include/strings.h @@ -1,12 +1,8 @@ #ifndef __STRINGS_H #define __STRINGS_H -#ifndef _INC_STRING -#include -#endif - -#ifndef __ARRAY_H -#include +#ifndef __OBJECT_H +#include #endif #define SAFE_PIPE_CHR '¦' @@ -694,77 +690,12 @@ public: { _width = width; } }; -/////////////////////////////////////////////////////////// -// DES TString_array -/////////////////////////////////////////////////////////// - -// @doc EXTERNAL - -// @class TString_array | Array di stringhe -// -// @base public | TArray -class TString_array : public TArray -// @author:(INTERNAL) Guido -{ - // @access Public Member -public: - // @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore) - TToken_string& row(int n) - { return (TToken_string&)operator[](n); } - // @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore) - const TToken_string& row(int n) const - { return (const TToken_string&)operator[](n); } - // @cmember Restituisce il puntatore alla stringa n dell'array (NULL se non esiste) - TToken_string* rowptr(int n) - { return (TToken_string*)objptr(n); } - // @cmember assegnamento di un array - const TString_array& operator=(const TString_array& a); - // @cmember Aggiunge una Token string all'array (chiama ) - int add(TToken_string* s, int n = -1) - { return TArray::add(s, n); } - // @cmember Aggiunge un oggetto stringa all'array (chiama ) - int add(const TToken_string& s, int n = -1); - // @cmember Aggiunge una stringa all'array (chiama ) - int add(const char* s, int n = -1); - // @cmember Cerca una stringa nell'array - int find(const char* s, int from = 0) const; - // @cmember Ordina alfabeticamente l'array - void sort(bool ascendig = true); - - // @cmember Costruttore - TString_array(int size = 8) : TArray(size) - {} - // @cmember Distruttore - virtual ~TString_array() - {} -}; - TString& user(); - TToken_string& get_tmp_string(int len = -1); const TToken_string& empty_string(); #define EMPTY_STRING empty_string() -#define FOR_EACH_ARRAY_ROW(__arr, __r, __riga) \ - TToken_string* __riga; \ - int __r; \ - for (__r = (__arr).first(); \ - (__riga = (TToken_string*)(__arr).objptr(__r)); \ - __r = (__arr).succ(__r)) - -#define FOR_EACH_ARRAY_ROW_BACK(__arr, __r, __riga) \ - TToken_string* __riga; \ - int __r; \ - for (__r = (__arr).last(); \ - (__riga = (TToken_string*)(__arr).objptr(__r)); \ - __r = (__arr).pred(__r)) - -const char SLASH = -#if XVT_OS == XVT_OS_WIN32 -'\\'; -#else -'/'; -#endif +const char SLASH = '\\'; #endif diff --git a/include/text.h b/include/text.h index cb14bdb36..fa8d64de7 100755 --- a/include/text.h +++ b/include/text.h @@ -1,6 +1,10 @@ #ifndef __TEXTFILE_H #define __TEXTFILE_H +#ifndef __ARRAY_H +#include +#endif + #ifndef __STRINGS_H #include #endif diff --git a/include/variant.h b/include/variant.h index 3f1cf749f..07286d574 100755 --- a/include/variant.h +++ b/include/variant.h @@ -9,6 +9,10 @@ #include #endif +#ifndef __STRINGS_H +#include +#endif + #ifndef __RECTYPES_H #include #endif diff --git a/include/window.h b/include/window.h index d4af42000..4dfa4a6a2 100755 --- a/include/window.h +++ b/include/window.h @@ -1,6 +1,10 @@ #ifndef __WINDOW_H #define __WINDOW_H +#ifndef __ARRAY_H +#include +#endif + #ifndef __STRINGS_H #include #endif @@ -20,12 +24,14 @@ WINDOW cur_win(); // @author:(INTERNAL) Guido struct TSize { - // @cmember Coordinate del punto + // @cmember Larghezza ed altezza long x, y; bool operator ==(const TSize& s) const { return s.x == x && s.y == y; } bool operator !=(const TSize& s) const { return s.x != x || s.y != y; } + TSize& operator =(const TSize& s) { x = s.x; y = s.y; return *this; } + TSize() : x(0), y(0) {} TSize(long cx, long cy) : x(cx), y(cy) {} TSize(const TSize& s) : x(s.x), y(s.y) {} diff --git a/include/xml.cpp b/include/xml.cpp index 6406a5c8f..abfc17259 100755 --- a/include/xml.cpp +++ b/include/xml.cpp @@ -518,11 +518,7 @@ void TXmlItem::AsString(TString& str) const { char* buf = str.get_buffer(nSize); memset(buf, 0, nSize); -#ifdef WIN32 ostrstream outf(buf, nSize); -#else - ostringstream outf(buf); -#endif Write(outf, 0); if (buf[nSize-1] == '\0') @@ -538,8 +534,25 @@ void TXmlItem::Save(const char* strFilename) const bool TXmlItem::Load(const char* strFilename) { - ifstream qry(strFilename); - return Read(qry); + bool ok = false; + if (strFilename && *strFilename) + { + if (strncmp(strFilename, "http://", 7) == 0 || strncmp(strFilename, "ftp://", 6) == 0) + { + TFilename tmp; tmp.temp(NULL, "xml"); + xvt_fsys_fcopy(strFilename, tmp); + ifstream qry(tmp); + ok = Read(qry); + qry.close(); + xvt_fsys_remove_file(tmp); + } + else + { + ifstream qry(strFilename); + ok = Read(qry); + } + } + return ok; } static bool FindFirstCallback(TXmlItem& item, long jolly)