本文整理汇总了C#中IExpr.GetTypeCode方法的典型用法代码示例。如果您正苦于以下问题:C# IExpr.GetTypeCode方法的具体用法?C# IExpr.GetTypeCode怎么用?C# IExpr.GetTypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExpr
的用法示例。
在下文中一共展示了IExpr.GetTypeCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FunctionAggrMax
string _key; // key for caching
/// <summary>
/// Aggregate function: Max returns the highest value
/// Return type is same as input expression
/// </summary>
public FunctionAggrMax(List<ICacheData> dataCache, IExpr e, object scp)
: base(e, scp)
{
_key = "aggrmax" + Interlocked.Increment(ref Parser.Counter).ToString();
// Determine the result
_tc = e.GetTypeCode();
dataCache.Add(this);
}
示例2: FunctionAggrRvSum
private TypeCode _tc; // type of result: decimal or double
#endregion Fields
#region Constructors
/// <summary>
/// Aggregate function: RunningValue Sum returns the sum of all values of the
/// expression within the scope up to that row
/// Return type is decimal for decimal expressions and double for all
/// other expressions.
/// </summary>
public FunctionAggrRvSum(List<ICacheData> dataCache, IExpr e, object scp)
: base(e, scp)
{
_key = "aggrrvsum" + Interlocked.Increment(ref Parser.Counter).ToString();
// Determine the result
_tc = e.GetTypeCode();
if (_tc != TypeCode.Decimal) // if not decimal
_tc = TypeCode.Double; // force result to double
dataCache.Add(this);
}
示例3: MatchExprUnary
private void MatchExprUnary(out IExpr result)
{
TokenTypes t; // remember the type
t = curToken.Type;
if (t == TokenTypes.PLUS || t == TokenTypes.MINUS)
{
curToken = tokens.Extract();
}
MatchExprParen(out result);
if (t == TokenTypes.MINUS)
{
if (result.GetTypeCode() == TypeCode.Decimal)
result = new FunctionUnaryMinusDecimal(result);
else if (result.GetTypeCode() == TypeCode.Int32)
result = new FunctionUnaryMinusInteger(result);
else
result = new FunctionUnaryMinus(result);
}
}
示例4: MatchExprNot
private void MatchExprNot(out IExpr result)
{
TokenTypes t; // remember the type
t = curToken.Type;
if (t == TokenTypes.NOT)
{
curToken = tokens.Extract();
}
MatchExprRelop(out result);
if (t == TokenTypes.NOT)
{
if (result.GetTypeCode() != TypeCode.Boolean)
throw new ParserException("NOT requires boolean expression." + " At column " + Convert.ToString(curToken.StartCol));
result = new FunctionNot(result);
}
}
示例5: FinalPass
//.........这里部分代码省略.........
return;
}
else if (_Source == "" || // empty expression
_Source[0] != '=') // if 1st char not '='
{
_Expr = new Constant(_Source); // this is a constant value
return;
}
Parser p = new Parser(OwnerReport.DataCache);
// find the fields that are part of the DataRegion (if there is one)
IDictionary fields=null;
ReportLink dr = Parent;
Grouping grp= null; // remember if in a table group or detail group or list group
Matrix m=null;
ReportLink phpf=null;
while (dr != null)
{
if (dr is Grouping)
p.NoAggregateFunctions = true;
else if (dr is TableGroup)
grp = ((TableGroup) dr).Grouping;
else if (dr is Matrix)
{
m = (Matrix) dr; // if matrix we need to pass special
break;
}
else if (dr is Details)
{
grp = ((Details) dr).Grouping;
}
else if (dr is List)
{
grp = ((List) dr).Grouping;
break;
}
else if (dr is PageHeader || dr is PageFooter)
{
phpf = dr;
}
else if (dr is DataRegion || dr is DataSetDefn)
break;
dr = dr.Parent;
}
if (dr != null)
{
if (dr is DataSetDefn)
{
DataSetDefn d = (DataSetDefn) dr;
if (d.Fields != null)
fields = d.Fields.Items;
}
else // must be a DataRegion
{
DataRegion d = (DataRegion) dr;
if (d.DataSetDefn != null &&
d.DataSetDefn.Fields != null)
fields = d.DataSetDefn.Fields.Items;
}
}
NameLookup lu = new NameLookup(fields, OwnerReport.LUReportParameters,
OwnerReport.LUReportItems,OwnerReport.LUGlobals,
OwnerReport.LUUser, OwnerReport.LUAggrScope,
grp, m, OwnerReport.CodeModules, OwnerReport.Classes, OwnerReport.DataSetsDefn,
OwnerReport.CodeType);
if (phpf != null)
{
// Non-null when expression is in PageHeader or PageFooter;
// Expression name needed for dynamic lookup of ReportItems on a page.
lu.PageFooterHeader = phpf;
lu.ExpressionName = _UniqueName = "xn_" + Interlocked.Increment(ref Parser.Counter).ToString();
}
try
{
_Expr = p.Parse(lu, _Source);
}
catch (Exception e)
{
_Expr = new ConstantError(e.Message);
// Invalid expression
OwnerReport.rl.LogError(8, ErrorText(e.Message));
}
// Optimize removing any expression that always result in a constant
try
{
_Expr = _Expr.ConstantOptimization();
}
catch(Exception ex)
{
OwnerReport.rl.LogError(4, "Expression:" + _Source + "\r\nConstant Optimization exception:\r\n" + ex.Message + "\r\nStack trace:\r\n" + ex.StackTrace );
}
_Type = _Expr.GetTypeCode();
return;
}
示例6: MatchExprNot
private void MatchExprNot(out IExpr result)
{
TokenTypes t; // remember the type
t = curToken.Type;
if (t == TokenTypes.NOT)
{
curToken = tokens.Extract();
}
MatchExprRelop(out result);
if (t == TokenTypes.NOT)
{
if (result.GetTypeCode() != TypeCode.Boolean)
throw new ParserException(Strings.Parser_ErrorP_NOTRequiresBoolean + GetLocationInfo(curToken));
result = new FunctionNot(result);
}
}
示例7: DoParse
public TypeCode DoParse(Report rpt)
{
// optimization: avoid expression overhead if this isn't really an expression
if (_Source == null)
{
_Expr = new Constant("");
return _Expr.GetTypeCode();
}
else if (_Source == string.Empty || // empty expression
_Source[0] != '=') // if 1st char not '='
{
_Expr = new Constant(_Source); // this is a constant value
return _Expr.GetTypeCode();
}
Parser p = new Parser(new System.Collections.Generic.List<ICacheData>());
// find the fields that are part of the DataRegion (if there is one)
IDictionary fields=null;
ReportLink dr = _rl.Parent;
Grouping grp= null; // remember if in a table group or detail group or list group
Matrix m=null;
while (dr != null)
{
if (dr is Grouping)
p.NoAggregateFunctions = true;
else if (dr is TableGroup)
grp = ((TableGroup) dr).Grouping;
else if (dr is Matrix)
{
m = (Matrix) dr; // if matrix we need to pass special
break;
}
else if (dr is Details)
{
grp = ((Details) dr).Grouping;
}
else if (dr is List)
{
grp = ((List) dr).Grouping;
break;
}
else if (dr is DataRegion || dr is DataSetDefn)
break;
dr = dr.Parent;
}
if (dr != null)
{
if (dr is DataSetDefn)
{
DataSetDefn d = (DataSetDefn) dr;
if (d.Fields != null)
fields = d.Fields.Items;
}
else // must be a DataRegion
{
DataRegion d = (DataRegion) dr;
if (d.DataSetDefn != null &&
d.DataSetDefn.Fields != null)
fields = d.DataSetDefn.Fields.Items;
}
}
NameLookup lu = new NameLookup(fields, rpt.ReportDefinition.LUReportParameters,
rpt.ReportDefinition.LUReportItems, rpt.ReportDefinition.LUGlobals,
rpt.ReportDefinition.LUUser, rpt.ReportDefinition.LUAggrScope,
grp, m, rpt.ReportDefinition.CodeModules, rpt.ReportDefinition.Classes, rpt.ReportDefinition.DataSetsDefn,
rpt.ReportDefinition.CodeType);
try
{
_Expr = p.Parse(lu, _Source);
}
catch (Exception e)
{
_Expr = new ConstantError(e.Message);
// Invalid expression
rpt.rl.LogError(8, ErrorText(e.Message));
}
// Optimize removing any expression that always result in a constant
try
{
_Expr = _Expr.ConstantOptimization();
}
catch(Exception ex)
{
rpt.rl.LogError(4, "Expression:" + _Source + "\r\nConstant Optimization exception:\r\n" + ex.Message + "\r\nStack trace:\r\n" + ex.StackTrace );
}
return _Expr.GetTypeCode();
}