Exemple #1
0
        public Interface(Namespace parentNamespace, XmlBindings.Interface xmlData, Overrides.XmlBindings.Interface overrides, Dictionary <string, QualifiableType> typeDictionary)
        {
            Debug.Assert(xmlData.Name.StartsWith("I"));
            string unprefixed = xmlData.Name.Substring(1);

            m_stylizedName = Formatter.Prefix + unprefixed;

            m_innerName = "I" + parentNamespace.ApiName + unprefixed;

            m_nativeNameOfInheritanceParent = xmlData.Extends;

            if (overrides != null && overrides.IsProjectedAsAbstract)
            {
                m_stylizedName = "I" + Formatter.Prefix + unprefixed;
            }

            m_methods = new List <Method>();
            foreach (XmlBindings.Method xmlMethod in xmlData.Methods)
            {
                Method m = new Method(xmlMethod);
                m_methods.Add(m);
            }

            typeDictionary[parentNamespace.RawName + "::" + xmlData.Name] = this;
        }
Exemple #2
0
        public Interface(Namespace parentNamespace, XmlBindings.Interface xmlData, Overrides.XmlBindings.Interface overrides, Dictionary <string, QualifiableType> typeDictionary)
        {
            Debug.Assert(xmlData.Name.StartsWith("I"));
            string unprefixed = xmlData.Name.Substring(1);

            m_stylizedName = Formatter.Prefix + unprefixed;

            m_innerName = "I" + parentNamespace.ApiName + unprefixed;

            if (overrides != null && overrides.IsProjectedAsAbstract)
            {
                m_stylizedName = "I" + Formatter.Prefix + unprefixed;
            }

            typeDictionary[parentNamespace.RawName + "::" + xmlData.Name] = this;
        }
Exemple #3
0
        public Namespace(XmlBindings.Namespace xmlData, Overrides.XmlBindings.Namespace overrides, Dictionary <string, QualifiableType> typeDictionary, OutputDataTypes outputDataTypes)
        {
            m_rawName = xmlData.Name;

            if (overrides != null && overrides.NameOverride != null)
            {
                m_apiName = overrides.NameOverride;
            }
            else
            {
                m_apiName = xmlData.Name;
            }

            m_enums = new List <Enum>();
            foreach (XmlBindings.Enum enumXml in xmlData.Enums)
            {
                Overrides.XmlBindings.Enum overridesEnum = null;
                if (overrides != null)
                {
                    overridesEnum = overrides.Enums.Find(x => x.Name == enumXml.Name);
                }

                m_enums.Add(new Enum(this, enumXml, overridesEnum, typeDictionary, outputDataTypes));
            }

            m_structs = new List <Struct>();
            foreach (XmlBindings.Struct structXml in xmlData.Structs)
            {
                Overrides.XmlBindings.Struct overridesStruct = null;
                if (overrides != null)
                {
                    overridesStruct = overrides.Structs.Find(x => x.Name == structXml.Name);
                }

                m_structs.Add(new Struct(this, structXml, overridesStruct, typeDictionary, outputDataTypes));
            }

            m_interfaces = new List <Interface>();
            foreach (XmlBindings.Interface interfaceXml in xmlData.Interfaces)
            {
                Overrides.XmlBindings.Interface overridesInterface = null;
                if (overrides != null)
                {
                    overridesInterface = overrides.Interfaces.Find(x => x.Name == interfaceXml.Name);
                }

                m_interfaces.Add(new Interface(this, interfaceXml, overridesInterface, typeDictionary));
            }

            foreach (XmlBindings.Typedef t in xmlData.Typedefs)
            {
                // In the types XML, often times types are declared as one type,
                // then typedefs to something else, and referenced thereafter
                // as that second type. And so, typedefs must be handled here.
                //
                // In the XML, the 'Name' field in each typedef is unqualified,
                // but the 'From' field is qualified.
                // For example, <Typedef Name="COLOR_F" From="D2D::COLOR_F"/>
                //
                // So, the entries are added to the type dictionary here
                // under the qualified name.
                //
                string qualified = xmlData.Name + "::" + t.Name;
                typeDictionary[qualified] = typeDictionary[t.From];
            }
        }