Starting
This commit is contained in:
95
CobXmlSupport/qualifieldhlp.cs
Normal file
95
CobXmlSupport/qualifieldhlp.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CobXmlSupport
|
||||
{
|
||||
public class qualifieldhlp
|
||||
{
|
||||
private CobRow qualifiedRow;
|
||||
private List<CobRow> qualRows;
|
||||
private Dictionary<string, string> locIndexis;
|
||||
private string qfhCode;
|
||||
|
||||
public qualifieldhlp()
|
||||
{
|
||||
qualifiedRow = null;
|
||||
initQualifieldhlp();
|
||||
}
|
||||
|
||||
private void initQualifieldhlp()
|
||||
{
|
||||
qualRows = null;
|
||||
qfhCode = string.Empty;
|
||||
locIndexis = null;
|
||||
}
|
||||
|
||||
public qualifieldhlp(CobRow actRow, Dictionary<string, string> all_Inds)
|
||||
{
|
||||
initQualifieldhlp();
|
||||
qualifiedRow = actRow;
|
||||
initQualRows(ref all_Inds);
|
||||
generateFieldCode();
|
||||
}
|
||||
|
||||
public void generateFieldCode()
|
||||
{
|
||||
if (qualRows.Count > 0)
|
||||
{
|
||||
qfhCode = "";
|
||||
foreach (CobRow localCobRow in qualRows)
|
||||
{
|
||||
if (qfhCode.Length > 0)
|
||||
{
|
||||
qfhCode += " OF ";
|
||||
}
|
||||
qfhCode += localCobRow.FieldName;
|
||||
if (localCobRow.isOccurs)
|
||||
{
|
||||
string tmpInd;
|
||||
locIndexis.TryGetValue(localCobRow.FieldName, out tmpInd);
|
||||
qfhCode += " *> ( " + tmpInd + " )";
|
||||
}
|
||||
qfhCode += "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initQualRows(ref Dictionary<string, string> allInds)
|
||||
{
|
||||
CobRow tmpRow = qualifiedRow;
|
||||
if (qualRows == null)
|
||||
{
|
||||
qualRows = new List<CobRow>();
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
if (tmpRow.isOccurs)
|
||||
{
|
||||
if (locIndexis == null) locIndexis = new Dictionary<string, string>();
|
||||
string indVarName = "";
|
||||
if (!allInds.TryGetValue(tmpRow.FieldName, out indVarName))
|
||||
{
|
||||
indVarName = CobRow.checkLongNames(tmpRow.FieldName, 25) + "_ind";
|
||||
allInds.Add(tmpRow.FieldName, indVarName);
|
||||
}
|
||||
locIndexis.Add(tmpRow.FieldName, indVarName);
|
||||
}
|
||||
qualRows.Add(tmpRow);
|
||||
if (tmpRow.LevelParent != null)
|
||||
{
|
||||
tmpRow = tmpRow.LevelParent;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return qfhCode;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user