public override XPathNodeIterator Clone() { NodeFunctions method = new NodeFunctions(_funcType, Clone(_arg)); method._xsltContext = _xsltContext; return(method); }
private Query ProcessFunction(Function root, out Props props) { props = Props.None; Query qy = null; switch (root.TypeOfFunction) { case FT.FuncLast: qy = new NodeFunctions(root.TypeOfFunction, null); props |= Props.HasLast; return(qy); case FT.FuncPosition: qy = new NodeFunctions(root.TypeOfFunction, null); props |= Props.HasPosition; return(qy); case FT.FuncCount: return(new NodeFunctions(FT.FuncCount, ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props) )); case FT.FuncID: qy = new IDQuery(ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props)); props |= Props.NonFlat; return(qy); case FT.FuncLocalName: case FT.FuncNameSpaceUri: case FT.FuncName: if (root.ArgumentList != null && root.ArgumentList.Count > 0) { return(new NodeFunctions(root.TypeOfFunction, ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props) )); } else { return(new NodeFunctions(root.TypeOfFunction, null)); } case FT.FuncString: case FT.FuncConcat: case FT.FuncStartsWith: case FT.FuncContains: case FT.FuncSubstringBefore: case FT.FuncSubstringAfter: case FT.FuncSubstring: case FT.FuncStringLength: case FT.FuncNormalize: case FT.FuncTranslate: return(new StringFunctions(root.TypeOfFunction, ProcessArguments(root.ArgumentList, out props))); case FT.FuncNumber: case FT.FuncSum: case FT.FuncFloor: case FT.FuncCeiling: case FT.FuncRound: if (root.ArgumentList != null && root.ArgumentList.Count > 0) { return(new NumberFunctions(root.TypeOfFunction, ProcessNode((AstNode)root.ArgumentList[0], Flags.None, out props) )); } else { return(new NumberFunctions(Function.FunctionType.FuncNumber, null)); } case FT.FuncTrue: case FT.FuncFalse: return(new BooleanFunctions(root.TypeOfFunction, null)); case FT.FuncNot: case FT.FuncLang: case FT.FuncBoolean: return(new BooleanFunctions(root.TypeOfFunction, ProcessNode((AstNode)root.ArgumentList[0], Flags.None, out props) )); case FT.FuncUserDefined: needContext = true; if (!allowCurrent && root.Name == "current" && root.Prefix.Length == 0) { throw XPathException.Create(Res.Xp_CurrentNotAllowed); } if (!allowKey && root.Name == "key" && root.Prefix.Length == 0) { throw XPathException.Create(Res.Xp_InvalidKeyPattern, query); } qy = new FunctionQuery(root.Prefix, root.Name, ProcessArguments(root.ArgumentList, out props)); props |= Props.NonFlat; return(qy); default: throw XPathException.Create(Res.Xp_NotSupported, query); } }
public override XPathNodeIterator Clone() { NodeFunctions method = new NodeFunctions(funcType, Clone(arg)); method.xsltContext = this.xsltContext; return method; }
private Query ProcessFunction(Function root, out Props props) { props = Props.None; Query qy = null; switch (root.TypeOfFunction) { case FT.FuncLast: qy = new NodeFunctions(root.TypeOfFunction, null); props |= Props.HasLast; return qy; case FT.FuncPosition: qy = new NodeFunctions(root.TypeOfFunction, null); props |= Props.HasPosition; return qy; case FT.FuncCount: return new NodeFunctions(FT.FuncCount, ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props) ); case FT.FuncID: qy = new IDQuery(ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props)); props |= Props.NonFlat; return qy; case FT.FuncLocalName: case FT.FuncNameSpaceUri: case FT.FuncName: if (root.ArgumentList != null && root.ArgumentList.Count > 0) { return new NodeFunctions(root.TypeOfFunction, ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props) ); } else { return new NodeFunctions(root.TypeOfFunction, null); } case FT.FuncString: case FT.FuncConcat: case FT.FuncStartsWith: case FT.FuncContains: case FT.FuncSubstringBefore: case FT.FuncSubstringAfter: case FT.FuncSubstring: case FT.FuncStringLength: case FT.FuncNormalize: case FT.FuncTranslate: return new StringFunctions(root.TypeOfFunction, ProcessArguments(root.ArgumentList, out props)); case FT.FuncNumber: case FT.FuncSum: case FT.FuncFloor: case FT.FuncCeiling: case FT.FuncRound: if (root.ArgumentList != null && root.ArgumentList.Count > 0) { return new NumberFunctions(root.TypeOfFunction, ProcessNode((AstNode)root.ArgumentList[0], Flags.None, out props) ); } else { return new NumberFunctions(Function.FunctionType.FuncNumber, null); } case FT.FuncTrue: case FT.FuncFalse: return new BooleanFunctions(root.TypeOfFunction, null); case FT.FuncNot: case FT.FuncLang: case FT.FuncBoolean: return new BooleanFunctions(root.TypeOfFunction, ProcessNode((AstNode)root.ArgumentList[0], Flags.None, out props) ); case FT.FuncUserDefined: _needContext = true; if (!_allowCurrent && root.Name == "current" && root.Prefix.Length == 0) { throw XPathException.Create(SR.Xp_CurrentNotAllowed); } if (!_allowKey && root.Name == "key" && root.Prefix.Length == 0) { throw XPathException.Create(SR.Xp_InvalidKeyPattern, _query); } qy = new FunctionQuery(root.Prefix, root.Name, ProcessArguments(root.ArgumentList, out props)); props |= Props.NonFlat; return qy; default: throw XPathException.Create(SR.Xp_NotSupported, _query); } }
private Query ProcessFunction(Function root, out Props props) { props = Props.None; Query query = null; switch (root.TypeOfFunction) { case Function.FunctionType.FuncLast: query = new NodeFunctions(root.TypeOfFunction, null); props |= Props.HasLast; return query; case Function.FunctionType.FuncPosition: query = new NodeFunctions(root.TypeOfFunction, null); props |= Props.HasPosition; return query; case Function.FunctionType.FuncCount: return new NodeFunctions(Function.FunctionType.FuncCount, this.ProcessNode((AstNode) root.ArgumentList[0], Flags.None, out props)); case Function.FunctionType.FuncID: query = new IDQuery(this.ProcessNode((AstNode) root.ArgumentList[0], Flags.None, out props)); props |= Props.NonFlat; return query; case Function.FunctionType.FuncLocalName: case Function.FunctionType.FuncNameSpaceUri: case Function.FunctionType.FuncName: if ((root.ArgumentList == null) || (root.ArgumentList.Count <= 0)) { return new NodeFunctions(root.TypeOfFunction, null); } return new NodeFunctions(root.TypeOfFunction, this.ProcessNode((AstNode) root.ArgumentList[0], Flags.None, out props)); case Function.FunctionType.FuncString: case Function.FunctionType.FuncConcat: case Function.FunctionType.FuncStartsWith: case Function.FunctionType.FuncContains: case Function.FunctionType.FuncSubstringBefore: case Function.FunctionType.FuncSubstringAfter: case Function.FunctionType.FuncSubstring: case Function.FunctionType.FuncStringLength: case Function.FunctionType.FuncNormalize: case Function.FunctionType.FuncTranslate: return new StringFunctions(root.TypeOfFunction, this.ProcessArguments(root.ArgumentList, out props)); case Function.FunctionType.FuncBoolean: case Function.FunctionType.FuncNot: case Function.FunctionType.FuncLang: return new BooleanFunctions(root.TypeOfFunction, this.ProcessNode((AstNode) root.ArgumentList[0], Flags.None, out props)); case Function.FunctionType.FuncNumber: case Function.FunctionType.FuncSum: case Function.FunctionType.FuncFloor: case Function.FunctionType.FuncCeiling: case Function.FunctionType.FuncRound: if ((root.ArgumentList == null) || (root.ArgumentList.Count <= 0)) { return new NumberFunctions(Function.FunctionType.FuncNumber, null); } return new NumberFunctions(root.TypeOfFunction, this.ProcessNode((AstNode) root.ArgumentList[0], Flags.None, out props)); case Function.FunctionType.FuncTrue: case Function.FunctionType.FuncFalse: return new BooleanFunctions(root.TypeOfFunction, null); case Function.FunctionType.FuncUserDefined: this.needContext = true; if ((!this.allowCurrent && (root.Name == "current")) && (root.Prefix.Length == 0)) { throw XPathException.Create("Xp_CurrentNotAllowed"); } if ((!this.allowKey && (root.Name == "key")) && (root.Prefix.Length == 0)) { throw XPathException.Create("Xp_InvalidKeyPattern", this.query); } query = new FunctionQuery(root.Prefix, root.Name, this.ProcessArguments(root.ArgumentList, out props)); props |= Props.NonFlat; return query; } throw XPathException.Create("Xp_NotSupported", this.query); }