-
-
27 Aug 2010 01:10:56 UTC
- Development release
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (5)
- Testers (49 / 4 / 1)
- Kwalitee
Bus factor: 0- License: perl_5
- Activity
24 month- Tools
- Download (890.91KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Marvin Humphrey <marvin at rectangular dot com>
- Dependencies
- JSON::XS
- Lingua::Stem::Snowball
- Lingua::StopWords
- Parse::RecDescent
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- CONSTRUCTORS
- METHODS
- get_cnick get_struct_sym get_parent_class_name get_source_class get_docucomment get_parent get_autocode inert final
- set_parent
- add_child
- add_method
- function
- method
- novel_method
- children
- functions
- methods
- inert_vars
- member_vars
- novel_methods
- novel_member_vars
- grow_tree
- tree_to_ladder
- file_path
- include_h
- append_autocode
- vtable_var
- vtable_type
- full_vtable_var
- full_struct_sym
- COPYRIGHT AND LICENSE
NAME
Clownfish::Class - An object representing a single class definition.
CONSTRUCTORS
Clownfish::Class objects are stored as quasi-singletons, one for each unique parcel/class_name combination.
fetch_singleton
my $class = Clownfish::Class->fetch_singleton( parcel => 'Crustacean', class_name => 'Crustacean::Lobster::LobsterClaw', );
Retrieve a Class, if one has already been created.
create
my $class = Clownfish::Class->create( parcel => 'Crustacean', # default: special class_name => 'Crustacean::Lobster::LobsterClaw', # required cnick => 'LobClaw', # default: special exposure => 'public', # default: 'parcel' source_class => undef, # default: same as class_name parent_class_name => 'Crustacean::Claw', # default: undef inert => undef, # default: undef methods => \@methods, # default: [] functions => \@funcs, # default: [] member_vars => \@members, # default: [] inert_vars => \@inert_vars, # default: [] docucomment => $documcom, # default: undef, attributes => \%attributes, # default: {} );
Create and register a quasi-singleton. May only be called once for each unique parcel/class_name combination.
parcel, class_name, cnick, exposure - see Clownfish::Symbol.
source_class - The name of the class that owns the file in which this class was declared. Should be "Foo" if "Foo::FooJr" is defined in
Foo.cfh
.parent_class_name - The name of this class's parent class. Needed in order to establish the class hierarchy.
inert - Should be true if the class is inert, i.e. cannot be instantiated.
methods - An array where each element is a Clownfish::Method.
functions - An array where each element is a Clownfish::Method.
member_vars - An array where each element is a Clownfish::Variable and should be a member variable in each instantiated object.
inert_vars - An array where each element is a Clownfish::Variable and should be a shared (class) variable.
docucomment - A Clownfish::DocuComment describing this Class.
attributes - An arbitrary hash of attributes.
METHODS
get_cnick get_struct_sym get_parent_class_name get_source_class get_docucomment get_parent get_autocode inert final
Accessors.
set_parent
$class->set_parent($ancestor);
Set the parent class.
add_child
$class->add_child($child_class);
Add a child class.
add_method
$class->add_method($method);
Add a Method to the class. Valid only before grow_tree() is called.
function
my $do_stuff_function = $class->function("do_stuff");
Return the inert Function object for the supplied
micro_sym
, if any.method
my $pinch_method = $class->method("Pinch");
Return the Method object for the supplied
micro_sym
/macro_sym
, if any.novel_method
my $pinch_method = $class->novel_method("Pinch");
Return a Method object if the Method corresponding to the supplied string is novel.
children
my @child_classes = $class->children;
Return all child classes as a list.
functions
my @functions = $class->functions;
Return all (inert) functions as a list.
methods
my @methods = $class->methods;
Return all methods as a list.
inert_vars
my @inert_vars = $class->inert_vars;
Return all inert (shared, class) variables as a list.
member_vars
my @members = $class->member_vars;
Return all member variables as a list.
novel_methods
my @novel_methods = $class->novel_methods;
Return all novel methods as a list.
novel_member_vars
my @new_members = $class->novel_member_vars;
Return all novel member variables as a list.
grow_tree
$class->grow_tree;
Bequeath all inherited methods and members to children.
tree_to_ladder
my @ordered = $class->tree_to_ladder;
Return this class and all its child classes as an array, where all children appear after their parent nodes.
file_path
# /path/to/Foo/Bar.c, if source class is Foo::Bar. my $path = $class->file_path( '/path/to', '.c' );
Provide an OS-specific path for a file relating to this class could be found, by joining together the components of the
source_class
name.include_h
my $relative_path = $class->include_h;
Return a relative path to a C header file, appropriately formatted for a pound-include directive.
append_autocode
$class->append_autocode($code);
Append auxiliary C code.
vtable_var
The name of the global VTable object for this class.
vtable_type
The C type specifier for this class's vtable. Each vtable needs to have its own type because each has a variable number of methods at the end of the struct, and it's not possible to initialize a static struct with a flexible array at the end under C89.
full_vtable_var
Fully qualified vtable variable name, including the parcel prefix.
full_struct_sym
Fully qualified struct symbol, including the parcel prefix.
COPYRIGHT AND LICENSE
Copyright 2008-2010 Marvin Humphrey
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install KSx::Simple, copy and paste the appropriate command in to your terminal.
cpanm KSx::Simple
perl -MCPAN -e shell install KSx::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.