Modifiche dalla versione Linux sulla 2.1

git-svn-id: svn://10.65.10.50/trunk@11848 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2004-03-12 23:41:28 +00:00
parent 1d697528db
commit 4370098e6f
4 changed files with 30 additions and 5 deletions

View File

@ -970,7 +970,7 @@ void TPrint_application::set_row (
#ifdef __LONGDOUBLE__
sprintf (q.get_buffer(), formato, (long double)rrr);
#else
rrr.sprintf(q.get_buffer(), (char*)(const char*)formato);
q = rrr.format(formato);
#endif
}
if (rrr.is_zero () && !_print_zero)
@ -1484,7 +1484,7 @@ bool TPrint_application::print_one (
#ifdef __LONGDOUBLE__
sprintf(ps.get_buffer(), fff, (long double)rrr);
#else
rrr.sprintf(ps.get_buffer(), (char*)fff);
ps = rrr.format(fff);
#endif
}
if (rrr.is_zero () && !_print_zero)

View File

@ -1579,6 +1579,18 @@ const char* real::string(const char *picture) const
return f;
}
// Certified 50%
const char* real::format(const char *picture) const
{
if (*picture == '\0')
return string ();
TString& f = get_tmp_string();
dsprintf((char *)(const char *) f, (char *) picture, ptr());
return f;
}
// Certified 99%
const char* real::stringa (int len, int dec, char pad) const
{

View File

@ -206,7 +206,9 @@ public:
const char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
// @cmember Ritorna la stringa con il formato passato
const char* string(const char* picture) const;
// @cmember Ritorna la stringa con il formato passato
const char* real::format(const char *picture) const;
// @cmember Ritorna la precisione del reale (numero di decimali)
int precision() const;
// @cmember Controlla se si tratta di un reale uguale 0 (TRUE se 0)

View File

@ -1,8 +1,12 @@
#include "real.h"
#include "xml.h"
#ifdef WIN32
#include <fstream.h>
#include <strstrea.h>
#else
#include <incstr.h>
#endif
///////////////////////////////////////////////////////////
// Utilities
@ -417,8 +421,10 @@ void TXmlItem::Write(ostream& outf, int tab) const
}
if (GetChildren() > 0)
{
int n;
outf << '>';
for (int n = 0; ; n++)
for (n = 0; ; n++)
{
TXmlItem* c = GetChild(n);
if (c == NULL)
@ -444,7 +450,12 @@ 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')
break;
@ -486,7 +497,7 @@ TXmlItem* TXmlItem::FindFirst(const char* strTag) const
}
TXmlItem::TXmlItem()
: m_strTag(15), m_Attributes(NULL), m_Children(NULL), m_strText(NULL)
: m_strTag(15), m_strText(NULL), m_Attributes(NULL), m_Children(NULL)
{ }
TXmlItem::~TXmlItem()