Beispiel #1
0
        private void WriteSimpleType(SimpleTypeReference simple, ReferenceLinkDisplayOptions options,
                                     bool showOuterType, XmlWriter writer)
        {
            TypeTarget type = simple.Resolve(_targets) as TypeTarget;

            if (type != null)
            {
                WriteTypeTarget(type, options, showOuterType, writer);
            }
            else
            {
                ReferenceTextUtilities.WriteSimpleTypeReference(simple, options, writer);
            }
        }
Beispiel #2
0
        private static EnumerationTarget CreateEnumerationTarget(XPathNavigator api, ReferenceLinkType linkType)
        {
            EnumerationTarget enumeration = new EnumerationTarget();

            string typeId = (string)api.Evaluate(topicIdExpression);
            string file   = (string)api.Evaluate(topicFileExpression);

            // Create tar
            List <MemberTarget> members      = new List <MemberTarget>();
            XPathNodeIterator   elementNodes = api.Select("elements/element");

            foreach (XPathNavigator elementNode in elementNodes)
            {
                string memberId = elementNode.GetAttribute("api", String.Empty);

                // try to get name from attribute on element node
                string memberName = elementNode.GetAttribute("name", String.Empty);
                if (String.IsNullOrEmpty(memberName))
                {
                    // if we can't do that, try to get the name by searching the file for the <api> element of that member
                    XPathNavigator memberApi = api.SelectSingleNode(String.Format(
                                                                        "following-sibling::api[@id='{0}']", memberId));
                    if (memberApi != null)
                    {
                        memberName = (string)memberApi.Evaluate(apiNameExpression);
                    }
                    else
                    {
                        // if all else fails, get the name by parsing the identifier
                        string arguments;
                        string type;
                        ReferenceTextUtilities.DecomposeMemberIdentifier(memberId,
                                                                         out type, out memberName, out arguments);
                    }
                }

                MemberTarget member = new MemberTarget();
                member.id             = memberId;                        // get Id from element
                member.file           = file;                            // get file from type file
                member.type           = linkType;
                member.name           = memberName;                      // get name from element
                member.containingType = new SimpleTypeReference(typeId); // get containing type from this type
                members.Add(member);
            }

            enumeration.elements = members;

            return(enumeration);
        }
Beispiel #3
0
        private void WriteSimpleMember(SimpleMemberReference member, ReferenceLinkDisplayOptions options,
                                       XmlWriter writer, IDictionary <IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            MemberTarget target = member.Resolve(_targets) as MemberTarget;

            if (target != null)
            {
                WriteMemberTarget(target, options, writer, dictionary);
            }
            else
            {
                ReferenceTextUtilities.WriteSimpleMemberReference(member, options, writer, this);
                //throw new InvalidOperationException(String.Format("Unknown member target '{0}'", member.Id));
            }
        }
Beispiel #4
0
        public void WriteNamespace(NamespaceReference spaceReference, ReferenceLinkDisplayOptions options,
                                   XmlWriter writer)
        {
            if (spaceReference == null)
            {
                throw new ArgumentNullException("spaceReference");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            NamespaceTarget spaceTarget = spaceReference.Resolve(_targets) as NamespaceTarget;

            if (spaceTarget != null)
            {
                WriteNamespaceTarget(spaceTarget, options, writer);
            }
            else
            {
                ReferenceTextUtilities.WriteNamespaceReference(spaceReference, options, writer);
            }
        }