当前位置: 首页>>代码示例>>C#>>正文


C# QilList.Add方法代码示例

本文整理汇总了C#中System.Xml.Xsl.Qil.QilList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# QilList.Add方法的具体用法?C# QilList.Add怎么用?C# QilList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Xsl.Qil.QilList的用法示例。


在下文中一共展示了QilList.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateInvoke

        public QilNode GenerateInvoke(QilFunction func, IList<XslNode> actualArgs) {
            iterStack.Clear();
            formalArgs = func.Arguments;
            invokeArgs = fac.ActualParameterList();

            // curArg is an instance variable used in Clone() method
            for (curArg = 0; curArg < formalArgs.Count; curArg ++) {
                // Find actual value for a given formal arg
                QilParameter formalArg = (QilParameter)formalArgs[curArg];
                QilNode      invokeArg = FindActualArg(formalArg, actualArgs);

                // If actual value was not specified, use the default value and copy its debug comment
                if (invokeArg == null) {
                    if (debug) {
                        if (formalArg.Name.NamespaceUri == XmlReservedNs.NsXslDebug) {
                            Debug.Assert(formalArg.Name.LocalName == "namespaces", "Cur,Pos,Last don't have default values and should be always added to by caller in AddImplicitArgs()");
                            Debug.Assert(formalArg.DefaultValue != null, "PrecompileProtoTemplatesHeaders() set it");
                            invokeArg = Clone(formalArg.DefaultValue);
                        } else {
                            invokeArg = fac.DefaultValueMarker();
                        }
                    } else {
                        Debug.Assert(formalArg.Name.NamespaceUri != XmlReservedNs.NsXslDebug, "Cur,Pos,Last don't have default values and should be always added to by caller in AddImplicitArgs(). We don't have $namespaces in !debug.");
                        invokeArg = Clone(formalArg.DefaultValue);
                    }
                }

                XmlQueryType formalType = formalArg.XmlType;
                XmlQueryType invokeType = invokeArg.XmlType;

                // Possible arg types: anyType, node-set, string, boolean, and number
                fac.CheckXsltType(formalArg);
                fac.CheckXsltType(invokeArg);

                if (!invokeType.IsSubtypeOf(formalType)) {
                    // This may occur only if inferred type of invokeArg is XslFlags.None
                    Debug.Assert(invokeType == T.ItemS, "Actual argument type is not a subtype of formal argument type");
                    invokeArg = fac.TypeAssert(invokeArg, formalType);
                }

                invokeArgs.Add(invokeArg);
            }

            // Create Invoke node and wrap it with previous parameter declarations
            QilNode invoke = fac.Invoke(func, invokeArgs);
            while (iterStack.Count != 0)
                invoke = fac.Loop(iterStack.Pop(), invoke);

            return invoke;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:50,代码来源:InvokeGenerator.cs

示例2: AddNsDecl

 private void AddNsDecl(QilList content, string prefix, string nsUri)
 {
     if (_outputScope.LookupNamespace(prefix) == nsUri)
     {
         return; // This prefix is already bound to required namespace. Nothing to do.
     }
     _outputScope.AddNamespace(prefix, nsUri);
     content.Add(_f.NamespaceDecl(_f.String(prefix), _f.String(nsUri)));
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:QilGenerator.cs

示例3: CompileInstructions

        private QilNode CompileInstructions(IList<XslNode> instructions, int from, QilList content)
        {
            Debug.Assert(instructions != null);
            for (int i = from; i < instructions.Count; i++)
            {
                XslNode node = instructions[i];
                XslNodeType nodeType = node.NodeType;
                if (nodeType == XslNodeType.Param)
                {
                    continue; // already compiled by CompileProtoTemplate()
                }
                QilList nsList = EnterScope(node);
                QilNode result;

                switch (nodeType)
                {
                    case XslNodeType.ApplyImports: result = CompileApplyImports(node); break;
                    case XslNodeType.ApplyTemplates: result = CompileApplyTemplates((XslNodeEx)node); break;
                    case XslNodeType.Attribute: result = CompileAttribute((NodeCtor)node); break;
                    case XslNodeType.CallTemplate: result = CompileCallTemplate((XslNodeEx)node); break;
                    case XslNodeType.Choose: result = CompileChoose(node); break;
                    case XslNodeType.Comment: result = CompileComment(node); break;
                    case XslNodeType.Copy: result = CompileCopy(node); break;
                    case XslNodeType.CopyOf: result = CompileCopyOf(node); break;
                    case XslNodeType.Element: result = CompileElement((NodeCtor)node); break;
                    case XslNodeType.Error: result = CompileError(node); break;
                    case XslNodeType.ForEach: result = CompileForEach((XslNodeEx)node); break;
                    case XslNodeType.If: result = CompileIf(node); break;
                    case XslNodeType.List: result = CompileList(node); break;
                    case XslNodeType.LiteralAttribute: result = CompileLiteralAttribute(node); break;
                    case XslNodeType.LiteralElement: result = CompileLiteralElement(node); break;
                    case XslNodeType.Message: result = CompileMessage(node); break;
                    case XslNodeType.Nop: result = CompileNop(node); break;
                    case XslNodeType.Number: result = CompileNumber((Number)node); break;
                    //              case XslNodeType.Otherwise:         wrapped by Choose
                    //              case XslNodeType.Param:             already compiled by CompileProtoTemplate()
                    case XslNodeType.PI: result = CompilePI(node); break;
                    //              case XslNodeType.Sort:              wrapped by ForEach or ApplyTemplates, see CompileSorts()
                    //              case XslNodeType.Template:          global level element
                    case XslNodeType.Text: result = CompileText((Text)node); break;
                    case XslNodeType.UseAttributeSet: result = CompileUseAttributeSet(node); break;
                    case XslNodeType.ValueOf: result = CompileValueOf(node); break;
                    case XslNodeType.ValueOfDoe: result = CompileValueOfDoe(node); break;
                    case XslNodeType.Variable: result = CompileVariable(node); break;
                    //              case XslNodeType.WithParam:         wrapped by CallTemplate or ApplyTemplates, see CompileWithParam()
                    default: Debug.Fail("Unexpected type of AST node: " + nodeType.ToString()); result = null; break;
                }

                ExitScope();
                Debug.Assert(result != null, "Result of compilation should not be null");
                if (result.NodeType == QilNodeType.Sequence && result.Count == 0)
                {
                    continue;
                }

                // Do not create sequence points for literal attributes and use-attribute-sets
                if (nodeType != XslNodeType.LiteralAttribute && nodeType != XslNodeType.UseAttributeSet)
                {
                    SetLineInfoCheck(result, node.SourceLine);
                }

                result = SetDebugNs(result, nsList);
                if (nodeType == XslNodeType.Variable)
                {
                    QilIterator var = _f.Let(result);
                    var.DebugName = node.Name.ToString();
                    _scope.AddVariable(node.Name, var);
                    // Process all remaining instructions in the recursive call
                    result = _f.Loop(var, CompileInstructions(instructions, i + 1));
                    i = instructions.Count;
                }

                content.Add(result);
            }
            if (!IsDebug && content.Count == 1)
            {
                return content[0];
            }
            return content;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:80,代码来源:QilGenerator.cs

示例4: FillupInvokeArgs

 // Fills invokeArgs with values from actualArgs in order given by formalArgs
 // Returns true if formalArgs maps 1:1 with actual args.
 // Formaly this is n*n algorithm. We can optimize it by calculationg "signature"
 // of the function as sum of all hashes of its args names.
 private bool FillupInvokeArgs(IList<QilNode> formalArgs, IList<XslNode> actualArgs, QilList invokeArgs)
 {
     if (actualArgs.Count != formalArgs.Count)
     {
         return false;
     }
     invokeArgs.Clear();
     for (int invArg = 0; invArg < formalArgs.Count; invArg++)
     {
         QilName formalArgName = ((QilParameter)formalArgs[invArg]).Name;
         XmlQueryType paramType = formalArgs[invArg].XmlType;
         QilNode arg = null;
         {
             for (int actArg = 0; actArg < actualArgs.Count; actArg++)
             {
                 Debug.Assert(actualArgs[actArg].NodeType == XslNodeType.WithParam, "All Sorts was removed in CompileSorts()");
                 VarPar withParam = (VarPar)actualArgs[actArg];
                 if (formalArgName.Equals(withParam.Name))
                 {
                     QilNode value = withParam.Value;
                     XmlQueryType valueType = value.XmlType;
                     if (valueType != paramType)
                     {
                         if (valueType.IsNode && paramType.IsNode && valueType.IsSubtypeOf(paramType))
                         {
                             // We can pass it
                         }
                         else
                         {
                             // Formal argument has the same name but a different type
                             return false;
                         }
                     }
                     arg = value;
                     break;
                 }
             }
         }
         if (arg == null)
         {
             // Formal argument has not been found among actual arguments
             return false;
         }
         invokeArgs.Add(arg);
     }
     // All arguments have been found
     return true;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:52,代码来源:QilGenerator.cs

示例5: CompileSort

        private void CompileSort(Sort sort, QilList keyList, ref LoopFocus parentLoop)
        {
            Debug.Assert(sort.NodeType == XslNodeType.Sort);
            QilNode select, select2, lang, order, caseOrder;
            bool fwdCompat;

            EnterScope(sort);
            fwdCompat = sort.ForwardsCompatible;

            select = CompileXPathExpression(sort.Select);

            if (sort.Lang != null || sort.DataType != null || sort.Order != null || sort.CaseOrder != null)
            {
                // Calculate these attributes in the context of the parent loop
                LoopFocus curLoopSaved = _curLoop;
                _curLoop = parentLoop;

                lang = CompileLangAttribute(sort.Lang, fwdCompat);

                CompileDataTypeAttribute(sort.DataType, fwdCompat, ref select, out select2);

                order = CompileOrderAttribute(
                    /*attName:  */  "order",
                    /*attValue: */  sort.Order,
                    /*value0:   */  "ascending",
                    /*value1:   */  "descending",
                    /*fwdCompat:*/  fwdCompat
                );

                caseOrder = CompileOrderAttribute(
                    /*attName:  */  "case-order",
                    /*attValue: */  sort.CaseOrder,
                    /*value0:   */  "lower-first",
                    /*value1:   */  "upper-first",
                    /*fwdCompat:*/  fwdCompat
                );

                // Restore loop context
                _curLoop = curLoopSaved;
            }
            else
            {
                select = _f.ConvertToString(select);
                select2 = lang = order = caseOrder = null;
            }

            _strConcat.Reset();
            _strConcat.Append(XmlReservedNs.NsCollationBase);
            _strConcat.Append('/');
            _strConcat.Append(lang);

            char separator = '?';
            if (order != null)
            {
                _strConcat.Append(separator);
                _strConcat.Append("descendingOrder=");
                _strConcat.Append(order);
                separator = '&';
            }
            if (caseOrder != null)
            {
                _strConcat.Append(separator);
                _strConcat.Append("upperFirst=");
                _strConcat.Append(caseOrder);
                separator = '&';
            }

            QilNode collation = _strConcat.ToQil();

            QilSortKey result = _f.SortKey(select, collation);
            // Line information is not copied
            keyList.Add(result);

            if (select2 != null)
            {
                result = _f.SortKey(select2, collation.DeepClone(_f.BaseFactory));
                // Line information is not copied
                keyList.Add(result);
            }

            ExitScope();
        }
开发者ID:Corillian,项目名称:corefx,代码行数:82,代码来源:QilGenerator.cs


注:本文中的System.Xml.Xsl.Qil.QilList.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。