Exemplo n.º 1
0
        private void WriteDefinition(UdnWriter Writer)
        {
            List <string> Lines = new List <string>();

            if (MetadataDirective != null)
            {
                Lines.AddRange(MetadataDirective.ToMarkdown());
            }

            StringBuilder Definition = new StringBuilder();

            if (IsStatic)
            {
                Definition.Append("static ");
            }
            if (IsMutable)
            {
                Definition.Append("mutable ");
            }
            Definition.Append(Type + " " + Name);
            if (Bitfield != "")
            {
                Definition.Append(": " + Bitfield);
            }
            if (ArgsString != "")
            {
                Definition.Append(ArgsString);
            }
            Definition.Append("  ");
            Lines.Add(Definition.ToString());

            WriteNestedSimpleCode(Writer, Lines);
        }
Exemplo n.º 2
0
        private void WriteDefinition(UdnWriter Writer)
        {
            List <string> Lines = new List <string>();

            if (MetadataDirective != null)
            {
                Lines.AddRange(MetadataDirective.ToMarkdown());
            }
            if (TemplateSignature != null)
            {
                Lines.Add(TemplateSignature);
            }
            if (BaseDefinitions.Count == 0)
            {
                Lines.Add(Definition);
            }
            else if (BaseDefinitions.Count == 1)
            {
                Lines.Add(Definition + " : " + BaseDefinitions[0]);
            }
            else
            {
                Lines.Add(Definition + " :");
                for (int Idx = 0; Idx < BaseDefinitions.Count; Idx++)
                {
                    Lines.Add(UdnWriter.TabSpaces + BaseDefinitions[Idx] + ((Idx < BaseDefinitions.Count - 1)? "," : ""));
                }
            }

            WriteNestedSimpleCode(Writer, Lines);
        }
Exemplo n.º 3
0
        private void WriteSyntax(UdnWriter Writer)
        {
            List <string> Lines = new List <string>();

            if (MetadataDirective != null)
            {
                Lines.AddRange(MetadataDirective.ToMarkdown());
            }
            if (!Utility.IsNullOrWhitespace(TemplateSignature))
            {
                Lines.Add(TemplateSignature);
            }

            string Keywords = "";

            if (IsVirtual)
            {
                Keywords += "virtual ";
            }
            if (IsStatic)
            {
                Keywords += "static ";
            }

            if (Parameters.Count > 0)
            {
                Lines.Add(Keywords + ReturnType + " " + Utility.EscapeText(Name));
                Lines.Add(Utility.EscapeText("("));
                for (int Idx = 0; Idx < Parameters.Count; Idx++)
                {
                    string Separator = (Idx + 1 == Parameters.Count) ? "" : ",";
                    Lines.Add(UdnWriter.TabSpaces + Parameters[Idx].Definition + Separator);
                }
                Lines.Add(Utility.EscapeText(")"));
            }
            else
            {
                Lines.Add(Keywords + ReturnType + " " + Utility.EscapeText(Name + "()"));
            }
            WriteNestedSimpleCode(Writer, Lines);
        }