Example #1
0
        /// <summary>
        /// Header type declaration
        /// </summary>
        /// <param name="typeDeclaration">type declaration</param>
        protected override void HeaderTypeDeclaration(TypeDeclaration typeDeclaration)
        {
            HadDefaultConstructor = false;
            HadConstructor        = false;
            IType type = typeDeclaration.Annotation <TypeResolveResult>().Type;

            Formatter.NameSpace = type.Namespace;
            if (!namespaces.ContainsKey(type.Namespace))
            {
                namespaces.Add(type.Namespace, type.Namespace);
            }
            OutputEntityType(typeDeclaration);
            TypeVisitor.FormatType(type);
            OutputParentage(typeDeclaration, type);
            Formatter.AddOpenBrace();
            if (typeDeclaration.ClassType != ClassType.Struct)
            {
                Formatter.AppendIndentedLine("public:");
            }
            foreach (var member in typeDeclaration.Members)
            {
                member.AcceptVisitor(this);
            }
            if (typeDeclaration.ClassType == ClassType.Struct && HadConstructor && !HadDefaultConstructor)
            {
                CreateDefaultConstructor(typeDeclaration);
            }
            Formatter.AddCloseBrace(true);
        }