ExtensibleClassMixin

Mixin for classes that support extensions.

It just provides a simple container for extensions (ordered in the order provided by BaseExtension.order()) registering of extensions, and getting an extension based on its type.

Typical usage:

interface ISomeExtension : IExtension
{
    void someMethod ( );
}

class SomeExtensibleClass
{
    mixin ExtensibleClassMixin!(ISomeExtension);

    void something ( )
    {
        foreach (ext; this.extensions)
        {
            ext.someMethod();
        }
    }
}

TODO: Assert that ExtensionClass is derived from IExtension

Members

Functions

getExtension
Ext getExtension()

Get an extension based on its type.

registerExtension
void registerExtension(ExtensionClass ext)

Register a new extension, keeping extensions list sorted.

Variables

extensions
ExtensionClass[] extensions;

List of extensions. Will be kept sorted by extension order when using the registerExtension() method.

Meta