Ejemplo n.º 1
0
 /// <summary>
 /// Defines a default-constructible <see cref="IMacro"/> in the given <see cref="IPreProcessor"/>.
 /// </summary>
 /// <typeparam name="TMacro">The type of the <see cref="IMacro"/> to define.</typeparam>
 /// <param name="preProcessor">The <see cref="IPreProcessor"/> to define the macro in.</param>
 /// <returns>The <see cref="IPreProcessor"/> to be able to chain calls.</returns>
 public static IPreProcessor Define <TMacro>(this IPreProcessor preProcessor)
     where TMacro : IMacro, new() => preProcessor.Define(_ => new TMacro());
Ejemplo n.º 2
0
 /// <summary>
 /// Defines the __COUNTER__ macro extension.
 /// </summary>
 /// <param name="preProcessor">The <see cref="IPreProcessor"/> to define the macro in.</param>
 /// <returns>The <see cref="IPreProcessor"/> to be able to chain calls.</returns>
 public static IPreProcessor DefineCounter(this IPreProcessor preProcessor) =>
 preProcessor.Define <CounterMacro>();
Ejemplo n.º 3
0
 /// <summary>
 /// Defines a new <see cref="IMacro"/> with a factory function in the given <see cref="IPreProcessor"/>.
 /// </summary>
 /// <param name="preProcessor">The <see cref="IPreProcessor"/> to define the macro in.</param>
 /// <param name="makeMacro">The factory function that constructs the <see cref="IMacro"/>.</param>
 /// <returns>The <see cref="IPreProcessor"/> to be able to chain calls.</returns>
 public static IPreProcessor Define(this IPreProcessor preProcessor, Func <IPreProcessor, IMacro> makeMacro)
 {
     preProcessor.Define(makeMacro(preProcessor));
     return(preProcessor);
 }