Ejemplo n.º 1
0
        /// <summary>
        /// Resolves this type definition to its actual type. This has two applications:
        ///
        /// 1. For a type that is replaced by another type the other type will be returned.
        /// 2. For a <c>typedef</c> this returns the actual underlying type of the typedef.
        /// </summary>
        public override AbstractTypeDefinition ResolveType()
        {
            if (ReplaceByType != null)
            {
                return(ReplaceByType);
            }

            AbstractTypeDefinition expl = null;

            if (BaseTypeName.Contains("<") || BaseTypeName.Contains("std::") || Mogre17.IsCollection(BaseTypeName))
            {
                // Standard types
                expl = MetaDef.Factory.StandardTypesFactory.FindStandardType(this);
            }
            else if (Name == "String")
            {
                // Typdef "String", which is (obviously) a string.
                expl = new DefStringTypeDef(Namespace, SurroundingClass, DefiningXmlElement);
            }

            if (expl == null)
            {
                return(this);
            }

            expl.LinkAttributes(this);
            return(expl);
        }
Ejemplo n.º 2
0
        public void DumpXml(XmlWriter writer)
        {
            if (AbcDumpService.FilterClass(this))
            {
                return;
            }
            IsDumped = true;

            writer.WriteStartElement("instance");
            writer.WriteAttributeString("index", Index.ToString());

            if (Name != null)
            {
                writer.WriteAttributeString("name", Name.FullName);
            }

            //if (_superName != null)
            //    writer.WriteAttributeString("supername", _superName.FullName);
            //if (_name != null)
            //    writer.WriteElementString("name", _name.ToString());

            if (BaseTypeName != null)
            {
                writer.WriteElementString("super", BaseTypeName.ToString());
            }

            writer.WriteElementString("flags", Flags.ToString());

            if ((Flags & AbcClassFlags.ProtectedNamespace) != 0 && ProtectedNamespace != null)
            {
                writer.WriteStartElement("protectedNamespace");
                writer.WriteAttributeString("name", ProtectedNamespace.Name.Value);
                writer.WriteAttributeString("kind", ProtectedNamespace.Kind.ToString());
                writer.WriteEndElement();
            }

            if (_interfaces.Count > 0)
            {
                writer.WriteStartElement("interfaces");
                foreach (var i in _interfaces)
                {
                    writer.WriteStartElement("interface");
                    writer.WriteAttributeString("name", i.ToString());
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }

            if (_initializer != null)
            {
                if (AbcDumpService.DumpInitializerCode)
                {
                    bool old = AbcDumpService.DumpCode;
                    AbcDumpService.DumpCode = true;
                    _initializer.DumpXml(writer, "iinit");
                    AbcDumpService.DumpCode = old;
                }
                else
                {
                    writer.WriteElementString("iinit", _initializer.ToString());
                }
            }

            _traits.DumpXml(writer);

            if (_class != null)
            {
                _class.DumpXml(writer);
            }

            writer.WriteEndElement();
        }