24 Dec 2009 00:10:44 UTC
- Development release
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (5)
- Testers (68 / 0 / 15)
- KwaliteeBus factor: 0
- License: perl_5
- Activity24 month
- Download (809.92KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionCREAMYG Marvin Humphreyand 1 contributors
- Marvin Humphrey <marvin at rectangular dot com>
- COPYRIGHT AND LICENSE
Boilerplater::Method - Metadata describing an instance method.
Boilerplater::Method is a specialized subclass of Boilerplater::Function, with the first argument required to be an Obj.
When compiling Boilerplater code to C, Method objects generate all the code that Function objects do, but also create symbols for indirect invocation via VTable.
my $type = Boilerplater::Method->new( parcel => 'MyProject' # default: special class_name => 'MyProject::FooFactory', # required class_cnick => 'FooFact ', # default: special macro_sym => 'Count', # required return_type => $void_type # required param_list => $param_list, # required exposure => undef, # default: 'parcel' docucomment => $docucomment, # default: undef abstract => undef, # default: undef final => 1, # default: undef );
param_list - A Boilerplater::ParamList. The first element must be an object of the class identified by
macro_sym - The mixed case name which will be used when invoking the method.
abstract - Indicate whether the method is abstract.
final - Indicate whether the method is final.
parcel, class_name, class_cnick, return_type, docucomment, - see Boilerplater::Function.
Returns true if the method's class is the first in the inheritance hierarchy in which the method was declared -- i.e. the method is neither inherited nor overridden.
Return the Boilerplater::Type for
# e.g. "FooFactJr_Do_Stuff" my $short_sym = $method->short_method_sym("FooFactJr");
Returns the symbol used to invoke the method (minus the parcel Prefix).
# e.g. "MyProj_FooFactJr_Do_Stuff" my $full_sym = $method->full_method_sym("FooFactJr");
Returns the fully-qualified symbol used to invoke the method.
# e.g. "MyProj_FooFactJr_Do_Stuff_OFFSET" my $offset_sym = $method->full_offset_sym("FooFactJr");
Returns the fully qualified name of the variable which stores the method's vtable offset.
# e.g. "myproj_FooFactJr_do_stuff_CALLBACK" my $callback_sym = $method->full_calback_sym("FooFactJr");
Returns the fully qualified name of the variable which stores the method's Callback object.
# e.g. "myproj_FooFactJr_do_stuff_OVERRIDE" my $override_func_sym = $method->full_override_sym("FooFactJr");
Returns the fully qualified name of the function which implements the callback to the host in the event that a host method has been defined which overrides this method.
# e.g. "FooFactJr_do_stuff_t" my $short_typedef = $method->short_typedef;
Returns the typedef symbol for this method, which is derived from the class nick of the first class in which the method was declared.
# e.g. "myproj_FooFactJr_do_stuff_t" my $full_typedef = $method->full_typedef;
Returns the fully-qualified typedef symbol including parcel prefix.
Let the Method know that it is overriding a method which was defined in a parent class, and verify that the override is valid.
All methods start out believing that they are "novel", because we don't know about inheritance until we build the hierarchy after all files have been parsed. override() is a way of going back and relabeling a method as overridden when new information has become available: in this case, that a parent class has defined a method with the same name.
my $final_method = $method->finalize;
As with override, above, this is for going back and changing the nature of a Method after new information has become available -- typically, when we discover that the method has been inherited by a "final" class.
However, we don't modify the original Method as with override(). Inherited Method objects are shared between parent and child classes; if a shared Method object were to become final, it would interfere with its own inheritance. So, we make a copy, slightly modified to indicate that it is "final".
confess("Can't override") unless $method->compatible($other);
Returns true if the methods have signatures and attributes which allow one to override the other.
Copyright 2006-2009 Marvin Humphrey
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.