Patch level : 2.1 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento : Roba utile ai nuovi report git-svn-id: svn://10.65.10.50/trunk@11943 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
eb544f8aef
commit
e0a0ba645b
@ -731,9 +731,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
|||||||
break;
|
break;
|
||||||
case CONFIG_GUI:
|
case CONFIG_GUI:
|
||||||
{
|
{
|
||||||
TFilename gui = CGetCampoIni();
|
const TFilename ini = CGetCampoIni();
|
||||||
gui.rtrim(9);
|
TFilename gui = ini.path(); gui.add("gui.ini");
|
||||||
gui << "gui.ini";
|
|
||||||
bool ok = gui.exist();
|
bool ok = gui.exist();
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
|
@ -45,11 +45,14 @@ bool real::is_real (const char *s)
|
|||||||
const long double n = _atold(s);
|
const long double n = _atold(s);
|
||||||
if (n == 0.0)
|
if (n == 0.0)
|
||||||
{
|
{
|
||||||
for(; *s; s++) if (*s != '0' && *s != ' ' && *s != '.')
|
for(; *s; s++)
|
||||||
return FALSE;
|
{
|
||||||
|
if (strchr("0. ", *s) == NULL)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
real::real (const char *s)
|
real::real (const char *s)
|
||||||
|
@ -53,6 +53,18 @@ const TString& EscapeSequence(char cStart, istream& inf)
|
|||||||
{
|
{
|
||||||
for (char c = inf.get(); c != ';'; c = inf.get())
|
for (char c = inf.get(); c != ';'; c = inf.get())
|
||||||
str << c;
|
str << c;
|
||||||
|
if (str[0] == '#')
|
||||||
|
{
|
||||||
|
str[0] = hex2int((const char*)str+1);
|
||||||
|
str[1] = '\0';
|
||||||
|
} else
|
||||||
|
if (str[0] >= '0' && str[0] <= '9')
|
||||||
|
{
|
||||||
|
str[0] = atoi(str);
|
||||||
|
str[1] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (str == "lt") return str ="<";
|
if (str == "lt") return str ="<";
|
||||||
if (str == "gt") return str =">";
|
if (str == "gt") return str =">";
|
||||||
if (str == "nbsp") return str =" ";
|
if (str == "nbsp") return str =" ";
|
||||||
@ -71,13 +83,7 @@ const TString& EscapeSequence(char cStart, istream& inf)
|
|||||||
|
|
||||||
const char tmp[2] = { cStart, '\0' };
|
const char tmp[2] = { cStart, '\0' };
|
||||||
str.insert(tmp);
|
str.insert(tmp);
|
||||||
} else
|
}
|
||||||
if (cStart == '%')
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 2; i++)
|
|
||||||
str << inf.get();
|
|
||||||
char c = hex2int(str);
|
|
||||||
str = c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@ -87,11 +93,11 @@ void WriteXmlString(ostream& outf, const char* str)
|
|||||||
{
|
{
|
||||||
for (int i = 0; str[i]; i++)
|
for (int i = 0; str[i]; i++)
|
||||||
{
|
{
|
||||||
char c = str[i];
|
const char c = str[i];
|
||||||
if (c < 0 || strchr("<>/&", c) != NULL)
|
if ((c < ' ' && c != '\n' && c != '\r') || strchr("<>/&", c) != NULL)
|
||||||
{
|
{
|
||||||
unsigned int n = (unsigned char)c;
|
const unsigned int n = (unsigned char)c;
|
||||||
TString8 tmp; tmp.format("%%%02X", n);
|
TString8 tmp; tmp.format("&#%02X;", n);
|
||||||
tmp.print_on(outf);
|
tmp.print_on(outf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -204,6 +210,8 @@ bool TXmlItem::GetWord(istream& inf, TString& str) const
|
|||||||
str << char(cFirstChar);
|
str << char(cFirstChar);
|
||||||
if (strchr("<=/>", cFirstChar) != NULL)
|
if (strchr("<=/>", cFirstChar) != NULL)
|
||||||
return true; // Simboli terminali
|
return true; // Simboli terminali
|
||||||
|
if (cFirstChar == '&')
|
||||||
|
str = EscapeSequence(cFirstChar, inf);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!inf.eof())
|
while (!inf.eof())
|
||||||
@ -226,6 +234,9 @@ bool TXmlItem::GetWord(istream& inf, TString& str) const
|
|||||||
inf.putback(char(c));
|
inf.putback(char(c));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (c == '&')
|
||||||
|
str << EscapeSequence(c, inf);
|
||||||
|
else
|
||||||
str << char(c);
|
str << char(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,6 +252,7 @@ int TXmlItem::ReadTag(istream& inf)
|
|||||||
if (str[0] != '<') // No tag = sequence of words
|
if (str[0] != '<') // No tag = sequence of words
|
||||||
{
|
{
|
||||||
bool bFirstChar = true;
|
bool bFirstChar = true;
|
||||||
|
|
||||||
while (!inf.eof())
|
while (!inf.eof())
|
||||||
{
|
{
|
||||||
char c = inf.get();
|
char c = inf.get();
|
||||||
@ -254,7 +266,7 @@ int TXmlItem::ReadTag(istream& inf)
|
|||||||
str << ' ';
|
str << ' ';
|
||||||
bFirstChar = false;
|
bFirstChar = false;
|
||||||
}
|
}
|
||||||
if (c == '&' || c == '#' || c == '%')
|
if (c == '&')
|
||||||
str << EscapeSequence(c, inf);
|
str << EscapeSequence(c, inf);
|
||||||
else
|
else
|
||||||
str << c;
|
str << c;
|
||||||
@ -429,9 +441,7 @@ void TXmlItem::Write(ostream& outf, int tab) const
|
|||||||
TAssoc_array& ass = *m_Attributes;
|
TAssoc_array& ass = *m_Attributes;
|
||||||
FOR_EACH_ASSOC_OBJECT(ass, h, k, a)
|
FOR_EACH_ASSOC_OBJECT(ass, h, k, a)
|
||||||
{
|
{
|
||||||
outf << ' ';
|
outf << ' ' << k << '=';
|
||||||
outf.write(k, strlen(k));
|
|
||||||
outf << '=';
|
|
||||||
const TXmlAttr* attr = (const TXmlAttr*)a;
|
const TXmlAttr* attr = (const TXmlAttr*)a;
|
||||||
attr->Write(outf);
|
attr->Write(outf);
|
||||||
}
|
}
|
||||||
@ -458,7 +468,9 @@ void TXmlItem::Write(ostream& outf, int tab) const
|
|||||||
outf << ' ' << '/' << '>';
|
outf << ' ' << '/' << '>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GetText().print_on(outf);
|
{
|
||||||
|
WriteXmlString(outf, GetText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TXmlItem::AsString(TString& str) const
|
void TXmlItem::AsString(TString& str) const
|
||||||
@ -513,6 +525,18 @@ TXmlItem* TXmlItem::FindFirst(const char* strTag) const
|
|||||||
return ((TXmlItem*)this)->ForEach(FindFirstCallback, (long)strTag);
|
return ((TXmlItem*)this)->ForEach(FindFirstCallback, (long)strTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TXmlItem* TXmlItem::FindFirstChild(const char* strTag) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < GetChildren(); i++)
|
||||||
|
{
|
||||||
|
TXmlItem* c = GetChild(i);
|
||||||
|
if (c->GetTag() == strTag)
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TXmlItem::TXmlItem()
|
TXmlItem::TXmlItem()
|
||||||
: m_strTag(15), m_strText(NULL), m_Attributes(NULL), m_Children(NULL)
|
: m_strTag(15), m_strText(NULL), m_Attributes(NULL), m_Children(NULL)
|
||||||
{ }
|
{ }
|
||||||
|
@ -68,7 +68,8 @@ public:
|
|||||||
bool Load(const char* strFilename);
|
bool Load(const char* strFilename);
|
||||||
|
|
||||||
TXmlItem* ForEach(XmlItemCallback cb, long jolly = 0);
|
TXmlItem* ForEach(XmlItemCallback cb, long jolly = 0);
|
||||||
TXmlItem* FindFirst(const char* strTag) const;
|
TXmlItem* FindFirst(const char* strTag) const; // Recursive
|
||||||
|
TXmlItem* FindFirstChild(const char* strTag) const; // First level only
|
||||||
|
|
||||||
TXmlItem();
|
TXmlItem();
|
||||||
~TXmlItem();
|
~TXmlItem();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user