#!/usr/bin/env dub
/+ dub.sdl:
name "property_tree_leaf_dispatch"
targetPath "build"
dflags "-preview=in" "-preview=dip1000"
buildType "checked" {
buildOptions "optimize" "inline" "debugInfo"
}
+/
/**
* Leaf dispatch and the metadata channel (forks D2 + D4).
*
* Under test:
* C4. A closed `static if` ladder over D's type space classifies every leaf
* into a small `LeafKind` the view can dispatch on, at compile time,
* with no registry and no dynamic dispatch surface.
* C5. A UDA vocabulary carries the rest — label, group, range, read-only,
* hidden — and a per-field OVERRIDE of the chosen editor is just a
* symbol resolved at compile time (the derive-crates' `custom_func_mut`).
* C6. What a UDA canNOT carry is a condition over the VALUE: `@ShowIf` has
* to be a function pointer evaluated per frame.
* C7. The escape hatch: a type the ladder cannot classify is `opaque`, and
* an opaque row is presented via its own `toString` — VS Code's
* `Complex` posture, which is also what read-only targets need.
* C27. Invalid metadata is a BUILD error, not a frame-time surprise: an
* `@Editor` whose symbol does not accept and emit the field's concrete
* leaf type, an `@Editor` on an `@opaqueValue` leaf, and a `@ShowIf`
* naming a missing member each fail compilation, shown by negative
* probes. (Added with the spec review: the earlier revision carried
* `@Editor` as a string name — a registry key — which the spec forbids.)
*
* Run: `dub run --single leaf-dispatch.d`
*/
module (module) property_tree_leaf_dispatchLeaf dispatch and the metadata channel (forks D2 + D4).
Under test:
C4. A closed static if ladder over D's type space classifies every leaf
into a small LeafKind the view can dispatch on, at compile time,
with no registry and no dynamic dispatch surface.
C5. A UDA vocabulary carries the rest — label, group, range, read-only,
hidden — and a per-field OVERRIDE of the chosen editor is just a
symbol resolved at compile time (the derive-crates' custom_func_mut).
C6. What a UDA canNOT carry is a condition over the VALUE: @ShowIf has
to be a function pointer evaluated per frame.
C7. The escape hatch: a type the ladder cannot classify is opaque, and
an opaque row is presented via its own toString — VS Code's
Complex posture, which is also what read-only targets need.
C27. Invalid metadata is a BUILD error, not a frame-time surprise: an
@Editor whose symbol does not accept and emit the field's concrete
leaf type, an @Editor on an @opaqueValue leaf, and a @ShowIf
naming a missing member each fail compilation, shown by negative
probes. (Added with the spec review: the earlier revision carried
@Editor as a string name — a registry key — which the spec forbids.)
Run
dub run --single leaf-dispatch.d
property_tree_leaf_dispatch;
import (package) stdstd.(module) std.convA one-stop shop for converting values from one type to another.
Category Functions Generic asOriginalType castFrom parse to toChars bitCast Strings text wtext dtext writeText writeWText writeDText hexString Numeric octal roundTo signed unsigned Exceptions ConvException ConvOverflowException
Source
std/conv.d
conv : (alias template) property_tree_leaf_dispatch.text = std.conv.text(T...)(T args) if (T.length > 0)Convenience functions for converting one or more arguments
of any type into text (the three character widths).
text;
import (package) stdstd.(module) std.traitsTemplates which extract information about types and symbols at compile time.
Category Templates Symbol Name traits fullyQualifiedName mangledName moduleName packageName Function traits isFunction arity functionAttributes hasFunctionAttributes functionLinkage FunctionTypeOf isSafe isUnsafe isFinal ParameterDefaults ParameterIdentifierTuple ParameterStorageClassTuple Parameters ReturnType SetFunctionAttributes variadicFunctionStyle Aggregate Type traits BaseClassesTuple BaseTypeTuple classInstanceAlignment EnumMembers FieldNameTuple Fields hasAliasing hasElaborateAssign hasElaborateCopyConstructor hasElaborateDestructor hasElaborateMove hasIndirections hasMember hasStaticMember hasNested hasUnsharedAliasing InterfacesTuple isInnerClass isNested MemberFunctionsTuple RepresentationTypeTuple TemplateArgsOf TemplateOf TransitiveBaseTypeTuple Type Conversion CommonType AllImplicitConversionTargets ImplicitConversionTargets CopyTypeQualifiers CopyConstness isAssignable isCovariantWith isImplicitlyConvertible isQualifierConvertible Type Constructors InoutOf ConstOf SharedOf SharedInoutOf SharedConstOf SharedConstInoutOf ImmutableOf QualifierOf Categories of types allSameType ifTestable isType isAggregateType isArray isAssociativeArray isAutodecodableString isBasicType isBoolean isBuiltinType isCopyable isDynamicArray isEqualityComparable isFloatingPoint isIntegral isNarrowString isConvertibleToString isNumeric isOrderingComparable isPointer isScalarType isSigned isSIMDVector isSomeChar isSomeString isStaticArray isUnsigned Type behaviours isAbstractClass isAbstractFunction isCallable isDelegate isExpressions isFinalClass isFinalFunction isFunctionPointer isInstanceOf isIterable isMutable isSomeFunction isTypeTuple General Types ForeachType KeyType Largest mostNegative OriginalType PointerTarget Signed Unconst Unshared Unqual Unsigned ValueType Promoted Misc lvalueOf rvalueOf Select select User-Defined Attributes hasUDA getUDAs getSymbolsByUDA
Source
std/traits.d
traits : (alias template) property_tree_leaf_dispatch.EnumMembers = std.traits.EnumMembers(E) if (is(E == enum))Retrieves the members of an enumerated type enum E.
Note
An enum can have multiple members which have the same value. If you want
to use EnumMembers to e.g. generate switch cases at compile-time,
you should use the NoDuplicates template to avoid
generating duplicate switch cases.
Note
Returned values are strictly typed with E. Thus, the following code
does not work without the explicit cast:
enum E : int { a, b, c }
int[] abc = cast(int[]) [ EnumMembers!E ];
Cast is not necessary if the type of the variable is inferred. See the
example below.
EnumMembers, (alias template) property_tree_leaf_dispatch.hasUDA = std.traits.hasUDA(alias symbol, alias attribute)Determine if a symbol has a given
user-defined attribute.
hasUDA, (alias template) property_tree_leaf_dispatch.getUDAs = std.traits.getUDAs(alias symbol, alias attribute)Gets the matching user-defined attributes
from the given symbol.
If the UDA is a type, then any UDAs of the same type on the symbol will
match. If the UDA is a template for a type, then any UDA which is an
instantiation of that template will match. And if the UDA is a value,
then any UDAs on the symbol which are equal to that value will match.
getUDAs, (alias template) property_tree_leaf_dispatch.isAggregateType = std.traits.isAggregateType(T)Detect whether type T is an aggregate type.
isAggregateType, (alias template) property_tree_leaf_dispatch.isArray = std.traits.isArray(T)Detect whether type T is an array (static or dynamic; for associative
arrays see isAssociativeArray).
isArray,
(alias template) property_tree_leaf_dispatch.isAssociativeArray = std.traits.isAssociativeArray(T)Detect whether T is an associative array type
See also: __traits(isAssociativeArray, T)
isAssociativeArray, (alias template) property_tree_leaf_dispatch.isBoolean = std.traits.isBoolean(T)Detect whether T is a built-in boolean type or enum of boolean base type.
isBoolean, (alias template) property_tree_leaf_dispatch.isFloatingPoint = std.traits.isFloatingPoint(T)Detect whether T is a built-in floating point type.
See also: __traits(isFloating, T)
isFloatingPoint, (alias template) property_tree_leaf_dispatch.isIntegral = std.traits.isIntegral(T)Detect whether T is a built-in integral type.
Integral types are byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent,
and enums with an integral type as its base type.
Note
this is not the same as __traits(isIntegral)
isIntegral, (alias template) property_tree_leaf_dispatch.isPointer = std.traits.isPointer(T)Detect whether type T is a pointer.
isPointer,
(alias template) property_tree_leaf_dispatch.isSomeString = std.traits.isSomeString(T)Detect whether T is one of the built-in string types.
The built-in string types are Char[], where Char is any of char,
wchar or dchar, with or without qualifiers.
Static arrays of characters (like char[80]) are not considered
built-in string types.
isSomeString, (alias template) property_tree_leaf_dispatch.OriginalType = std.traits.OriginalType(T)Strips off all enums from type T.
OriginalType;
@safe:
// ── the metadata vocabulary (C5) ─────────────────────────────────────────────
struct (struct) property_tree_leaf_dispatch.Labeldisplay name override
Label { (alias) object.string = stringstring (field) string property_tree_leaf_dispatch.Label.texttext; } /// display name override
struct (struct) property_tree_leaf_dispatch.Groupcategory
Group { (alias) object.string = stringstring (field) string property_tree_leaf_dispatch.Group.namename; } /// category
struct (struct) property_tree_leaf_dispatch.Rangenumeric bounds → slider/stepper
Range { double (field) double property_tree_leaf_dispatch.Range.lolo, (field) double property_tree_leaf_dispatch.Range.hihi, (field) double property_tree_leaf_dispatch.Range.stepstep = 0; } /// numeric bounds → slider/stepper
struct (struct) property_tree_leaf_dispatch.Doctooltip / details row
Doc { (alias) object.string = stringstring (field) string property_tree_leaf_dispatch.Doc.texttext; } /// tooltip / details row
enum (enum) property_tree_leaf_dispatch.hiddennever presented
hidden; /// never presented
enum (enum) property_tree_leaf_dispatch.readOnlypresented, never editable
readOnly; /// presented, never editable
struct (struct) property_tree_leaf_dispatch.Editor!(colorSwatch)force a leaf editor: a SYMBOL (C27)
Editor(alias fn) {} /// force a leaf editor: a SYMBOL (C27)
struct (struct) property_tree_leaf_dispatch.ShowIfa condition over the VALUE (C6)
ShowIf { (alias) object.string = stringstring (field) string property_tree_leaf_dispatch.ShowIf.condcond; } /// a condition over the VALUE (C6)
// ── the leaf classification (C4) ─────────────────────────────────────────────
enum (enum) property_tree_leaf_dispatch.LeafKindLeafKind : ubyte
{
(enum value) property_tree_leaf_dispatch.LeafKind.boolean = cast(ubyte)0uboolean, (enum value) property_tree_leaf_dispatch.LeafKind.integral = 1integral, (enum value) property_tree_leaf_dispatch.LeafKind.floating = 2floating, (enum value) property_tree_leaf_dispatch.LeafKind.text = 3text, (enum value) property_tree_leaf_dispatch.LeafKind.enumeration = 4enumeration, (enum value) property_tree_leaf_dispatch.LeafKind.opaque = 5opaque
}
template (template) property_tree_leaf_dispatch.leafKindOf(T)leafKindOf(T)
{
static if (is((alias) T = intT == enum)) enum (constant) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.leafKindOf!(property_tree_leaf_dispatch.FillKind) = LeafKind.enumerationleafKindOf = (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.enumeration = 4enumeration;
else static if ((template instance) std.traits.isBoolean!intisBoolean!(alias) T = intT) enum leafKindOf = LeafKind.boolean;
else static if ((template instance) std.traits.isIntegral!intisIntegral!(alias) T = intT) enum (constant) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.leafKindOf!int = LeafKind.integralleafKindOf = (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.integral = 1integral;
else static if ((template instance) std.traits.isFloatingPoint!(property_tree_leaf_dispatch.Handle)isFloatingPoint!(alias) T = property_tree_leaf_dispatch.HandleT) enum (constant) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.leafKindOf!double = LeafKind.floatingleafKindOf = (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.floating = 2floating;
else static if ((template instance) std.traits.isSomeString!(property_tree_leaf_dispatch.Handle)isSomeString!(alias) T = property_tree_leaf_dispatch.HandleT) enum (constant) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.leafKindOf!string = LeafKind.textleafKindOf = (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.text = 3text;
else enum (constant) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.leafKindOf!(property_tree_leaf_dispatch.Handle) = LeafKind.opaqueleafKindOf = (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.opaque = 5opaque;
}
/// Is `T` a leaf at all? Aggregates descend; everything else is a leaf — and
/// an aggregate that answers `toString` but has no presentable fields is an
/// opaque leaf, not a subtree (C7).
enum bool (constant) bool property_tree_leaf_dispatch.isLeaf!(property_tree_leaf_dispatch.Style) = falseIs T a leaf at all? Aggregates descend; everything else is a leaf — and
an aggregate that answers toString but has no presentable fields is an
opaque leaf, not a subtree (C7).
isLeaf(T) = !(template instance) std.traits.isAggregateType!(property_tree_leaf_dispatch.Style)isAggregateType!(alias) T = property_tree_leaf_dispatch.StyleT || (template instance) std.traits.isSomeString!(property_tree_leaf_dispatch.Style)isSomeString!(alias) T = property_tree_leaf_dispatch.StyleT
|| ((template instance) std.traits.hasUDA!(property_tree_leaf_dispatch.Style, property_tree_leaf_dispatch.opaqueValue)hasUDA!((alias) T = property_tree_leaf_dispatch.StyleT, (enum) property_tree_leaf_dispatch.opaqueValuea type marks ITSELF as never-descended
opaqueValue) && true);
enum (enum) property_tree_leaf_dispatch.opaqueValuea type marks ITSELF as never-descended
opaqueValue; /// a type marks ITSELF as never-descended
// ── what a row tells the view ────────────────────────────────────────────────
struct (struct) property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf)LeafPlan(T)
{
(alias) object.string = stringstring (field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).pathpath, (field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).labellabel, (field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).groupgroup, (field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).docdoc, (field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).typeNametypeName;
(enum) property_tree_leaf_dispatch.LeafKindLeafKind (field) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).kindkind;
(alias) object.string = stringstring (field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).editor"" = the kind's default editor
editor; /// "" = the kind's default editor
bool (field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).editableeditable;
bool (field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).hasRangehasRange;
(struct) property_tree_leaf_dispatch.Rangenumeric bounds → slider/stepper
Range (field) property_tree_leaf_dispatch.Range property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).rangerange;
(alias) object.string = stringstring[] (field) string[] property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).choicesenumeration members
choices; /// enumeration members
(alias) object.string = stringstring (field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).whythe @ShowIf source text, "" = unconditional
why; /// the @ShowIf source text, "" = unconditional
bool function(ref const (alias) T = property_tree_leaf_dispatch.BadShowIfT) @safe (field) bool function(ref const(property_tree_leaf_dispatch.BadShowIf)) @safe property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.BadShowIf).visiblenull = unconditional
visible; /// null = unconditional
}
/// The compile-time plan for one aggregate's leaves. Type-only template
/// parameter, per [`open-set-descent.d`](./open-set-descent.d).
(struct) property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style)LeafPlan!(alias) T = property_tree_leaf_dispatch.StyleT[] property_tree_leaf_dispatch.LeafPlan!(Style)[] property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style)(string prefix = "") pure nothrow @safeThe compile-time plan for one aggregate's leaves. Type-only template
parameter, per open-set-descent.d.
planOf(T)((alias) object.string = stringstring (parameter) string prefixprefix = "") pure nothrow
{
(struct) property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style)LeafPlan!(alias) T = property_tree_leaf_dispatch.StyleT[] (local variable) property_tree_leaf_dispatch.LeafPlan!(Style)[] rowsrows;
static foreach (name; __traits(allMembers, T))
{{
static if (__traits(compiles, typeof(__traits(getMember, T, name)))
&& !is(typeof(__traits(getMember, T, name)) == function))
{
alias (alias) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).F = stringF = typeof(__traits(getMember, T, name));
alias (alias field) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).M = string property_tree_leaf_dispatch.Style.nameM = __traits(getMember, T, name);
static if (!(template instance) property_tree_leaf_dispatch.Style.hasUDA!(name, property_tree_leaf_dispatch.hidden)hasUDA!((field) string property_tree_leaf_dispatch.Style.nameM, (enum) property_tree_leaf_dispatch.hiddennever presented
hidden))
{{
(struct) property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style)LeafPlan!(alias) T = property_tree_leaf_dispatch.StyleT (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp;
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).pathpath = (parameter) string prefixprefix.(field) ulong string.lengthlength ? (parameter) string prefixprefix ~ "." ~ name : (constant) string property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).name = "name"name;
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).typeNametypeName = (enum) property_tree_leaf_dispatch.FillKindF.(constant) string string.stringof = "string"stringof;
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).kindkind = (template instance) property_tree_leaf_dispatch.leafKindOf!stringleafKindOf!(alias) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).F = stringF;
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).editableeditable = !(template instance) property_tree_leaf_dispatch.Style.hasUDA!(name, property_tree_leaf_dispatch.readOnly)hasUDA!((field) string property_tree_leaf_dispatch.Style.nameM, (enum) property_tree_leaf_dispatch.readOnlypresented, never editable
readOnly);
static if ((template instance) property_tree_leaf_dispatch.Style.hasUDA!(name, property_tree_leaf_dispatch.Label)hasUDA!((field) string property_tree_leaf_dispatch.Style.nameM, (struct) property_tree_leaf_dispatch.Labeldisplay name override
Label))
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).labellabel = (constant) property_tree_leaf_dispatch.Label std.meta.Filter!(isDesiredUDA, Group("layout"), Label("H"), Range(0.0, 4096.0, 0.0)).arg = Label("H")getUDAs!((field) int property_tree_leaf_dispatch.Style.heightM, (struct) property_tree_leaf_dispatch.Labeldisplay name override
Label)[0].(field) string property_tree_leaf_dispatch.Label.texttext;
else
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).labellabel = (constant) string property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).name = "name"name;
static if ((template instance) property_tree_leaf_dispatch.Style.hasUDA!(name, property_tree_leaf_dispatch.Group)hasUDA!((field) string property_tree_leaf_dispatch.Style.nameM, (struct) property_tree_leaf_dispatch.Groupcategory
Group))
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).groupgroup = (constant) property_tree_leaf_dispatch.Group std.meta.Filter!(isDesiredUDA, Group("identity"), Doc("shown in the layer list")).arg = Group("identity")getUDAs!((field) string property_tree_leaf_dispatch.Style.nameM, (struct) property_tree_leaf_dispatch.Groupcategory
Group)[0].(field) string property_tree_leaf_dispatch.Group.namename;
static if ((template instance) property_tree_leaf_dispatch.Style.hasUDA!(name, property_tree_leaf_dispatch.Doc)hasUDA!((field) string property_tree_leaf_dispatch.Style.nameM, (struct) property_tree_leaf_dispatch.Doctooltip / details row
Doc))
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).docdoc = (constant) property_tree_leaf_dispatch.Doc std.meta.Filter!(isDesiredUDA, Group("identity"), Doc("shown in the layer list")).arg = Doc("shown in the layer list")getUDAs!((field) string property_tree_leaf_dispatch.Style.nameM, (struct) property_tree_leaf_dispatch.Doctooltip / details row
Doc)[0].(field) string property_tree_leaf_dispatch.Doc.texttext;
static if ((template instance) property_tree_leaf_dispatch.Style.hasUDA!(name, property_tree_leaf_dispatch.Range)hasUDA!((field) string property_tree_leaf_dispatch.Style.nameM, (struct) property_tree_leaf_dispatch.Rangenumeric bounds → slider/stepper
Range))
{
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).hasRangehasRange = true;
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) property_tree_leaf_dispatch.Range property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).rangerange = (constant) property_tree_leaf_dispatch.Range std.meta.Filter!(isDesiredUDA, Group("fill"), Range(0.0, 1.0, 0.01)).arg = Range(0.0, 1.0, 0.01)getUDAs!((field) double property_tree_leaf_dispatch.Style.opacityM, (struct) property_tree_leaf_dispatch.Rangenumeric bounds → slider/stepper
Range)[0];
}
static foreach (uda; __traits(getAttributes, M))
{{
static if (is((constant) property_tree_leaf_dispatch.Group property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).uda = Group("identity")uda == Editor!fn, alias fn))
{
// The override is a symbol, validated HERE at the walk
// (C27): it must accept and emit the field's concrete
// leaf type, and it cannot make an opaque leaf
// assignable — so no presentation can route around
// the dispatch through a loosely-typed editor.
static assert((template instance) property_tree_leaf_dispatch.leafKindOf!uintleafKindOf!(alias) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).F = uintF != (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.opaque = 5opaque,
name ~ ": @Editor cannot make an opaque leaf assignable");
static assert(is(typeof(fn(uint property_tree_leaf_dispatch.colorSwatch(uint v) pure nothrow @safeThe custom editor under test: accepts and emits the field's type. (The
spike cares about the typing seam, not the painting.)
F.uint property_tree_leaf_dispatch.colorSwatch(uint v) pure nothrow @safeThe custom editor under test: accepts and emits the field's type. (The
spike cares about the typing seam, not the painting.)
init)) : F),
name ~ ": @Editor symbol must accept and emit " ~ F.F.stringofstringof);
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).editor"" = the kind's default editor
editor = __traits(identifier, fn);
}
}}
static if ((template instance) property_tree_leaf_dispatch.Style.hasUDA!(name, property_tree_leaf_dispatch.ShowIf)hasUDA!((field) string property_tree_leaf_dispatch.Style.nameM, (struct) property_tree_leaf_dispatch.ShowIfa condition over the VALUE (C6)
ShowIf))
{
// The condition is a compile-time-checked EXPRESSION over
// the subject, not an untyped callback: it becomes a typed
// `@safe` predicate with no cast anywhere (C6).
enum (constant) string property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).src = "kind == FillKind.gradient"src = (constant) property_tree_leaf_dispatch.ShowIf std.meta.Filter!(isDesiredUDA, Group("fill"), ShowIf("kind == FillKind.gradient")).arg = ShowIf("kind == FillKind.gradient")getUDAs!((field) int property_tree_leaf_dispatch.Style.stopsM, (struct) property_tree_leaf_dispatch.ShowIfa condition over the VALUE (C6)
ShowIf)[0].(field) string property_tree_leaf_dispatch.ShowIf.condcond;
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).whythe @ShowIf source text, "" = unconditional
why = (constant) string property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).src = "kind == FillKind.gradient"src;
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool function(ref const(property_tree_leaf_dispatch.Style)) @safe property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).visiblenull = unconditional
visible = (ref const (alias) T = property_tree_leaf_dispatch.StyleT (parameter) const(property_tree_leaf_dispatch.Style) vv) @safe => mixin("v." ~ src);
}
static if (is((alias) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style).F = stringF == enum))
static foreach (e; EnumMembers!F)
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string[] property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).choicesenumeration members
choices ~= __traits(identifier, e);
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style)[] rowsrows ~= (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp;
}}
}
}}
return (local variable) property_tree_leaf_dispatch.LeafPlan!(Style)[] rowsrows;
}
/// The default editor for a kind — a closed set, chosen at compile time.
(alias) object.string = stringstring string property_tree_leaf_dispatch.defaultEditor(property_tree_leaf_dispatch.LeafKind k, bool hasRange, bool editable) pure nothrow @safeThe default editor for a kind — a closed set, chosen at compile time.
defaultEditor((enum) property_tree_leaf_dispatch.LeafKindLeafKind (parameter) property_tree_leaf_dispatch.LeafKind kk, bool (parameter) bool hasRangehasRange, bool (parameter) bool editableeditable) pure nothrow
{
if (!(parameter) bool editableeditable) return "readout";
final switch ((parameter) property_tree_leaf_dispatch.LeafKind kk)
{
case (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.boolean = cast(ubyte)0uboolean: return "checkbox";
case (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.integral = 1integral: return (parameter) bool hasRangehasRange ? "slider-int" : "stepper";
case (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.floating = 2floating: return (parameter) bool hasRangehasRange ? "slider" : "number";
case (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.text = 3text: return "line-edit";
case (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.enumeration = 4enumeration: return "picker";
case (enum) property_tree_leaf_dispatch.LeafKindLeafKind.(enum value) property_tree_leaf_dispatch.LeafKind.opaque = 5opaque: return "readout+escape"; // C7
}
}
// ── the subject ──────────────────────────────────────────────────────────────
enum (enum) property_tree_leaf_dispatch.FillKindFillKind { (enum value) property_tree_leaf_dispatch.FillKind.solid = 0solid, (enum value) property_tree_leaf_dispatch.FillKind.gradient = 1gradient, (enum value) property_tree_leaf_dispatch.FillKind.texture = 2texture }
/// A type that refuses to be descended into: presented by `toString` (C7).
@(enum) property_tree_leaf_dispatch.opaqueValuea type marks ITSELF as never-descended
opaqueValue struct (struct) property_tree_leaf_dispatch.HandleA type that refuses to be descended into: presented by toString (C7).
Handle
{
ulong (field) ulong property_tree_leaf_dispatch.Handle.bitsbits;
(alias) object.string = stringstring string property_tree_leaf_dispatch.Handle.toString() const pure @safetoString() const pure => string std.conv.text!(string, const(ulong), string)(string __param_0, const(ulong) __param_1, string __param_2) pure nothrow @safeConvenience functions for converting one or more arguments
of any type into text (the three character widths).
text("Handle(", (field) ulong property_tree_leaf_dispatch.Handle.bitsbits, ")");
}
struct (struct) property_tree_leaf_dispatch.StyleStyle
{
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("identity") @(struct) property_tree_leaf_dispatch.Doctooltip / details row
Doc("shown in the layer list")
(alias) object.string = stringstring (field) string property_tree_leaf_dispatch.Style.namename = "unnamed";
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("fill")
(enum) property_tree_leaf_dispatch.FillKindFillKind (field) property_tree_leaf_dispatch.FillKind property_tree_leaf_dispatch.Style.kindkind;
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("fill") @(struct) property_tree_leaf_dispatch.Rangenumeric bounds → slider/stepper
Range(0, 1, 0.01)
double (field) double property_tree_leaf_dispatch.Style.opacityopacity = 1;
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("fill") @(struct) property_tree_leaf_dispatch.ShowIfa condition over the VALUE (C6)
ShowIf("kind == FillKind.gradient")
int (field) int property_tree_leaf_dispatch.Style.stopsstops = 2;
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("layout") @(struct) property_tree_leaf_dispatch.Rangenumeric bounds → slider/stepper
Range(0, 4096)
int (field) int property_tree_leaf_dispatch.Style.widthwidth = 100;
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("layout") @(struct) property_tree_leaf_dispatch.Labeldisplay name override
Label("H") @(struct) property_tree_leaf_dispatch.Rangenumeric bounds → slider/stepper
Range(0, 4096)
int (field) int property_tree_leaf_dispatch.Style.heightheight = 100;
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("advanced") @(enum) property_tree_leaf_dispatch.readOnlypresented, never editable
readOnly
(struct) property_tree_leaf_dispatch.HandleA type that refuses to be descended into: presented by toString (C7).
Handle (field) property_tree_leaf_dispatch.Handle property_tree_leaf_dispatch.Style.handlehandle;
@(enum) property_tree_leaf_dispatch.hiddennever presented
hidden
uint (field) uint property_tree_leaf_dispatch.Style.revisionrevision;
@(struct) property_tree_leaf_dispatch.Groupcategory
Group("advanced") @(template instance) property_tree_leaf_dispatch.Editor!(colorSwatch)Editor!uint property_tree_leaf_dispatch.colorSwatch(uint v) pure nothrow @safeThe custom editor under test: accepts and emits the field's type. (The
spike cares about the typing seam, not the painting.)
colorSwatch
uint (field) uint property_tree_leaf_dispatch.Style.tinttint = 0xff00ff;
}
/// The custom editor under test: accepts and emits the field's type. (The
/// spike cares about the typing seam, not the painting.)
uint uint property_tree_leaf_dispatch.colorSwatch(uint v) pure nothrow @safeThe custom editor under test: accepts and emits the field's type. (The
spike cares about the typing seam, not the painting.)
colorSwatch(uint (parameter) uint vv) pure nothrow => (parameter) uint vv;
// ── C27: invalid metadata fails the build — negative probes ──────────────────
(alias) object.string = stringstring string property_tree_leaf_dispatch.wrongType(string s) pure nothrow @safewrongType((alias) object.string = stringstring (parameter) string ss) pure nothrow => (parameter) string ss;
(struct) property_tree_leaf_dispatch.HandleA type that refuses to be descended into: presented by toString (C7).
Handle property_tree_leaf_dispatch.Handle property_tree_leaf_dispatch.handleEditor(property_tree_leaf_dispatch.Handle h) pure nothrow @safehandleEditor((struct) property_tree_leaf_dispatch.HandleA type that refuses to be descended into: presented by toString (C7).
Handle (parameter) property_tree_leaf_dispatch.Handle hh) pure nothrow => (parameter) property_tree_leaf_dispatch.Handle hh;
struct (struct) property_tree_leaf_dispatch.BadEditorTypeBadEditorType { @(template instance) property_tree_leaf_dispatch.Editor!(wrongType)Editor!string property_tree_leaf_dispatch.wrongType(string s) pure nothrow @safewrongType uint (field) uint property_tree_leaf_dispatch.BadEditorType.tinttint; } // type mismatch
struct (struct) property_tree_leaf_dispatch.BadEditorOpaqueBadEditorOpaque { @(template instance) property_tree_leaf_dispatch.Editor!(handleEditor)Editor!property_tree_leaf_dispatch.Handle property_tree_leaf_dispatch.handleEditor(property_tree_leaf_dispatch.Handle h) pure nothrow @safehandleEditor (struct) property_tree_leaf_dispatch.HandleA type that refuses to be descended into: presented by toString (C7).
Handle (field) property_tree_leaf_dispatch.Handle property_tree_leaf_dispatch.BadEditorOpaque.handlehandle; } // opaque leaf
struct (struct) property_tree_leaf_dispatch.BadShowIfBadShowIf { int (field) int property_tree_leaf_dispatch.BadShowIf.kindkind; @(struct) property_tree_leaf_dispatch.ShowIfa condition over the VALUE (C6)
ShowIf("knid == 1") int (field) int property_tree_leaf_dispatch.BadShowIf.stopsstops; }
static assert(!__traits(compiles, (template instance) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.BadEditorType)planOf!(struct) property_tree_leaf_dispatch.BadEditorTypeBadEditorType()));
static assert(!__traits(compiles, (template instance) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.BadEditorOpaque)planOf!(struct) property_tree_leaf_dispatch.BadEditorOpaqueBadEditorOpaque()));
static assert(!__traits(compiles, (template instance) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.BadShowIf)planOf!(struct) property_tree_leaf_dispatch.BadShowIfBadShowIf()));
// ── driving ──────────────────────────────────────────────────────────────────
enum (constant) property_tree_leaf_dispatch.LeafPlan!(Style)[] property_tree_leaf_dispatch.plan = [LeafPlan("name", "name", "identity", "shown in the layer list", "string", LeafKind.text, null, true, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("kind", "kind", "fill", null, "FillKind", LeafKind.enumeration, null, true, false, Range(nan, nan, 0.0), ["solid", "gradient", "texture"], null, null), LeafPlan("opacity", "opacity", "fill", null, "double", LeafKind.floating, null, true, true, Range(0.0, 1.0, 0.01), null, null, null), LeafPlan("stops", "stops", "fill", null, "int", LeafKind.integral, null, true, false, Range(nan, nan, 0.0), null, "kind == FillKind.gradient", function (ref const(Style) v) pure nothrow @nogc @safe => v.kind == FillKind.gradient), LeafPlan("width", "width", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("height", "H", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("handle", "handle", "advanced", null, "Handle", LeafKind.opaque, null, false, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("tint", "tint", "advanced", null, "uint", LeafKind.integral, "colorSwatch", true, false, Range(nan, nan, 0.0), null, null, null)]plan = property_tree_leaf_dispatch.LeafPlan!(Style)[] property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.Style)(string prefix = "") pure nothrow @safeThe compile-time plan for one aggregate's leaves. Type-only template
parameter, per open-set-descent.d.
planOf!(struct) property_tree_leaf_dispatch.StyleStyle(); // ← the whole plan is a compile-time constant
void void D main() @safemain()
{
import (package) stdstd.(module) std.stdioCategory Symbols File handles _popen File isFileHandle openNetwork stderr stdin stdout Reading chunks lines readf readfln readln Writing toFile write writef writefln writeln Misc KeepTerminator LockType StdioException
Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio
is publically imported when importing std.stdio.
There are three layers of I/O:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
stdio : (alias template) writefln = std.stdio.writefln(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))Equivalent to $(D writef(fmt, args, '\n')).
writefln, (alias template) writeln = std.stdio.writeln(T...)(T args)Equivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Params:
args = the items to write to stdout
Throws:
In case of an I/O error, throws an $(LREF StdioException).
Example:
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
---
writeln;
void std.stdio.writefln!(char, ulong)(in char[] fmt, ulong __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln("C4/C5 — %s presented leaves, planned at compile time"
~ " (`revision` is @hidden and absent)\n", (constant) property_tree_leaf_dispatch.LeafPlan!(Style)[] property_tree_leaf_dispatch.plan = [LeafPlan("name", "name", "identity", "shown in the layer list", "string", LeafKind.text, null, true, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("kind", "kind", "fill", null, "FillKind", LeafKind.enumeration, null, true, false, Range(nan, nan, 0.0), ["solid", "gradient", "texture"], null, null), LeafPlan("opacity", "opacity", "fill", null, "double", LeafKind.floating, null, true, true, Range(0.0, 1.0, 0.01), null, null, null), LeafPlan("stops", "stops", "fill", null, "int", LeafKind.integral, null, true, false, Range(nan, nan, 0.0), null, "kind == FillKind.gradient", function (ref const(Style) v) pure nothrow @nogc @safe => v.kind == FillKind.gradient), LeafPlan("width", "width", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("height", "H", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("handle", "handle", "advanced", null, "Handle", LeafKind.opaque, null, false, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("tint", "tint", "advanced", null, "uint", LeafKind.integral, "colorSwatch", true, false, Range(nan, nan, 0.0), null, null, null)]plan.(field) ulong [LeafPlan("name", "name", "identity", "shown in the layer list", "string", LeafKind.text, null, true, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("kind", "kind", "fill", null, "FillKind", LeafKind.enumeration, null, true, false, Range(nan, nan, 0.0), ["solid", "gradient", "texture"], null, null), LeafPlan("opacity", "opacity", "fill", null, "double", LeafKind.floating, null, true, true, Range(0.0, 1.0, 0.01), null, null, null), LeafPlan("stops", "stops", "fill", null, "int", LeafKind.integral, null, true, false, Range(nan, nan, 0.0), null, "kind == FillKind.gradient", function (ref const(Style) v) pure nothrow @nogc @safe => v.kind == FillKind.gradient), LeafPlan("width", "width", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("height", "H", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("handle", "handle", "advanced", null, "Handle", LeafKind.opaque, null, false, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("tint", "tint", "advanced", null, "uint", LeafKind.integral, "colorSwatch", true, false, Range(nan, nan, 0.0), null, null, null)].lengthlength);
void std.stdio.writefln!(char, string, string, string, string, string, string)(in char[] fmt, string __param_1, string __param_2, string __param_3, string __param_4, string __param_5, string __param_6) @safeEquivalent to writef(fmt, args, '\n').
writefln("%-10s %-9s %-13s %-9s %-16s %s",
"label", "group", "type", "kind", "editor", "extra");
foreach ((parameter) property_tree_leaf_dispatch.LeafPlan!(Style) pp; (constant) property_tree_leaf_dispatch.LeafPlan!(Style)[] property_tree_leaf_dispatch.plan = [LeafPlan("name", "name", "identity", "shown in the layer list", "string", LeafKind.text, null, true, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("kind", "kind", "fill", null, "FillKind", LeafKind.enumeration, null, true, false, Range(nan, nan, 0.0), ["solid", "gradient", "texture"], null, null), LeafPlan("opacity", "opacity", "fill", null, "double", LeafKind.floating, null, true, true, Range(0.0, 1.0, 0.01), null, null, null), LeafPlan("stops", "stops", "fill", null, "int", LeafKind.integral, null, true, false, Range(nan, nan, 0.0), null, "kind == FillKind.gradient", function (ref const(Style) v) pure nothrow @nogc @safe => v.kind == FillKind.gradient), LeafPlan("width", "width", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("height", "H", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("handle", "handle", "advanced", null, "Handle", LeafKind.opaque, null, false, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("tint", "tint", "advanced", null, "uint", LeafKind.integral, "colorSwatch", true, false, Range(nan, nan, 0.0), null, null, null)]plan)
{
(alias) object.string = stringstring (local variable) string extraextra;
if ((local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).hasRangehasRange) (local variable) string extraextra ~= string std.conv.text!(string, double, string, double, string)(string __param_0, double __param_1, string __param_2, double __param_3, string __param_4) pure @safeConvenience functions for converting one or more arguments
of any type into text (the three character widths).
text("[", (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) property_tree_leaf_dispatch.Range property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).rangerange.(field) double property_tree_leaf_dispatch.Range.lolo, "..", (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) property_tree_leaf_dispatch.Range property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).rangerange.(field) double property_tree_leaf_dispatch.Range.hihi, "] ");
if ((local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string[] property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).choicesenumeration members
choices.(field) ulong string[].lengthlength) (local variable) string extraextra ~= string std.conv.text!(string[], string)(string[] __param_0, string __param_1) pure @safeConvenience functions for converting one or more arguments
of any type into text (the three character widths).
text((local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string[] property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).choicesenumeration members
choices, " ");
if (!(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).editableeditable) (local variable) string extraextra ~= "read-only ";
if ((local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool function(ref const(property_tree_leaf_dispatch.Style)) @safe property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).visiblenull = unconditional
visible !is null) (local variable) string extraextra ~= "if(" ~ (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).whythe @ShowIf source text, "" = unconditional
why ~ ") ";
if ((local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).docdoc.(field) ulong string.lengthlength) (local variable) string extraextra ~= "“" ~ (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).docdoc ~ "” ";
void std.stdio.writefln!(char, string, string, string, property_tree_leaf_dispatch.LeafKind, string, string)(in char[] fmt, string __param_1, string __param_2, string __param_3, property_tree_leaf_dispatch.LeafKind __param_4, string __param_5, string __param_6) @safeEquivalent to writef(fmt, args, '\n').
writefln("%-10s %-9s %-13s %-9s %-16s %s", (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).labellabel, (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).groupgroup, (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).typeNametypeName,
(local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).kindkind, (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).editor"" = the kind's default editor
editor.(field) ulong string.lengthlength ? (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).editor"" = the kind's default editor
editor ~ "*"
: string property_tree_leaf_dispatch.defaultEditor(property_tree_leaf_dispatch.LeafKind k, bool hasRange, bool editable) pure nothrow @safeThe default editor for a kind — a closed set, chosen at compile time.
defaultEditor((local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) property_tree_leaf_dispatch.LeafKind property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).kindkind, (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).hasRangehasRange, (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).editableeditable), (local variable) string extraextra);
}
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln("\nC6 — the same plan, filtered per frame against a live value:");
(struct) property_tree_leaf_dispatch.StyleStyle (local variable) property_tree_leaf_dispatch.Style ss;
foreach ((local variable) int twicetwice; 0 .. 2)
{
if ((local variable) int twicetwice) (local variable) property_tree_leaf_dispatch.Style ss.(field) property_tree_leaf_dispatch.FillKind property_tree_leaf_dispatch.Style.kindkind = (enum) property_tree_leaf_dispatch.FillKindFillKind.(enum value) property_tree_leaf_dispatch.FillKind.gradient = 1gradient;
(alias) object.string = stringstring[] (local variable) string[] visiblevisible;
foreach ((parameter) property_tree_leaf_dispatch.LeafPlan!(Style) pp; (constant) property_tree_leaf_dispatch.LeafPlan!(Style)[] property_tree_leaf_dispatch.plan = [LeafPlan("name", "name", "identity", "shown in the layer list", "string", LeafKind.text, null, true, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("kind", "kind", "fill", null, "FillKind", LeafKind.enumeration, null, true, false, Range(nan, nan, 0.0), ["solid", "gradient", "texture"], null, null), LeafPlan("opacity", "opacity", "fill", null, "double", LeafKind.floating, null, true, true, Range(0.0, 1.0, 0.01), null, null, null), LeafPlan("stops", "stops", "fill", null, "int", LeafKind.integral, null, true, false, Range(nan, nan, 0.0), null, "kind == FillKind.gradient", function (ref const(Style) v) pure nothrow @nogc @safe => v.kind == FillKind.gradient), LeafPlan("width", "width", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("height", "H", "layout", null, "int", LeafKind.integral, null, true, true, Range(0.0, 4096.0, 0.0), null, null, null), LeafPlan("handle", "handle", "advanced", null, "Handle", LeafKind.opaque, null, false, false, Range(nan, nan, 0.0), null, null, null), LeafPlan("tint", "tint", "advanced", null, "uint", LeafKind.integral, "colorSwatch", true, false, Range(nan, nan, 0.0), null, null, null)]plan)
if ((local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool function(ref const(property_tree_leaf_dispatch.Style)) @safe property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).visiblenull = unconditional
visible is null || (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) bool function(ref const(property_tree_leaf_dispatch.Style)) @safe property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).visiblenull = unconditional
visible((local variable) property_tree_leaf_dispatch.Style ss))
(local variable) string[] visiblevisible ~= (local variable) property_tree_leaf_dispatch.LeafPlan!(Style) pp.(field) string property_tree_leaf_dispatch.LeafPlan!(property_tree_leaf_dispatch.Style).labellabel;
void std.stdio.writefln!(char, property_tree_leaf_dispatch.FillKind, string[])(in char[] fmt, property_tree_leaf_dispatch.FillKind __param_1, string[] __param_2) @safeEquivalent to writef(fmt, args, '\n').
writefln(" kind=%-9s → %s", (local variable) property_tree_leaf_dispatch.Style ss.(field) property_tree_leaf_dispatch.FillKind property_tree_leaf_dispatch.Style.kindkind, (local variable) string[] visiblevisible);
}
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln("\nC7 — the opaque escape: a @opaqueValue type is a LEAF,");
void std.stdio.writefln!(char, property_tree_leaf_dispatch.Handle)(in char[] fmt, property_tree_leaf_dispatch.Handle __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln(" presented by its own toString: %s", (local variable) property_tree_leaf_dispatch.Style ss.(field) property_tree_leaf_dispatch.Handle property_tree_leaf_dispatch.Style.handlehandle);
void std.stdio.writefln!(char, bool, bool)(in char[] fmt, bool __param_1, bool __param_2) @safeEquivalent to writef(fmt, args, '\n').
writefln(" isLeaf!Handle = %s, isLeaf!Style = %s",
(template instance) property_tree_leaf_dispatch.isLeaf!(property_tree_leaf_dispatch.Handle)isLeaf!(struct) property_tree_leaf_dispatch.HandleA type that refuses to be descended into: presented by toString (C7).
Handle, (template instance) property_tree_leaf_dispatch.isLeaf!(property_tree_leaf_dispatch.Style)isLeaf!(struct) property_tree_leaf_dispatch.StyleStyle);
void std.stdio.writeln!string(string __param_0) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln("\nC27 — invalid metadata fails the BUILD, probed negatively:");
void std.stdio.writefln!(char, bool)(in char[] fmt, bool __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln(" @Editor symbol of the wrong type → compiles: %s",
__traits(compiles, (template instance) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.BadEditorType)planOf!(struct) property_tree_leaf_dispatch.BadEditorTypeBadEditorType()));
void std.stdio.writefln!(char, bool)(in char[] fmt, bool __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln(" @Editor on an @opaqueValue leaf → compiles: %s",
__traits(compiles, (template instance) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.BadEditorOpaque)planOf!(struct) property_tree_leaf_dispatch.BadEditorOpaqueBadEditorOpaque()));
void std.stdio.writefln!(char, bool)(in char[] fmt, bool __param_1) @safeEquivalent to writef(fmt, args, '\n').
writefln(" @ShowIf naming a missing member → compiles: %s",
__traits(compiles, (template instance) property_tree_leaf_dispatch.planOf!(property_tree_leaf_dispatch.BadShowIf)planOf!(struct) property_tree_leaf_dispatch.BadShowIfBadShowIf()));
}