1 module nxt.typedoc;
2 
3 /** Returns: Documentation String for Enumeration Type $(D EnumType). */
4 string enumDoc(EnumType, string separator = `|`)() @safe pure nothrow
5 {
6     /* import std.traits: EnumMembers; */
7     /* return EnumMembers!EnumType.join(separator); */
8     /* auto subsSortingNames = EnumMembers!EnumType; */
9     auto x = __traits(allMembers, EnumType);
10     string doc = ``;
11     foreach (ix, name; x)
12     {
13         if (ix >= 1) { doc ~= separator; }
14         doc ~= name;
15     }
16     return doc;
17 }
18 
19 /** Returns: Default Documentation String for value $(D a) of for Type $(D T). */
20 string defaultDoc(T)(in T a) @safe pure
21 {
22     import std.conv: to;
23     return (` (type:` ~ T.stringof ~
24             `, default:` ~ to!string(a) ~
25             `).`) ;
26 }