Пример #1
0
 /// <summary>Appends a string, except newline ('\n') characters which are translated
 /// into calls to <see cref="Newline()"/>.</summary>
 public static ILNodePrinterHelper WriteSmartly(this ILNodePrinterHelper self, UString s)
 {
     do
     {
         int?iNewline = s.IndexOf('\n');
         if (iNewline == null)
         {
             return(self.Write(s));
         }
         else
         {
             self.Write(s.Slice(0, iNewline.Value));
             self.Newline();
             s = s.Slice(iNewline.Value + 1);
         }
     } while (s.Length != 0);
     return(self);
 }
Пример #2
0
 /// <summary>Creates an newline that cannot be revoked later by calling
 /// NewlineIsRequiredHere() followed by Newline().</summary>
 /// <remarks>This should be an extension method for <see cref="ILNodePrinterHelperWithRevokableNewlines{C,Helper}"/>
 /// but C# 9 fails to infer type argument C in that case.</remarks>
 public static ILNodePrinterHelper IrrevokableNewline(this ILNodePrinterHelper self)
 {
     self.NewlineIsRequiredHere();
     return(self.Newline());
 }
Пример #3
0
 /// <summary>NewlineOrSpace(true) appends a newline while NewlineOrSpace(false)
 /// appends a space.</summary>
 public static ILNodePrinterHelper NewlineOrSpace <Helper>(this ILNodePrinterHelper self, bool newline)
 {
     return(newline ? self.Newline() : self.Write(' '));
 }