From e580a22a672c46a12db3217180e677ff76b04829 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 2 Mar 2010 11:23:20 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20level=20=20=20=20=20=20=20=20=20:=2010.?= =?UTF-8?q?0=20Files=20correlati=20=20=20=20=20:=20agalib,=20mg3=20Ricompi?= =?UTF-8?q?lazione=20Demo=20:=20[=20]=20Commento=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20:=200001561:=20002177=20Pharmatex=20-=20excel=20da?= =?UTF-8?q?=20mastrini=20Con=20la=20patch=20634=20l'esportazione=20mastrin?= =?UTF-8?q?i=20in=20excell=20non=20ha=20pi=C3=B9=20l'intestazione=20colonn?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.65.10.50/trunk@20177 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/about.cpp | 12 ++++--- include/config.cpp | 4 +-- include/config.h | 2 +- include/dongle.cpp | 6 ++-- include/isamrpc.cpp | 79 ++++++++++++++++++++++++++------------------- include/mailbox.cpp | 21 +----------- include/mailbox.h | 7 +--- include/netsock.cpp | 31 +++++++++--------- include/recset.cpp | 57 ++++++++++++++++++++++---------- include/sheet.cpp | 56 +++++++++++++++++++++++--------- include/utility.cpp | 12 +++++-- include/xml.cpp | 26 +++++++++++++-- include/xml.h | 1 + 13 files changed, 188 insertions(+), 126 deletions(-) diff --git a/include/about.cpp b/include/about.cpp index 5f61fa6f1..e0a26bb10 100755 --- a/include/about.cpp +++ b/include/about.cpp @@ -382,18 +382,20 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) add_prop(TR("Valuta"), f.codice_valuta()); } else - { add_prop(TR("Ragione Sociale"), campoini.get("Company")); - } add_cat(TR("Dati Stazione")); add_prop(TR("Sistema Operativo"), stros); add_prop(TR("Utente"), user()); add_prop(TR("Computer"), strcpu); + TString16 strfree; const long mbfree = xvt_fsys_get_disk_free_space(study, 'M'); - TString16 strmb; strmb.format("%ld Mb", mbfree); - add_prop(TR("Spazio su disco"), strmb); + if (mbfree > 8192) + strfree.format("%ld Gb", mbfree/1024); + else + strfree.format("%ld Mb", mbfree); + add_prop(TR("Spazio su disco"), strfree); add_prop(TR("File temporanei"), temp); TString printer; @@ -420,7 +422,7 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni")) add_prop(TR("Libreria GUI"), strwx); add_prop(TR("Libreria PDF"), printer); add_prop(TR("Libreria SQL"), strsql); -#ifdef WIN32 +#ifdef _MSC_VER add_prop(TR("Libreria C++"), format("%d %d.%d", _MSC_VER/100, _MSC_VER%100/10, _MSC_VER%10)); #endif diff --git a/include/config.cpp b/include/config.cpp index 2312f348d..53165353a 100755 --- a/include/config.cpp +++ b/include/config.cpp @@ -895,9 +895,9 @@ bool ini_set_bool(int cfg, const char* paragraph, const char* name, bool val, in return ini_set_string(filename, paragraph, name, val ? "1" : "0", idx); } -const TString& get_oem_info(const char* varname) +const TString& get_oem_info(const char* varname, const char* def) { TString& tmp = get_tmp_string(50); - xvt_sys_get_oem_string(varname, tmp, tmp.get_buffer(), tmp.size()); + xvt_sys_get_oem_string(varname, def, tmp.get_buffer(), tmp.size()); return tmp; } diff --git a/include/config.h b/include/config.h index e978037bb..5fe15c5c1 100755 --- a/include/config.h +++ b/include/config.h @@ -192,7 +192,7 @@ bool ini_set_bool (int cfg, const char* para, const char* name, bool bool ini_set_int (int cfg, const char* para, const char* name, int val, int idx = -1); bool ini_set_string(int cfg, const char* para, const char* name, const char* val, int idx = -1); -const TString& get_oem_info(const char* varname); // ini_get_string(CONFIG_OEM, "OEM_?", varname); +const TString& get_oem_info(const char* varname, const char* defval = ""); // ini_get_string(CONFIG_OEM, "OEM_?", varname, defval); bool is_aga_version(bool power_user_only = false); #endif diff --git a/include/dongle.cpp b/include/dongle.cpp index 579790b1c..304a0b19f 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -469,10 +469,10 @@ int TDongle::can_try_server() const // Se sono un client ed ho l'indirizzo di authoriz sono obbligato ad usarlo const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle"); - if (dongle.full() && ini_get_int(CONFIG_INSTALL, "Main", "Type") == 3) - return 3; + if (dongle.full()) + return ini_get_int(CONFIG_INSTALL, "Main", "Type") == 3 ? 3 : 1; - return dongle.full(); + return false; } bool TDongle::login(bool test_all_keys) diff --git a/include/isamrpc.cpp b/include/isamrpc.cpp index 72f43a768..d8d9e8dad 100755 --- a/include/isamrpc.cpp +++ b/include/isamrpc.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -18,7 +18,7 @@ bool rpc_Start() { delete _client; _client = NULL; - ok = error_box("Errore di inizializzazione del socket client."); + ok = error_box(TR("Errore di inizializzazione del socket client.")); } } return ok; @@ -64,7 +64,7 @@ char* rpc_Request(const char* cmd, size_t& size, real& total) static TString _rpc_call(256); static TString _rpc_string; -inline bool BoolCall() +static bool BoolCall() { CHECK(_connection, "Server not connected"); bool yes = false; @@ -79,11 +79,19 @@ inline bool BoolCall() return yes; } -inline long IntCall() +static long IntCall(int timeout = 0) { CHECK(_connection, "Server not connected"); - long n; - bool ok = _client->RequestInteger(_connection, _rpc_call, n) != 0; + long n = 0; + bool ok = false; + if (timeout > 0) + { + const int to = rpc_Timeout(timeout); + ok = _client->RequestInteger(_connection, _rpc_call, n) != 0; + rpc_Timeout(to); + } + else + ok = _client->RequestInteger(_connection, _rpc_call, n) != 0; if (!ok) { #ifndef DBG @@ -94,7 +102,7 @@ inline long IntCall() return n; } -inline TString& StrCall() +static TString& StrCall() { CHECK(_connection, "Server not connected"); bool ok = _client->RequestString(_connection, _rpc_call, _rpc_string) != 0; @@ -108,67 +116,67 @@ inline TString& StrCall() return _rpc_string; } -inline bool BoolCallInt(const char* fn, long n) +static bool BoolCallInt(const char* fn, long n) { _rpc_call.format("%s(%ld)", fn, n); return BoolCall(); } -inline long IntCallInt(const char* fn, long n) +static long IntCallInt(const char* fn, long n) { _rpc_call.format("%s(%ld)", fn, n); return IntCall(); } -inline long IntCallIntInt(const char* fn, long n, long k) +static long IntCallIntInt(const char* fn, long n, long k) { _rpc_call.format("%s(%ld,%ld)", fn, n, k); return IntCall(); } -inline long IntCallIntIntInt(const char* fn, long n, long k, long f) +static long IntCallIntIntInt(const char* fn, long n, long k, long f) { _rpc_call.format("%s(%ld,%ld,%ld)", fn, n, k, f); return IntCall(); } -inline long IntCallIntIntStr(const char* fn, long n, long k, const char* str) +static long IntCallIntIntStr(const char* fn, long n, long k, const char* str) { _rpc_call.format("%s(%ld,%ld,|%s|)", fn, n, k, str); return IntCall(); } -inline long IntCallIntStr(const char* fn, long n, const char* str) +static long IntCallIntStr(const char* fn, long n, const char* str) { _rpc_call.format("%s(%ld,|%s|)", fn, n, str); return IntCall(); } -inline int IntCallIntStrInt(const char* fn, long n, const char* s, long f) +static int IntCallIntStrInt(const char* fn, long n, const char* s, long f) { _rpc_call.format("%s(%ld,|%s|,%ld)", fn, n, s, f); return (int)IntCall(); } -inline long IntCallIntStrStr(const char* fn, long n, const char* str, const char* val) +static long IntCallIntStrStr(const char* fn, long n, const char* str, const char* val) { _rpc_call.format("%s(%ld,|%s|,|%s|)", fn, n, str, val); return IntCall(); } -inline long IntCallStr(const char* fn, const char* str) +static long IntCallStr(const char* fn, const char* str) { _rpc_call.format("%s(%s)", fn, str); return IntCall(); } -inline TString& StrCallIntInt(const char* fn, long n, long k) +static TString& StrCallIntInt(const char* fn, long n, long k) { _rpc_call.format("%s(%ld,%ld)", fn, n, k); return StrCall(); } -inline TString& StrCallIntStr(const char* fn, long n, const char* str) +static TString& StrCallIntStr(const char* fn, long n, const char* str) { _rpc_call.format("%s(%ld,|%s|)", fn, n, str); return StrCall(); @@ -206,13 +214,13 @@ bool rpc_DongleModules(TBit_array& ba) unsigned rpc_DongleNumber() { _rpc_call = "DongleNumber()"; - return (unsigned)IntCall(); + return (unsigned)IntCall(5); } unsigned rpc_DongleYear() { _rpc_call = "DongleYear()"; - return (unsigned)IntCall(); + return (unsigned)IntCall(5); } bool rpc_DongleInfo(word& number, word& year, TBit_array& ba) @@ -247,7 +255,7 @@ bool rpc_DongleInfo(word& number, word& year, TBit_array& ba) } -static unsigned int CreatePassword(TString& pass) +static unsigned int create_password(TString& pass) { const int BASE = 19; unsigned int num = 0; @@ -286,7 +294,11 @@ bool rpc_UserLogin(const char* server, const char* user, const bool local = server == NULL || *server == '\0' || xvt_str_compare_ignoring_case(server, "127.0.0.1") == 0 || xvt_str_compare_ignoring_case(server, "localhost") == 0; - const TString name = local ? "locale" : server; + TString80 name; + if (local) + xvt_sys_get_host_name(name.get_buffer(), name.size()); + else + name = server; if (_connection != 0) _client->RemoveConnection(_connection); @@ -297,8 +309,7 @@ bool rpc_UserLogin(const char* server, const char* user, if (_connection) { TString16 password; - - CreatePassword(password); + create_password(password); const int session = xvt_sys_get_session_id(); _rpc_call.format("UserLogin(%s,%s,%s,%d)", user, (const char*)password, application, session); @@ -310,14 +321,14 @@ bool rpc_UserLogin(const char* server, const char* user, const bool logged = (answer == 1) || ((answer % 883 == 0) && (answer != 0)); if (!logged) { - connected = FALSE; - error.format("La connessione di %s e' stata rifiutata dal Server %s", + connected = false; + error.format(FR("La connessione di %s e' stata rifiutata dal Server %s"), (const char*)user, (const char*)name); } } else { - error.format("Impossibile connettersi al Server %s", (const char*)name); + error.format(FR("Impossibile connettersi al Server %s"), (const char*)name); } if (!connected) @@ -329,7 +340,7 @@ bool rpc_UserLogin(const char* server, const char* user, else { if (!local) - error.format("Impossibile connettersi al Server %s", (const char*)name); + error.format(FR("Impossibile connettersi al Server %s"), (const char*)name); } if (error.not_empty()) @@ -358,7 +369,7 @@ bool http_isredirected_server(TString& server, { TSocketClient client; if (!client.IsOk()) - return error_box("Impossibile inizializzare il client HTTP"); + return error_box(TR("Impossibile inizializzare il client HTTP")); CONNID connection = client.QueryConnection("80", server); bool ok = connection != 0; @@ -375,7 +386,7 @@ bool http_get(const char* server, const char* remote_file, const char* local_fil { TSocketClient client; if (!client.IsOk()) - return error_box("Impossibile inizializzare il client HTTP"); + return error_box(TR("Impossibile inizializzare il client HTTP")); CONNID connection = client.QueryConnection("80", server); bool ok = connection != 0; @@ -392,7 +403,7 @@ bool http_dir(const char* server, const char* remote_dir, TString_array& list) { TSocketClient client; if (!client.IsOk()) - return error_box("Impossibile inizializzare il client HTTP"); + return error_box(TR("Impossibile inizializzare il client HTTP")); unsigned long connection = client.QueryConnection("80", server); bool ok = connection != 0; @@ -412,7 +423,7 @@ bool http_post(const char* server, const char* remote_file, { TSocketClient client; if (!client.IsOk()) - return error_box("Impossibile inizializzare il client HTTP"); + return error_box(TR("Impossibile inizializzare il client HTTP")); unsigned long connection = client.QueryConnection("80", server); bool ok = connection != 0; @@ -424,12 +435,12 @@ bool http_post(const char* server, const char* remote_file, if (!ok) { - error_box("Impossibile spedire il file %s al server %s:\n%s", + error_box(FR("Impossibile spedire il file %s al server %s:\n%s"), local_file, server, answer); } } else - return error_box("Impossibile connettersi al server %s", server); + return error_box(FR("Impossibile connettersi al server %s"), server); return ok; } diff --git a/include/mailbox.cpp b/include/mailbox.cpp index bed7d98ab..fac3f7b54 100755 --- a/include/mailbox.cpp +++ b/include/mailbox.cpp @@ -177,25 +177,6 @@ void TMailbox::send(TMessage& m) fto.close(); } -void TMailbox::sendcmd(int argc, char* argv[], char* to) -{ - NFCHECK("MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED"); - for (int i = 0; i < argc; i++) - { - // parse argv[i] - // create new message - // send it out - } -} - -char* TMailbox::readcmd(char*) -{ - // filters all messages to recipient and adds to to_path - NFCHECK("MAILBOX::COMMANDLINE INTERFACE NOT IMPLEMENTED"); - // TMessage* m; - return "NOT YET IMPLEMENTED"; -} - TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY) { if (appname == NULL) @@ -206,7 +187,7 @@ TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY) _lastread =0; _lastpos = 0l; n_new = 0; - this->reread(); + reread(); restart(); } diff --git a/include/mailbox.h b/include/mailbox.h index 3be6d406a..1ebeccfb0 100755 --- a/include/mailbox.h +++ b/include/mailbox.h @@ -105,7 +105,7 @@ class TMailbox : public TObject // @cmember:(INTERNAL) Numero di messaggi in attesa di lettura int n_new; // @cmember:(INTERNAL) Posizione nel file dell'ultimo messaggio letto - long _lastpos; + streamoff _lastpos; // @cmember:(INTERNAL) Indice dei messaggi letti e non letti int _cnt; @@ -140,11 +140,6 @@ public: TMessage* next_f(char* f, bool read = FALSE); // @cmember Manda un messaggio void send(TMessage& m); - // @cmember Trasforma gli argomenti della command line in messaggi mail (NON IMPLEMENTATA) - void sendcmd(int argc, char* argv[],char* to); - // @cmember Trasforma una mailbox in parametri per la command line per la - // chaimata di applicazioni non compilanti (NON IMPLEMENTATA) - char* readcmd(char* to = NULL); // @cmember Ritorna l'

-esimo messaggio TMessage* get(int n) { return (TMessage*)_msgs.objptr(n); } diff --git a/include/netsock.cpp b/include/netsock.cpp index 1451a0f01..ae66a4d0a 100755 --- a/include/netsock.cpp +++ b/include/netsock.cpp @@ -594,30 +594,29 @@ bool TSocket_connection::Read(byte* buf, size_t size) bool TSocket_connection::ReadTimeout(byte* buf, size_t size, int timeout) { - return Read(buf, size); - -/* Non va micca if (timeout <= 0) return Read(buf, size); skstream* calza = GetSocket(); bool ok = calza != NULL && calza->good(); if (ok) { - SOCKET s = calza->getsocket(); - - // Set new timeout - struct timeval tv; memset(&tv, 0, sizeof(tv)); tv.tv_sec = timeout; - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv, sizeof(tv)); - - calza->read((char*)buf, size); - ok = calza->gcount() == size; - - // Reset old timeout - memset(&tv, 0, sizeof(tv)); - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv, sizeof(tv)); + clock_t cWaited = 0; // msec waited so far + clock_t cToWait = 67; // next time slice to wait 67+134+268+536=1005 + ok = false; + while (!ok && cWaited < timeout*1000) + { + xvt_sys_sleep(cToWait); // wait a bit + cWaited += cToWait; // increment waited time + cToWait = min(cToWait*2, 1000); // compute next waiting slice + ok = ::recv(calza->getsocket(), (char*)buf, 1, MSG_PEEK)>0; // Peek for incoming data + } + if (ok) + { + calza->read((char*)buf, size); + ok = calza->gcount() == size; + } } return ok; - */ } bool TSocket_connection::connect() diff --git a/include/recset.cpp b/include/recset.cpp index 550261967..5e571be06 100755 --- a/include/recset.cpp +++ b/include/recset.cpp @@ -2,6 +2,8 @@ #include #include +#include +#include #include #include #include @@ -93,29 +95,42 @@ const TToken_string& TRecordset::sheet_head() const return h; } + bool TRecordset::save_as_html(const char* path) { TProgind pi(items(), TR("Esportazione in corso..."), true, true); ofstream out(path); out << "" << endl; + save_html_head(out, main_app().title()); out << "" << endl; TString qry; parsed_text(qry); - for (int i = qry.find('\n'); i > 0; i = qry.find('\n', i+1)) - qry.insert("
", i+1); + if (qry.full()) + { + for (int i = qry.find('\n'); i > 0; i = qry.find('\n', i+1)) + qry.insert("
", i+1); + out << "

" << qry << "

" << endl; + } - out << "

" << qry << "

" << endl; - - out << "" << endl; + out << "
"; + out << " " << endl; const unsigned int cols = columns(); if (cols > 0) { - out << " "; + out << " " << endl; for (unsigned int c = 0; c < cols; c++) { const TRecordset_column_info& ci = column_info(c); - TToken_string header(ci._name, '.'); + out << " " << endl; + } + out << " " << endl; + for (unsigned int c = 0; c < cols; c++) + { + const TRecordset_column_info& ci = column_info(c); + TToken_string header(ci._name, '\n'); TString str; FOR_EACH_TOKEN(header, tok) { @@ -123,35 +138,43 @@ bool TRecordset::save_as_html(const char* path) str << "
"; str << tok; } - out << " " << endl; + out << " " << endl; } + out << " " << endl; out << " " << endl; } + out << " " << endl; TString val; for (bool ok = move_first(); ok; ok = move_next()) { if (!pi.addstatus(1)) break; - out << " " << endl; + out << " " << endl; for (unsigned int c = 0; c < cols; c++) { const TRecordset_column_info& ci = column_info(c); - out << " "; if (ci._type == _longfld || ci._type == _realfld) - out << " align=\"right\""; - out << ">"; - get(c).as_string(val); - if (!val.blank()) + { + const real r = get(c).as_real(); + if (r.is_zero()) + val.cut(0); + else + val = r.stringe(); + } + else + get(c).as_string(val); + if (val.full()) { val.rtrim(); out << val; } - out << " " << endl; + out << "" << endl; } - out << " " << endl; + out << " " << endl; } - + out << " " << endl; out << "
" << main_app().title() << "
" << str << "" << str << "
" << endl; out << "" << endl; out << "" << endl; diff --git a/include/sheet.cpp b/include/sheet.cpp index 32891044f..bbeb1165e 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -6,11 +6,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include /////////////////////////////////////////////////////////// @@ -208,7 +210,7 @@ TSheet_control::TSheet_control( rct.top, rct.left, rct.bottom-rct.top, XI_ATR_ENABLED | XI_ATR_VISIBLE | XI_ATR_NAVIGATE, NORMAL_COLOR, NORMAL_BACK_COLOR, // normal - NORMAL_COLOR, DISABLED_BACK_COLOR, // disabled + DISABLED_COLOR, DISABLED_BACK_COLOR, // disabled FOCUS_COLOR, // active 0); @@ -1346,8 +1348,8 @@ bool TSheet::export_handler(TMask_field& f, KEY k) if (k == K_SPACE) { TSheet& s = (TSheet&)f.mask(); - TString cap; s.get_caption(cap); - for (char* buf = cap.get_buffer(); *buf; buf++) + TString caption; s.get_caption(caption); + for (char* buf = caption.get_buffer(); *buf; buf++) { switch (*buf) { @@ -1360,47 +1362,69 @@ bool TSheet::export_handler(TMask_field& f, KEY k) default : break; } } - cap.strip_spaces(); - if (cap.blank()) - cap = "export"; + if (caption.blank()) + caption = main_app().title(); + + TString cap = caption; cap.strip_spaces(); TFilename name; name.tempdir(); name.add(cap); name.ext("xls"); if (name.full()) // Dummy test { ofstream xls(name); - const char sep = '\t'; - TToken_string tab(128, sep); - TString str; + xls << "" << endl; + save_html_head(xls, caption); + xls << "" << endl; + xls << " " << endl; + xls << " " << endl; + xls << " " << endl; int columns = 0; XI_OBJ** pcols = xi_get_member_list(s._sheet->xi_object(), &columns); + + for (int c = 1; c < columns; c++) + { + const int idx = pcols[c]->cid - 1101; + const char ct = s._sheet->column_type(idx); + xls << " " << endl; + } + + xls << " " << endl; + + TString str; for (int c = 1; c < columns; c++) { xi_get_text(pcols[c], str.get_buffer(), str.size()); - tab.add(clean_white_space(str)); + xls << " " << endl; } - xls << tab << endl; - + xls << " " << endl; + xls << " " << endl; + xls << " " << endl; for (long i = 0; i < s.items(); i++) { const TToken_string& r = s.row(i); - tab.cut(0); + xls << " " << endl; for (int c = 1; c < columns; c++) { + xls << " " << endl; } - xls << tab << endl; + xls << " " << endl; } + xls << " " << endl; + xls << "
" << caption << "
" << clean_white_space(str) << "
"; const int idx = pcols[c]->cid - 1101; r.get(idx, str); clean_white_space(str); - if (str.not_empty()) + if (str.full()) { const char ct = s._sheet->column_type(idx); if (ct == 'P' || ct == 'V') xvt_str_number_format(str.get_buffer(), str.size()); - tab.add(str, c-1); + xls << str; } + xls << "
" << endl; + xls << "" << endl; + xls << "" << endl; } if (name.exist()) xvt_sys_goto_url(name, "open"); diff --git a/include/utility.cpp b/include/utility.cpp index 7ad5cabd0..23730338e 100755 --- a/include/utility.cpp +++ b/include/utility.cpp @@ -603,10 +603,12 @@ bool is_power_reseller(bool power_user_only) bool expand_sys_vars(TString& str) { bool found = false; - for (int i = str.find("$("); i >= 0; i = str.find("$(")) - { - TString value; + TString value(_MAX_PATH); + int i = 0; + while ((i = str.find("$(")) >= 0) + { + value.cut(0); int j = str.find(')', i); if (j < 0) j = i+2; const TString& name = str.sub(i+2, j); @@ -618,6 +620,10 @@ bool expand_sys_vars(TString& str) { value = user(); } else + if (name.compare("LoginName", -1, true) == 0) + { + xvt_sys_get_user_name(value.get_buffer(), value.len()); + } else if (name.compare("Session", -1, true) == 0) { value << xvt_sys_get_session_id(); diff --git a/include/xml.cpp b/include/xml.cpp index fd746448c..c0518e286 100755 --- a/include/xml.cpp +++ b/include/xml.cpp @@ -1,8 +1,9 @@ -#include "real.h" -#include "xml.h" +#include +#include +#include +#include #include -#include /////////////////////////////////////////////////////////// // Utilities @@ -107,6 +108,13 @@ void WriteXmlString(ostream& outf, const char* str) } } +void WriteXmlColor(ostream& out, COLOR rgb) +{ + TString8 str; + str.format("#%02X%02X%02X", XVT_COLOR_GET_RED(rgb), XVT_COLOR_GET_GREEN(rgb), XVT_COLOR_GET_BLUE(rgb)); + out << str; +} + /////////////////////////////////////////////////////////// // TXmlAttr /////////////////////////////////////////////////////////// @@ -575,3 +583,15 @@ TXmlItem::~TXmlItem() delete m_Children; } +void save_html_head(ostream& out, const char* title) +{ + out << "" << endl; + out << " " << title << "" << endl; + out << " " << endl; + out << " " << endl; + out << " " << endl; + out << " " << endl; + out << "" << endl; +} diff --git a/include/xml.h b/include/xml.h index 525f1cd48..0308ca069 100755 --- a/include/xml.h +++ b/include/xml.h @@ -79,6 +79,7 @@ TXmlItem& operator<<(TXmlItem& item, const char* str); void Spaces(ostream& outf, int nSpaces); void WriteXmlString(ostream& outf, const char* str); int hex2int(const char* str); +void save_html_head(ostream& out, const char* title); #endif