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; } }
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); }
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(); }
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("}"); }
protected override void WriteChildren(SwiftWriter writer) { var firstTime = true; foreach (var property in _orderedProperties) { if (!firstTime) { writer.WriteLine("\t"); } property.WriteDeclaration(writer); firstTime = false; } }
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); }