예제 #1
0
 internal SpecializedTypeReference (Specialization[] specializations) {
     if (specializations == null) throw new ArgumentNullException("specializations");
     this.specializations = specializations;
 }
예제 #2
0
        private static SpecializedTypeReference CreateSpecializedTypeReference (string api) {

            List<Specialization> specializations = new List<Specialization>();

            string text = String.Copy(api);

            // at the moment we are only handling one specialization; need to iterate

            int specializationStart = text.IndexOf('{');
            int specializationEnd = FindMatchingEndBracket(text, specializationStart);
            string list = text.Substring(specializationStart + 1, specializationEnd - specializationStart - 1);
            string[] types = SeperateTypes(list);
            string template = text.Substring(0, specializationStart) + String.Format("`{0}", types.Length);


            SimpleTypeReference templateReference = CreateSimpleTypeReference(template);
            TypeReference[] argumentReferences = new TypeReference[types.Length];
            for (int i = 0; i < types.Length; i++) {
                argumentReferences[i] = CreateTypeReference(types[i]);
            }
            Specialization specialization = new Specialization(templateReference, argumentReferences);

            specializations.Add(specialization);

            // end iteration

            return (new SpecializedTypeReference(specializations.ToArray()));
        }
예제 #3
0
        private void WriteSpecialization (Specialization specialization, DisplayOptions options, XmlWriter writer) {
            // write the type itself (without outer types, because those will be written be other calls to this routine)
            WriteSimpleType(specialization.TemplateType, (options & ~DisplayOptions.ShowTemplates), false, writer);

            // then write the template arguments
            WriteTemplateArguments(specialization.Arguments, writer);
        }
예제 #4
0
        private static Specialization CreateSpecialization (XPathNavigator node) {
            SimpleTypeReference template = CreateSimpleTypeReference(node);

            List<TypeReference> arguments = new List<TypeReference>();
            XPathNodeIterator specializationNodes = node.Select("specialization/*");
            foreach (XPathNavigator specializationNode in specializationNodes) {
                arguments.Add(CreateTypeReference(specializationNode));
            }

            Specialization specialization = new Specialization(template, arguments.ToArray());
            return(specialization);
        }