private string GetTypeTemplateName(SimpleTypeReference type, int position) { TypeTarget target = targets[type.Id] as TypeTarget; if (target != null) { IList <string> templates = target.Templates; if (templates.Count > position) { return(templates[position]); } if (target.ContainingType != null) { return(GetTypeTemplateName(target.ContainingType, position)); } return("UTT"); } else { throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Unknown type reference '{0}'", type.Id)); } }
/// <summary> /// Write out a type target /// </summary> /// <param name="type">The type target information</param> /// <param name="options">The link display options</param> /// <param name="showOuterType">True to show the outer type, false if not</param> /// <param name="writer">The write to which the information is written</param> private void WriteTypeTarget(TypeTarget type, DisplayOptions options, bool showOuterType, XmlWriter writer) { // write namespace, if containers are requested if ((options & DisplayOptions.ShowContainer) > 0) { WriteNamespace(type.ContainingNamespace, writer); WriteSeparator(writer); } // write outer type, if one exists if (showOuterType && (type.ContainingType != null)) { WriteSimpleType(type.ContainingType, DisplayOptions.Default, writer); WriteSeparator(writer); } // write the type name writer.WriteString(type.Name); // write if template parameters, if they exist and we are requested if ((options & DisplayOptions.ShowTemplates) > 0) { WriteTemplateParameters(type.Templates, writer); } }
private string GetTemplateName(string templateId, int position) { Target target = targets[templateId]; if (target != null) { TypeTarget type = target as TypeTarget; if (type != null) { IList <string> templates = type.Templates; if (templates.Count > position) { return(templates[position]); } } else { MethodTarget method = target as MethodTarget; if (method != null) { IList <string> templates = method.Templates; if (templates.Count > position) { return(templates[position]); } } } } return("UTT"); }
private void WriteSimpleType(SimpleTypeReference simple, DisplayOptions options, bool showOuterType, XmlWriter writer) { TypeTarget type = targets[simple.Id] as TypeTarget; if (type != null) { WriteTypeTarget(type, options, showOuterType, writer); } else { TextReferenceUtilities.WriteSimpleTypeReference(simple, options, writer); } }
/// <summary> /// Write out a type target /// </summary> /// <param name="type">The type target information</param> /// <param name="options">The link display options</param> /// <param name="writer">The write to which the information is written</param> public void WriteTypeTarget(TypeTarget type, DisplayOptions options, XmlWriter writer) { if (type == null) { throw new ArgumentNullException("type"); } if (writer == null) { throw new ArgumentNullException("writer"); } WriteTypeTarget(type, options, true, writer); }
/// <summary> /// Write out the target link information /// </summary> /// <param name="target">The target for which to write link information</param> /// <param name="options">The link display options</param> /// <param name="writer">The write to which the information is written</param> public void WriteTarget(Target target, DisplayOptions options, XmlWriter writer) { if (target == null) { throw new ArgumentNullException("target"); } if (writer == null) { throw new ArgumentNullException("writer"); } NamespaceTarget space = target as NamespaceTarget; if (space != null) { WriteNamespaceTarget(space, writer); return; } TypeTarget type = target as TypeTarget; if (type != null) { WriteTypeTarget(type, options, writer); return; } MemberTarget member = target as MemberTarget; if (member != null) { WriteMemberTarget(member, options, writer); return; } if (target.Id.StartsWith("R:", StringComparison.OrdinalIgnoreCase)) { WriteInvalid(new InvalidReference(target.Id), writer); return; } throw new InvalidOperationException("Unknown target type"); }
private static TypeTarget CreateTypeTarget(XPathNavigator api) { string subgroup = (string)api.Evaluate(apiSubgroupExpression); TypeTarget target; if (subgroup == "enumeration") { target = CreateEnumerationTarget(api); } else { target = new TypeTarget(); } target.Name = (string)api.Evaluate(apiNameExpression); // Containing namespace XPathNavigator namespaceNode = api.SelectSingleNode(apiContainingNamespaceExpression); target.ContainingNamespace = CreateNamespaceReference(namespaceNode); // Containing type, if any XPathNavigator typeNode = api.SelectSingleNode(apiContainingTypeExpression); if (typeNode == null) { target.ContainingType = null; } else { target.ContainingType = CreateSimpleTypeReference(typeNode); } // Templates target.Templates = GetTemplateNames(api); return(target); }
private static TypeTarget CreateTypeTarget(XPathNavigator api) { string subgroup = (string)api.Evaluate(apiSubgroupExpression); TypeTarget target; if(subgroup == "enumeration") target = CreateEnumerationTarget(api); else target = new TypeTarget(); target.Name = (string)api.Evaluate(apiNameExpression); // Containing namespace XPathNavigator namespaceNode = api.SelectSingleNode(apiContainingNamespaceExpression); target.ContainingNamespace = CreateNamespaceReference(namespaceNode); // Containing type, if any XPathNavigator typeNode = api.SelectSingleNode(apiContainingTypeExpression); if(typeNode == null) target.ContainingType = null; else target.ContainingType = CreateSimpleTypeReference(typeNode); // Templates target.Templates = GetTemplateNames(api); return target; }
/// <summary> /// Write out a type target /// </summary> /// <param name="type">The type target information</param> /// <param name="options">The link display options</param> /// <param name="showOuterType">True to show the outer type, false if not</param> /// <param name="writer">The write to which the information is written</param> private void WriteTypeTarget(TypeTarget type, DisplayOptions options, bool showOuterType, XmlWriter writer) { // write namespace, if containers are requested if((options & DisplayOptions.ShowContainer) > 0) { WriteNamespace(type.ContainingNamespace, writer); WriteSeparator(writer); } // write outer type, if one exists if(showOuterType && (type.ContainingType != null)) { WriteSimpleType(type.ContainingType, DisplayOptions.Default, writer); WriteSeparator(writer); } // write the type name writer.WriteString(type.Name); // write if template parameters, if they exist and we are requested if((options & DisplayOptions.ShowTemplates) > 0) { WriteTemplateParameters(type.Templates, writer); } }
/// <summary> /// Write out a type target /// </summary> /// <param name="type">The type target information</param> /// <param name="options">The link display options</param> /// <param name="writer">The write to which the information is written</param> public void WriteTypeTarget(TypeTarget type, DisplayOptions options, XmlWriter writer) { if(type == null) throw new ArgumentNullException("type"); if(writer == null) throw new ArgumentNullException("writer"); WriteTypeTarget(type, options, true, writer); }