One really cool feature that I would really love to see in LibReflection is attributes (or annotations) that can be applied on reflective Properties, Fields, or Methods.
// Declare a reflective property
PROPERTY( int, Length );
// Add attributes to the property
ATTRIBUTE( Length, "EditReadOnly", true );
ATTRIBUTE( Length, "DefaultValue", 0 );
ATTRIBUTE( Length, "Description", "The length of the string" );
Where the attribute takes several parameters:
- Name of the property, field, or method to apply the attribute to,
- The name of the attribute as a string,
- The value of the attribute (either as a string, or the actual type depending on the attribute)
This way, we can use these values as hints as to how the properties, or fields should be used in an editor for example. Other attributes can be applied to methods to describe things like how a method should be executed. For example, an attribute called "Client" specifies that a method should be executed only on the client process, while an attribute of "Server" describes a method that should only be executed on the server process. This would be very useful for game engine programming for example.
Last Visit: 31-Dec-99 18:00 Last Update: 16-Sep-14 10:08