示例#1
0
        protected override void WriteChildren(SwiftWriter writer)
        {
            var firstTime           = true;
            var previousValueHadDoc = false;

            foreach (var value in _values)
            {
                var hasDoc = !String.IsNullOrWhiteSpace(value.BriefComment);

                if (!firstTime)
                {
                    if (hasDoc)
                    {
                        writer.WriteLine("\t");
                    }
                    else if (previousValueHadDoc)
                    {
                        writer.WriteLine("\t");
                    }
                }

                value.WriteDeclaration(writer);

                firstTime           = false;
                previousValueHadDoc = hasDoc;
            }
        }
示例#2
0
        public void WriteDeclaration(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            SwiftComposite.WriteComment(1, writer, this.BriefComment);
            writer.WriteLine("\tcase {0} = {1}", _name, _value);
        }
示例#3
0
        public void WriteDeclaration(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            SwiftComposite.WriteComment(1, writer, this.BriefComment);
            writer.Write("\t{0} {1}: ", _isConstant ? "let" : "var", this.Name);
            this.Type.Write(writer);
            writer.WriteLine();
        }
示例#4
0
        public void WriteDefinition(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            WriteComment(0, writer, this.BriefComment);
            WriteKeyword(writer);
            writer.Write(" ");
            WriteDeclaration(writer, true);

            if (this.BaseType != null)
            {
                writer.Write(": ");
                this.BaseType.Write(writer);
            }

            writer.WriteLine(" {");
            WriteChildren(writer);
            writer.WriteLine("}");
        }
示例#5
0
        protected override void WriteChildren(SwiftWriter writer)
        {
            var firstTime = true;

            foreach (var property in _orderedProperties)
            {
                if (!firstTime)
                {
                    writer.WriteLine("\t");
                }

                property.WriteDeclaration(writer);

                firstTime = false;
            }
        }
示例#6
0
        internal static bool WriteComment(int indent, SwiftWriter writer, string comment)
        {
            bool wroteComment = false;

            if (!String.IsNullOrWhiteSpace(comment))
            {
                var lines = comment.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.None);

                foreach (var line in lines)
                {
                    writer.WriteLine("{0}/// {1}", new string('\t', indent), line.Trim());
                    wroteComment = true;
                }
            }

            return(wroteComment);
        }