Patch level : 2.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@11732 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-01-29 16:23:01 +00:00
parent 05314c3ac4
commit 8cd8fe5fe2

View File

@ -130,18 +130,35 @@ const TString& TTextRecord::GetValue(const TString& name) const
const TXmlItem* f = FindField(name); const TXmlItem* f = FindField(name);
if (f != NULL) if (f != NULL)
return GetFieldValue(*f); return GetFieldValue(*f);
return EMPTY_STRING; return name;
} }
const TString& TTextRecord::Evaluate(TExpression& exp) const const TString& TTextRecord::Evaluate(TExpression& exp) const
{ {
for (int i = exp.numvar()-1; i >= 0; i--) TString& str = (TString&)m_str;
str = exp.string();
if (str.starts_with("BEFORE(AFTER"))
{ {
const TString& name = exp.varname(i); int i = 0;
const TString& value = GetValue(name); i++;
exp.setvar(i, value);
} }
return exp.as_string();
const int nv = exp.numvar();
if (nv > 0)
{
for (int i = nv-1; i >= 0; i--)
{
const TString& name = exp.varname(i);
const TString& value = GetValue(name);
exp.setvar(i, value);
}
str = exp.as_string();
}
else
str = exp.string(); // Nessuna variabile = costante!
return str;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -272,11 +289,17 @@ ofstream& TCasaEditrice::ChooseOutput(const TTextRecord& rec)
TCasaEditrice::TCasaEditrice(const TXmlItem& trc, const char* name) : m_trc(trc), m_exprSuffix(NULL) TCasaEditrice::TCasaEditrice(const TXmlItem& trc, const char* name) : m_trc(trc), m_exprSuffix(NULL)
{ {
const TFilename path(name); const TFilename path(name);
m_strExt = path.ext(); const int dot = path.rfind('.');
m_strPrefix = path.name();
const int dot = m_strPrefix.find('.');
if (dot >= 0) if (dot >= 0)
m_strPrefix.cut(dot); {
m_strPrefix = path.left(dot);
m_strExt = path.mid(dot+1);
}
else
{
m_strPrefix = path;
m_strExt.cut(0);
}
const TXmlItem* pOutFile = m_trc.FindFirst("Output"); const TXmlItem* pOutFile = m_trc.FindFirst("Output");
CHECK(pOutFile, "NULL Output tag"); CHECK(pOutFile, "NULL Output tag");