public static void AddComment(IFocus focus) { var stfocus = focus as StyledTextFocus; if (stfocus != null) { MemoEditorHelper.AddCommentForMemoText(stfocus); } }
/// <summary> /// Instancia um objeto da classe UserManager a partir de context. /// </summary> public UserManager(Context context) { userGenerator = new UserGenerator(context); poseDetectionCapability = userGenerator.PoseDetectionCapability; skeletonCapability = userGenerator.SkeletonCapability; skeletonCapability.SetSkeletonProfile(SkeletonProfile.All); skeletonCapability.SetSmoothing(0.5f); skeleton = new Skeleton(skeletonCapability); users = new Dictionary <int, User>(); userGenerator.NewUser += NewUser; poseDetectionCapability.PoseDetected += PoseDetected; poseDetectionCapability.OutOfPose += OutOfPose; skeletonCapability.CalibrationStart += CalibrationStart; skeletonCapability.CalibrationComplete += CalibrationComplete; userGenerator.LostUser += LostUser; focus = new Dictionary <string, IFocus>(); focus.Add("Closest", new FocusClosest()); focus.Add("Farthest", new FocusFarthest()); focus.Add("Oldest", new FocusOldest()); focus.Add("Newest", new FocusNewest()); focus.Add("None", new FocusNone()); currentFocus = focus["None"]; }
private QilNode CompileFnKey(QilNode name, QilNode keys, IFocus env) { QilNode result; QilIterator i, n, k; if (keys.XmlType.IsNode) { if (keys.XmlType.IsSingleton) { result = CompileSingleKey(name, _f.ConvertToString(keys), env); } else { result = _f.Loop(i = _f.For(keys), CompileSingleKey(name, _f.ConvertToString(i), env)); } } else if (keys.XmlType.IsAtomicValue) { result = CompileSingleKey(name, _f.ConvertToString(keys), env); } else { result = _f.Loop(n = _f.Let(name), _f.Loop(k = _f.Let(keys), _f.Conditional(_f.Not(_f.IsType(k, T.AnyAtomicType)), _f.Loop(i = _f.For(_f.TypeAssert(k, T.NodeS)), CompileSingleKey(n, _f.ConvertToString(i), env)), CompileSingleKey(n, _f.XsltConvert(k, T.StringX), env) ) )); } return(_f.DocOrderDistinct(result)); }
private QilNode CompileSingleKey(QilNode name, QilNode key, IFocus env) { Debug.Assert(name.XmlType == T.StringX && key.XmlType == T.StringX); QilNode result; if (name.NodeType == QilNodeType.LiteralString) { string keyName = (QilLiteral)name; _compiler.ParseQName(keyName, out string prefix, out string local, default(ThrowErrorHelper)); string nsUri = ResolvePrefixThrow(/*ignoreDefaultNs:*/ true, prefix); QilName qname = _f.QName(local, nsUri, prefix); if (!_compiler.Keys.Contains(qname)) { throw new XslLoadException(SR.Xslt_UndefinedKey, keyName); } result = CompileSingleKey(_compiler.Keys[qname], key, env); } else { if (_generalKey == null) { _generalKey = CreateGeneralKeyFunction(); } QilIterator i = _f.Let(name); QilNode resolvedName = ResolveQNameDynamic(/*ignoreDefaultNs:*/ true, i); result = _f.Invoke(_generalKey, _f.ActualParameterList(i, resolvedName, key, env.GetCurrent())); result = _f.Loop(i, result); } return(result); }
public static void CommitAndMoveLeftCell(IFocus focus) { var editor = focus.Host; editor.RequestFocusCommit(true); MemoTableCellEditorKeyActions.MoveLeftCell(editor); }
private object InitFocus(IFocus focus, object model) { if (_firstFocus) { var app = MemopadApplication.Instance; focus.KeyMap = app.KeySchema.MemoContentFocusKeyMap; //app.KeySchema.MemoContentFocusKeyBinder.Bind(focus.KeyMap); _firstFocus = false; } /// 自動折り返しのためのMaxSize制限 var focusNode = (INode)focus.Figure; var editorNode = (INode)focus.Host.Figure; focusNode.MinSize = editorNode.MinSize; focusNode.MaxSize = editorNode.MaxSize; focus.Figure.Foreground = Color.FromArgb(200, 200, 200); /// SilverとGainsBoroの間 focus.Figure.Background = new SolidBrushDescription(Color.White); //focus.Figure.Background = new SolidBrushDescription(Color.Ivory); focus.Figure.ShowLineBreak = Figure.ShowLineBreak; focus.Figure.ShowBlockBreak = Figure.ShowBlockBreak; return(((MemoText)model).StyledText.CloneDeeply()); }
public static void CommitAndMoveRightCellOrCreateRow(IFocus focus) { var editor = focus.Host; editor.RequestFocusCommit(true); MemoTableCellEditorKeyActions.MoveRightCellOrCreateRow(editor); }
public static object InitUmlOperationFocus(IFocus focus, object model) { var facade = MemopadApplication.Instance; //((StyledTextFocus) focus).IsEmacsEdit = facade.Settings.KeyScheme == KeySchemeKind.Emacs; focus.Figure.Padding = MemopadConsts.UmlFeaturePadding; var ope = model as UmlOperation; if (ope != null) { var visText = UmlTextUtil.GetVisibilityText(ope.Visibility); var visibility = string.IsNullOrEmpty(visText)? "-": visText; var paras = string.IsNullOrEmpty(ope.Parameters)? "": ope.Parameters; var typeName = string.IsNullOrEmpty(ope.TypeName)? "": ope.TypeName; var text = visibility + " " + ope.Name + "(" + paras + ")" + ": " + typeName; var para = new Paragraph(new Run(text)) { HorizontalAlignment = Mkamo.Common.DataType.HorizontalAlignment.Left, Padding = Insets.Empty, }; return(new StyledText(para) { Font = MemopadApplication.Instance.Settings.GetDefaultUmlFont(), VerticalAlignment = VerticalAlignment.Top, }); } else { return(new StyledText()); } }
public static object InitUmlInterfaceFocus(IFocus focus, object model) { var facade = MemopadApplication.Instance; //((StyledTextFocus) focus).IsEmacsEdit = facade.Settings.KeyScheme == KeySchemeKind.Emacs; var elem = (UmlClassifier)model; if (elem != null) { var stereotypeRun = new Run(UmlTextUtil.GetStereotypeText(elem, "interface")); var nameRun = new Run(elem.Name); var para = new Paragraph(stereotypeRun); var line = new LineSegment(); line.InsertAfter(nameRun); para.InsertAfter(line); para.HorizontalAlignment = HorizontalAlignment.Center; para.Padding = Insets.Empty; return(new StyledText(para) { Font = MemopadApplication.Instance.Settings.GetDefaultUmlFont(), VerticalAlignment = VerticalAlignment.Top, }); } else { return(new StyledText()); } }
// ======================================== // property // ======================================== // ======================================== // method // ======================================== public static object InitFeatureFocus(IFocus focus, object model) { var facade = MemopadApplication.Instance; //((StyledTextFocus) focus).IsEmacsEdit = facade.Settings.KeyScheme == KeySchemeKind.Emacs; var elem = model as UmlNamedElement; if (elem != null) { var para = new Paragraph(new Run(elem.Name)) { HorizontalAlignment = Mkamo.Common.DataType.HorizontalAlignment.Left, Padding = Insets.Empty, }; return(new StyledText(para) { Font = MemopadApplication.Instance.Settings.GetDefaultUmlFont(), VerticalAlignment = VerticalAlignment.Top, }); } else { return(new StyledText()); } }
public static void MoveOutDown(IFocus focus) { var host = focus.Host; var pos = host.Site.Caret.Position; host.RequestFocusCommit(true); host.Parent.RequestSelect(SelectKind.True, true); host.Site.Caret.Position = host.Site.GridService.GetAdjustedPoint(new Point(pos.X, host.Figure.Bottom - 1 + 8)); }
public BotKeys(IFocus target, bool up = false, bool down = false, bool left = false, bool right = false) { this.up = up; this.down = down; this.left = left; this.right = right; this.target = target; Game1.Updated += this.AI; }
public static void CloseTabPage(IFocus focus) { var editor = focus.Host; var facade = MemopadApplication.Instance; var memo = editor.Site.EditorCanvas.EditorContent as Memo; var memoInfo = facade.FindMemoInfo(memo); if (memoInfo != null) { facade.CloseMemo(memoInfo); } }
public static FocusUndoer CommitInterfaceFocus(IFocus focus, object model, object value, bool isRedo, out bool isCancelled) { var elem = (UmlClassifier)model; var oldName = elem.Name; var oldStereotype = elem.Stereotype; var strs = ((StyledText)value).Lines; var newName = ""; var newStereotype = ""; if (strs.Any()) { var stereotypes = new HashSet <string>(); foreach (var str in strs) { if (!string.IsNullOrEmpty(str)) { var parsed = default(string[]); if (UmlTextUtil.ParseStereotype(str, out parsed)) { foreach (var s in parsed) { if (!s.Equals("interface", StringComparison.OrdinalIgnoreCase)) { stereotypes.Add(s); } } } else { newName = str.Trim(); } } } var arr = stereotypes.ToArray(); Array.Sort(arr); newStereotype = string.Join(", ", arr); } isCancelled = false; if (newName == oldName && newStereotype == oldStereotype) { return(null); } else { elem.Name = newName; elem.Stereotype = newStereotype; return((f, m) => { var cls = (UmlClassifier)m; cls.Name = oldName; cls.Stereotype = oldStereotype; }); } }
/// <summary> /// Troca o algoritmo de foco para o algoritmo de nome s. /// </summary> public void SetFocus(String s) { if (s != null && focus.ContainsKey(s)) { currentFocus = focus[s]; } else { currentFocus = focus["None"]; } currentFocus.Reset(); }
public void InstallFocus(IFocus focus) { if (focus == null || focus.Figure == null || focus == _focus) { return; } focus.Install(this); _focus = focus; if (_focus.Figure != null) { _focus.Figure.BoundsChanged += HandleFocusFigureBoundsChanged; } }
//Camera Position Updaten public void Update(IFocus focus) { if (_follow == true) { center = focus.getFocus(); } _width = focus.getWidth() / 2; _height = focus.getHeight() / 2; transform = Matrix.CreateTranslation(new Vector3(-center.X - _width, -center.Y - _height, 0)) * Matrix.CreateRotationZ(_rotation) * Matrix.CreateScale(_zoom) * Matrix.CreateTranslation(new Vector3(view.Width / 2, view.Height / 2, 0)); }
private void RemoveFocus(IFocus focus, bool dispatch) { if (focus == null) { return; } if (!mFocuses.Remove(focus)) { return; } if (dispatch) { CheckCurrentFocus(); } }
private QilNode CompileFnKey(QilNode name, QilNode keys, IFocus env) { QilNode result; QilIterator i, n, k; if (keys.XmlType !.IsNode) { if (keys.XmlType.IsSingleton) { result = CompileSingleKey(name, _f.ConvertToString(keys), env); } else { result = _f.Loop(i = _f.For(keys), CompileSingleKey(name, _f.ConvertToString(i), env)); } }
private QilNode CompileSingleKey(List <Key> defList, QilNode key, IFocus env) { Debug.Assert(defList != null && defList.Count > 0); if (defList.Count == 1) { return(_f.Invoke(defList[0].Function, _f.ActualParameterList(env.GetCurrent(), key))); } QilIterator i = _f.Let(key); QilNode result = _f.Sequence(); foreach (Key keyDef in defList) { result.Add(_f.Invoke(keyDef.Function, _f.ActualParameterList(env.GetCurrent(), i))); } return(_f.Loop(i, result)); }
// ------------------------------ // private // ------------------------------ private object InitFocus(IFocus focus, object model) { if (_firstFocus) { var app = MemopadApplication.Instance; focus.KeyMap = app.KeySchema.MemoTableCellFocusKeyMap; _firstFocus = false; } var bgColor = Color.Ivory; if (Figure.Background != null && Figure.Background.IsDark) { bgColor = Color.DimGray; } focus.Figure.Background = new SolidBrushDescription(bgColor); return(Model.StyledText == null? null: Model.StyledText.CloneDeeply()); }
private void CheckCurrentFocus() { int n = mFocuses.Count; IFocus focus = n > 0 ? mFocuses[n - 1] : null; if (focus == mCurrentFocus) { return; } if (mCurrentFocus != null) { mCurrentFocus.LoseFocus(); } mCurrentFocus = focus; if (mCurrentFocus != null) { mCurrentFocus.GetFocus(); } }
private FocusUndoer CommitFocus(IFocus focus, object model, object value, bool isRedo, out bool isCancelled) { if (focus.IsModified || isRedo) { var memoStyledText = (MemoStyledText)model; var oldValue = memoStyledText.StyledText; var oldBounds = Figure.Bounds; isCancelled = false; memoStyledText.StyledText = (StyledText)value; var parent = Host.Parent; var tableFig = parent.Figure as TableFigure; var tableData = tableFig.TableData; var row = tableData.GetRow(Figure); var oldRowHeight = row.Height; /// 高さの自動調節 if (Model.RowSpan == 1) { var focusFig = focus.Figure; var bounds = focusFig.StyledTextBounds; var height = row.Cells.Max(cell => cell.Value.StyledTextBounds.Height); height = Math.Max(bounds.Height, height); if (row.Height != height + Figure.Padding.Height) { row.Height = height + Figure.Padding.Height; } } return((f, m) => { memoStyledText.StyledText = oldValue; row.Height = oldRowHeight; }); } else { isCancelled = false; return(null); } }
private void AddFocus(IFocus focus, bool isBase, bool dispatch) { if (focus == null) { return; } if (isBase) { mFocuses.Insert(0, focus); } else { mFocuses.Add(focus); } if (dispatch) { CheckCurrentFocus(); } }
public static FocusUndoer CommitNamedElementFocus(IFocus focus, object model, object value, out bool canceled) { var elem = (UmlNamedElement)model; var oldName = elem.Name; var strs = ((StyledText)value).Lines; var newName = strs.Any() ? strs[0] : ""; canceled = false; if (newName == oldName) { return(null); } else { elem.Name = newName; return((f, m) => { ((UmlNamedElement)m).Name = oldName; }); } }
private FocusUndoer CommitFocus(IFocus focus, object model, object value, bool isRedo, out bool isCancelled) { var memoStyledText = (MemoStyledText)model; var oldValue = memoStyledText.StyledText; var oldBounds = Figure.Bounds; if (focus.IsModified || isRedo) { isCancelled = false; memoStyledText.StyledText = (StyledText)value; return((f, m) => { memoStyledText.StyledText = oldValue; Figure.Bounds = oldBounds; }); } else { isCancelled = false; return(null); } }
public static FocusUndoer CommitUmlOperationFocus(IFocus focus, object model, object value, bool isRedo, out bool isCancelled) { var ope = (UmlOperation)model; var oldName = ope.Name; var oldVisibility = ope.Visibility; var oldParams = ope.Parameters; var oldTypeName = ope.TypeName; var strs = ((StyledText)value).Lines; var newValue = strs.Any() ? strs[0] : ""; string newVisibilityText, newName, newParams, newTypeName; isCancelled = !UmlTextUtil.ParseUmlOperation(newValue, out newVisibilityText, out newName, out newParams, out newTypeName); if (isCancelled) { return(null); } var newVisibility = UmlTextUtil.GetVisibility(newVisibilityText); if (newName == oldName && newVisibility == oldVisibility && newParams == oldParams && newTypeName == oldTypeName) { return(null); } else { ope.Name = newName; ope.Visibility = UmlTextUtil.GetVisibility(newVisibilityText); ope.Parameters = newParams; ope.TypeName = newTypeName; return((f, m) => { var o = (UmlOperation)m; o.Name = oldName; o.Visibility = oldVisibility; o.Parameters = oldParams; o.TypeName = oldTypeName; }); } }
private FocusUndoer CommitFocus(IFocus focus, object model, object value, bool isRedo, out bool isCancelled) { var memoText = (MemoText)model; var stfocus = (StyledTextFocus)focus; if (stfocus.IsModified || isRedo) { var oldSTText = memoText.StyledText; memoText.StyledText = (StyledText)value; isCancelled = false; /// 自動折り返しのためのMaxSize制限解除 /// やっておかないとStyledTextFocusのRelocateのMinSize設定で例外が起こる。 /// /// memoText.StyledText = (StyledText) value; の後でやらないと /// モデル更新 => RefreshEditor() => StyledTextFocus.Relocate()が起こって /// StyledTextFocusFigureのWidthが文字列が折り返しされないときのWidthになってしまう。 /// その後HandleのRelocate()が呼ばれてまだIsFocused=trueなのでFrameの枠のWidthがおかしくなる。 var focusNode = (INode)focus.Figure; focusNode.MaxSize = new Size(int.MaxValue, int.MaxValue); /// コメント線の処理 DisconnectRemovedAnchor(Figure, focusNode); using (Host.Site.CommandExecutor.BeginChain()) { var moved = new List <IEditor>(); MoveOverlapped(Host, moved); } return((f, m) => { memoText.StyledText = oldSTText; }); } else { isCancelled = false; return(null); } }
public static FocusUndoer CommitUmlPropertyFocus(IFocus focus, object model, object value, bool isRedo, out bool isCancelled) { var prop = (UmlProperty)model; var oldName = prop.Name; var oldVisibility = prop.Visibility; var oldTypeName = prop.TypeName; var strs = ((StyledText)value).Lines; var newValue = strs.Any() ? strs[0] : ""; string newVisibilityText, newName, newTypeName; isCancelled = !UmlTextUtil.ParseUmlProperty(newValue, out newVisibilityText, out newName, out newTypeName); if (isCancelled) { return(null); } var newVisibility = UmlTextUtil.GetVisibility(newVisibilityText); if (newName == oldName && newVisibility == oldVisibility && newTypeName == oldTypeName) { return(null); } else { prop.Name = newName; prop.Visibility = UmlTextUtil.GetVisibility(newVisibilityText); prop.TypeName = newTypeName; return((f, m) => { var p = (UmlProperty)m; p.Name = oldName; p.Visibility = oldVisibility; p.TypeName = oldTypeName; }); } }
/// <summary> /// Focusに関連付ける. /// </summary> public static void SetFocus(this IFigure figure, IFocus value) { figure.TransientData[EditorConsts.FigureFocusKey] = value; }
/// <summary>Changes the element that is used for focus control.</summary> /// <param name="element">The child element that is the primary reciever of focus.</param> /// <remarks> /// By default this is the 'Container', however if a child element within /// the control is the primary reciever of focus use this method to /// assign it as such. /// </remarks> protected void ChangeFocusElement(jQueryObject element) { focus = new ViewFocus(this, element); }
// NOTE: DO NOT call QilNode.Clone() while executing this method since fixup nodes cannot be cloned QilNode IXPathEnvironment.ResolveFunction(string prefix, string name, IList<QilNode> args, IFocus env) { Debug.Assert(!args.IsReadOnly, "Writable collection expected"); if (prefix.Length == 0) { FunctionInfo func; if (FunctionTable.TryGetValue(name, out func)) { func.CastArguments(args, name, f); switch (func.id) { case FuncId.Current : if (!allowCurrent) { throw new XslLoadException(Res.Xslt_CurrentNotAllowed); } // NOTE: This is the only place where the current node (and not the context node) must be used return ((IXPathEnvironment) this).GetCurrent(); case FuncId.Key : if (!allowKey) { throw new XslLoadException(Res.Xslt_KeyNotAllowed); } return CompileFnKey(args[0], args[1], env); case FuncId.Document : return CompileFnDocument(args[0], args.Count > 1 ? args[1] : null); case FuncId.FormatNumber : return CompileFormatNumber(args[0], args[1], args.Count > 2 ? args[2] : null); case FuncId.UnparsedEntityUri : return CompileUnparsedEntityUri(args[0]); case FuncId.GenerateId : return CompileGenerateId(args.Count > 0 ? args[0] : env.GetCurrent()); case FuncId.SystemProperty : return CompileSystemProperty(args[0]); case FuncId.ElementAvailable : return CompileElementAvailable(args[0]); case FuncId.FunctionAvailable : return CompileFunctionAvailable(args[0]); default: Debug.Fail(func.id + " is present in the function table, but absent from the switch"); return null; } } else { throw new XslLoadException(Res.Xslt_UnknownXsltFunction, Compiler.ConstructQName(prefix, name)); } } else { string ns = ResolvePrefixThrow(/*ignoreDefaultNs:*/true, prefix); Debug.Assert(ns != null); if (ns == XmlReservedNs.NsMsxsl) { if (name == "node-set") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/1, name, args.Count); return CompileMsNodeSet(args[0]); } else if (name == "string-compare") { FunctionInfo.CheckArity(/*minArg:*/2, /*maxArg:*/4, name, args.Count); return f.InvokeMsStringCompare( /*x: */f.ConvertToString(args[0]), /*y: */f.ConvertToString(args[1]), /*lang: */2 < args.Count ? f.ConvertToString(args[2]) : f.String(string.Empty), /*options:*/3 < args.Count ? f.ConvertToString(args[3]) : f.String(string.Empty) ); } else if (name == "utc") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/1, name, args.Count); return f.InvokeMsUtc(/*datetime:*/f.ConvertToString(args[0])); } else if (name == "format-date" || name == "format-time") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/3, name, args.Count); bool fwdCompat = (xslVersion == XslVersion.ForwardsCompatible); return f.InvokeMsFormatDateTime( /*datetime:*/f.ConvertToString(args[0]), /*format: */1 < args.Count ? f.ConvertToString(args[1]) : f.String(string.Empty), /*lang: */2 < args.Count ? f.ConvertToString(args[2]) : f.String(string.Empty), /*isDate: */f.Boolean(name == "format-date") ); } else if (name == "local-name") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/1, name, args.Count); return f.InvokeMsLocalName(f.ConvertToString(args[0])); } else if (name == "namespace-uri") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/1, name, args.Count); return f.InvokeMsNamespaceUri(f.ConvertToString(args[0]), env.GetCurrent()); } else if (name == "number") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/1, name, args.Count); return f.InvokeMsNumber(args[0]); } } if (ns == XmlReservedNs.NsExsltCommon) { if (name == "node-set") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/1, name, args.Count); return CompileMsNodeSet(args[0]); } else if (name == "object-type") { FunctionInfo.CheckArity(/*minArg:*/1, /*maxArg:*/1, name, args.Count); return EXslObjectType(args[0]); } } // NOTE: If you add any function here, add it to IsFunctionAvailable as well // Ensure that all node-set parameters are DocOrderDistinct for (int i = 0; i < args.Count; i++) args[i] = f.SafeDocOrderDistinct(args[i]); if (compiler.Settings.EnableScript) { XmlExtensionFunction scrFunc = compiler.Scripts.ResolveFunction(name, ns, args.Count, (IErrorHelper)this); if (scrFunc != null) { return GenerateScriptCall(f.QName(name, ns, prefix), scrFunc, args); } } else { if (compiler.Scripts.ScriptClasses.ContainsKey(ns)) { ReportWarning(Res.Xslt_ScriptsProhibited); return f.Error(lastScope.SourceLine, Res.Xslt_ScriptsProhibited); } } return f.XsltInvokeLateBound(f.QName(name, ns, prefix), args); } }
private QilNode CompileSingleKey(List<Key> defList, QilNode key, IFocus env) { Debug.Assert(defList != null && defList.Count > 0); if (defList.Count == 1) { return f.Invoke(defList[0].Function, f.ActualParameterList(env.GetCurrent(), key)); } QilIterator i = f.Let(key); QilNode result = f.Sequence(); foreach (Key keyDef in defList) { result.Add(f.Invoke(keyDef.Function, f.ActualParameterList(env.GetCurrent(), i))); } return f.Loop(i, result); }
private QilNode CompileSingleKey(QilNode name, QilNode key, IFocus env) { Debug.Assert(name.XmlType == T.StringX && key.XmlType == T.StringX); QilNode result; if (name.NodeType == QilNodeType.LiteralString) { string keyName = (string)(QilLiteral)name; string prefix, local, nsUri; compiler.ParseQName(keyName, out prefix, out local, new ThrowErrorHelper()); nsUri = ResolvePrefixThrow(/*ignoreDefaultNs:*/true, prefix); QilName qname = f.QName(local, nsUri, prefix); if (!compiler.Keys.Contains(qname)) { throw new XslLoadException(Res.Xslt_UndefinedKey, keyName); } result = CompileSingleKey(compiler.Keys[qname], key, env); } else { if (generalKey == null) { generalKey = CreateGeneralKeyFunction(); } QilIterator i = f.Let(name); QilNode resolvedName = ResolveQNameDynamic(/*ignoreDefaultNs:*/true, i); result = f.Invoke(generalKey, f.ActualParameterList(i, resolvedName, key, env.GetCurrent())); result = f.Loop(i, result); } return result; }
private QilNode CompileFnKey(QilNode name, QilNode keys, IFocus env) { QilNode result; QilIterator i, n, k; if (keys.XmlType.IsNode) { if (keys.XmlType.IsSingleton) { result = CompileSingleKey(name, f.ConvertToString(keys), env); } else { result = f.Loop(i = f.For(keys), CompileSingleKey(name, f.ConvertToString(i), env)); } } else if (keys.XmlType.IsAtomicValue) { result = CompileSingleKey(name, f.ConvertToString(keys), env); } else { result = f.Loop(n = f.Let(name), f.Loop(k = f.Let(keys), f.Conditional(f.Not(f.IsType(k, T.AnyAtomicType)), f.Loop(i = f.For(f.TypeAssert(k, T.NodeS)), CompileSingleKey(n, f.ConvertToString(i), env)), CompileSingleKey(n, f.XsltConvert(k, T.StringX), env) ) )); } return f.DocOrderDistinct(result); }
public QilNode ResolveFunction(string prefix, string name, IList<QilNode> args, IFocus env) { return baseEnvironment.ResolveFunction(prefix, name, args, env); }