Exemplo n.º 1
0
        public GraphElementSearcherDatabase AddUnaryOperators()
        {
            SearcherItem parent = SearcherItemUtility.GetItemFromPath(Items, k_Operator);

            foreach (UnaryOperatorKind kind in Enum.GetValues(typeof(UnaryOperatorKind)))
            {
                if (kind == UnaryOperatorKind.PostDecrement || kind == UnaryOperatorKind.PostIncrement)
                {
                    parent.AddChild(new StackNodeModelSearcherItem(
                                        new UnaryOperatorSearcherItemData(kind),
                                        data => data.CreateUnaryStatementNode(kind),
                                        kind.ToString()
                                        ));
                    continue;
                }

                parent.AddChild(new GraphNodeModelSearcherItem(
                                    new UnaryOperatorSearcherItemData(kind),
                                    data => data.CreateUnaryStatementNode(kind),
                                    kind.ToString()
                                    ));
            }

            return(this);
        }
Exemplo n.º 2
0
 public static void AddAtPath(this List <SearcherItem> items, SearcherItem item, string path = "")
 {
     if (!string.IsNullOrEmpty(path))
     {
         SearcherItem parent = SearcherItemUtility.GetItemFromPath(items, path);
         parent.AddChild(item);
     }
     else
     {
         items.Add(item);
     }
 }
Exemplo n.º 3
0
        public GraphElementSearcherDatabase AddConstants(Type type)
        {
            TypeHandle handle = type.GenerateTypeHandle(Stencil);

            SearcherItem parent = SearcherItemUtility.GetItemFromPath(Items, k_Constant);

            parent.AddChild(new GraphNodeModelSearcherItem(
                                new TypeSearcherItemData(handle, SearcherItemTarget.Constant),
                                data => data.CreateConstantNode("", handle),
                                $"{type.FriendlyName().Nicify()} {k_Constant}"
                                ));

            return(this);
        }
Exemplo n.º 4
0
        public GraphElementSearcherDatabase AddBinaryOperators()
        {
            SearcherItem parent = SearcherItemUtility.GetItemFromPath(Items, k_Operator);

            foreach (BinaryOperatorKind kind in Enum.GetValues(typeof(BinaryOperatorKind)))
            {
                parent.AddChild(new GraphNodeModelSearcherItem(
                                    new BinaryOperatorSearcherItemData(kind),
                                    data => data.CreateBinaryOperatorNode(kind),
                                    kind.ToString()
                                    ));
            }

            return(this);
        }
Exemplo n.º 5
0
        public GraphElementSearcherDatabase AddGraphVariables(IGraphModel graphModel)
        {
            SearcherItem parent       = null;
            var          vsGraphModel = (VSGraphModel)graphModel;

            foreach (IVariableDeclarationModel declarationModel in vsGraphModel.GraphVariableModels)
            {
                if (parent == null)
                {
                    parent = SearcherItemUtility.GetItemFromPath(Items, k_GraphVariables);
                }

                parent.AddChild(new GraphNodeModelSearcherItem(
                                    new TypeSearcherItemData(declarationModel.DataType, SearcherItemTarget.Variable),
                                    data => data.CreateVariableNode(declarationModel),
                                    declarationModel.Name.Nicify()
                                    ));
            }

            return(this);
        }