more.sdlreflection

Members

Enums

SdlReflection
enum SdlReflection

An enum of sdl reflection options to be used as custom attributes. If an option requires arguments pass then in as an argument list

Functions

debugSdlReflection
string debugSdlReflection(string object, string member, string message, bool submessage)
Undocumented in source. Be warned that the author may not have intended to support it.
parseSdlInto
void parseSdlInto(T obj, string sdl)
Undocumented in source. Be warned that the author may not have intended to support it.
parseSdlInto
void parseSdlInto(T obj, char[] sdl)
Undocumented in source. Be warned that the author may not have intended to support it.
parseSdlInto
void parseSdlInto(T obj, SdlWalker walker, char[] sdl, size_t depth)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

SdlSingularName
struct SdlSingularName

An SDL Reflection Attribute. If singularName is not specified, then it will try to determine the singularName by removing the ending 's' from the member name. If the member name does not end in an 's' it will assert an error if noSingularTags is not true. The singularName is used to determine what a tag-name should be when someone wants to list elements of the array one at a time in the SDL. For example, if the member is an array of strings called "names", the default singular will be "name".

Templates

AppenderElementType
template AppenderElementType(T)
Undocumented in source.

Examples

struct Person {
    string name;
    ushort age;
    string[] nicknames;
    auto children = appender!(Person[])();
    void reset() {
        name = null;
        age = 0;
        nicknames = null;
        children.clear();
    }
    void validate() {
        if(name == null) throw new Exception("person is missing the 'name' tag");
        if(age == 0) throw new Exception("person is missing the 'age' tag");
    }
}

char[] sdl;

// ...read SDL into char[] sdl

Person p;
parseSdlInto!Person(sdl);

Meta