Quirks

Swiss army knife for getting information about things.

Takes thing and tries to apply a list of functions and templates to it. All that compile can be accessed using property syntax on the resulting alias.

The code for this is generated during compile-time using traits and mixins. Below is a list of properties that are possible to access (note not all will be available for every instantiation):

  • attributes
  • fields -> see Fields
  • functionAttributes -> see FunctionAttributes
  • isAggregate -> see isAggregate
  • isArray -> see isArray
  • isAssociativeArray -> see isAssociativeArray
  • isBasic -> see isBasic
  • isModule -> see isModule
  • isNested
  • isNumeric -> see isNumeric
  • isSomeString -> see isSomeString
  • isStatic -> see isStatic
  • memberNames -> see MemberNames
  • members -> see Members
  • methods -> see Methods
  • name
  • parameters -> see Parameters
  • qualifiedName
  • returnType
  • simpleType -> see SimpleTypeOf
  • type

In addition, the following properties that require a template parameter are also available:

  • fieldsFilter(alias predicate) -> returns the fields property filtered with the given predicate
  • getUDAs(alias uda) -> returns the same as getUDAs from std.traits
  • getUDA(alias uda) -> returns the first result returned by getUDAs
  • hasField(alias predicate) -> see hasField
  • hasMember(alias predicate) -> see hasMember
  • hasMethod(alias predicate) -> see hasMethod
  • hasUDA(alias uda) -> return the same as hasUDA from std.traits
  • isInstanceOf(alias templ) -> see isInstanceOf
  • membersFilter(alias predicate) -> returns the members property filtered with the given predicate
  • methodsFilter(alias predicate) -> returns the methods property filtered with the given predicate
template Quirks (
alias thing_
) {}

Members

Aliases

Quirks
alias Quirks = value
Undocumented in source.
quirksAliasTuple
alias quirksAliasTuple = AliasSeq!("aggregates", q{Aggregates!thing}, "attributes", q{AliasTuple!(__traits(getAttributes, thing))}, "fields", q{Fields!thing}, "functionAttributes", q{FunctionAttributes!thing}, "isAggregate", q{quirks.type.isAggregate!type}, "isArray", q{quirks.type.isArray!type}, "isAssociativeArray", q{quirks.type.isAssociativeArray!type}, "isBasic", q{quirks.type.isBasic!type}, "isModule", q{quirks.type.isModule!type}, "isNested", q{isNested!type}, "isNumeric", q{quirks.type.isNumeric!type}, "isSomeFunction", q{quirks.type.isSomeFunction!type}, "isSomeString", q{quirks.type.isSomeString!type}, "isStatic", q{quirks.expression.isStatic!type}, "memberNames", q{MemberNames!thing}, "members", q{Members!thing}, "methods", q{Methods!thing}, "parameters", q{Parameters!thing}, "qualifiedName", q{std.traits.fullyQualifiedName!thing}, "returnType", q{std.traits.ReturnType!type}, "simpleType", q{SimpleTypeOf!thing}, q{fieldsFilter(alias predicate)}, q{Fields!(thing, predicate)}, q{getUDAs(alias uda)}, q{std.traits.getUDAs!(thing, uda)}, q{getUDA(alias uda)}, q{getUDAs!uda[0]}, q{hasField(alias predicate)}, q{quirks.aggregate.hasField!(thing, predicate)}, q{hasMember(alias predicate)}, q{quirks.aggregate.hasMember!(thing, predicate)}, q{hasMethod(alias predicate)}, q{quirks.aggregate.hasMethod!(thing, predicate)}, q{hasUDA(alias uda)}, q{std.traits.hasUDA!(thing, uda)}, q{isInstanceOf(alias templ)}, q{quirks.type.isInstanceOf(templ, thing)})
Undocumented in source.
quirksEnumTuple
alias quirksEnumTuple = AliasSeq!("name", q{__traits(identifier, thing)})
Undocumented in source.
quirksTemplateTuple
alias quirksTemplateTuple = AliasSeq!()
Undocumented in source.

Structs

QuirksStruct
struct QuirksStruct
Undocumented in source.

Examples

struct S {
    static long id;
    int age;
    static string name() {
        return "name";
    }
    void update(bool force) { }
}

Quirks!S.type; // S
Quirks!S.fields.length; // 2
Quirks!S.methods[1].name; //update
Quirks!S.isArray; // false
Quirks!S.methods[1].parameters[0].type; // bool

Meta