Class XmlCodeWriter
The emitting side of the code generator: indentation, fluent-verb lines, literal rules
(§3.2 — raw strings for anything with quotes or templates, never manual escaping) and typed
arguments (§3.3 — s, enums and types print as code, not strings).
Contributions print their element through this writer and recurse into children via
.
public sealed class XmlCodeWriter
Inheritance
Properties
Methods
CloseBranch(string, string?)
Closes a branch opened by .
public void CloseBranch(string name, string? closeVerb = null)
Config(string)
A configuration statement on the current receiver (no element mapping).
public XmlCodeWriter Config(string call)
EnumRef<T>(T)
An enum member reference.
public static string EnumRef<T>(T value) where T : struct, Enum
Expr(string)
An expression argument: the route-language string wrapped in Expr(...).
public static string Expr(string template)
MapTo(XElement)
In machine style, a #line directive pointing diagnostics at the XML element
public XmlCodeWriter MapTo(XElement element)
OpenBranch(XElement, string, params string[])
Opens a branch child (when/catch) as a fresh variable on the current receiver.
public string OpenBranch(XElement element, string verb, params string[] args)
PrintIdentity(XElement)
The trailing identity the parser applies: Id()/Description() on the
public XmlCodeWriter PrintIdentity(XElement element)
PrintStep(XElement)
Prints one element through its registered contribution.
public XmlCodeWriter PrintStep(XElement element)
PrintSteps(XElement)
Prints every child element as a step through its registered contribution.
public XmlCodeWriter PrintSteps(XElement parent)
PushRoot(string, XElement, string)
Pushes the root receiver (the route or builder-level definition variable).
public string PushRoot(string declaration, XElement element, string prefix)
ReadResource(string)
Reads a file the way the loader would (schema bodies referenced by file=): the
public string ReadResource(string reference)
Scope(XElement, string, string[], string?, Action<XmlCodeWriter>?)
Prints a scope: a fresh variable opened from the current receiver, the children as
public XmlCodeWriter Scope(XElement element, string openVerb, string[] args, string? closeVerb, Action<XmlCodeWriter>? body = null)
Str(string)
A C# string literal: plain when harmless, raw """…""" otherwise.
public static string Str(string value)
Ts(TimeSpan)
A as code (§3.3): round values by unit, otherwise Parse.
public static string Ts(TimeSpan value)
TypeRef(string)
A typeof(...) when the type resolves now; the runtime lookup otherwise.
public static string TypeRef(string typeName)
Value(string)
A markup value= as code: a literal, or Placeholder("…") when it carries {{key}}.
public static string Value(string value)
Verb(XElement, string, params string[])
One statement on the current receiver: recv.Verb(args);.
public XmlCodeWriter Verb(XElement element, string verb, params string[] args)