Icon for Dimension.orgIcon for TalentIcon for ToolsIcon for Doorways.org
Icon for ToolsIcon for Perl Tools

DoxyFilt: Item/Class/Class.pm Source File

  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

Item/Class/Class.pm

Go to the documentation of this file.
00001 package Doxygen::Item::Class;
00002 
00003 =head1 NAME
00004 
00005 Doxygen::Item::Class - Perl extension for generating Doxygen documentation
00006 
00007 =head1 SYNOPSIS
00008 
00009     my  $cls = new Doxygen::Item::Class;
00010 
00011 =head1 ABSTRACT
00012 
00013 A Doxygen::Item::Class object represents an imaginary C++ class for
00014 processing by the Doxygen documentation system.
00015 These objects should be created by a specific source-language filter
00016 (subclass of Doxygen::Filter, named Doxygen::I<language>::Filter)
00017 when processing a source file.
00018 
00019 =head1 DESCRIPTION
00020 
00021 =head1 METHODS
00022 
00023 =over
00024 
00025 =cut
00026 
00027 use     5.005;  # just to pick something, but not really tested
00028 use     strict;
00029 use     warnings;
00030 use     UNIVERSAL   qw(isa);
00031 
00032 use     base qw(Doxygen::Item);
00033 
00034 our $VERSION = '0.01';
00035 
00036 ###########################################################################
00037 ###########################################################################
00038 
00039 =item   C<massage($self, $source)>
00040 
00041 Massage all functions in the class.
00042 
00043 =cut
00044 
00045 sub massage     # $self, $source
00046 {
00047     my ($self, $source) = @_;
00048     
00049     $_->massage($source)
00050         for $self->items('function');
00051 }
00052 
00053 ###########################################################################
00054 ###########################################################################
00055 
00056 =item   C<generate($self, %flags)>
00057 
00058 Generates output understandable by doxygen to standard output.
00059 
00060 =cut
00061 
00062 sub generate    # $self, %flags
00063 {
00064     my ($self, %flags) = @_;
00065     my  $name = $self->{name};
00066     my  @name = split /:+/, $name;
00067     my  $tail = "};\n\n";
00068     
00069     $name = pop @name;
00070     
00071     $flags{indent} = '' unless defined $flags{indent};
00072     
00073     for (@name) {
00074         print "$flags{indent}namespace $_\n";
00075         print "$flags{indent}\{\n";
00076         $tail = "\};\n$flags{indent}$tail";
00077         $flags{indent} .= '    ';
00078     }
00079     
00080     $tail = "$flags{indent}$tail";
00081 
00082     print "$flags{indent}/**\n";
00083     print "$flags{indent} * \\class $name\n";
00084     $self->genComment(%flags);
00085     print "$flags{indent} */\n\n";
00086     print "$flags{indent}class $name";
00087     
00088     my  $sep = "\n$flags{indent}: ";
00089     
00090 #   print STDERR "Ancestors:  ", $self->{ancestors}, "\n";
00091     
00092     for (@{$self->{ancestors}}) {
00093         print "${sep}public $_";
00094         
00095         $sep = ",\n$flags{indent}  "
00096             if $sep =~ /:/;
00097     }
00098     
00099     print "\n$flags{indent}\{\n";
00100     print "$flags{indent}  public:\n";
00101     
00102     my  $first = 1;
00103     
00104     for my $arg (@{$self->{arguments}}) {
00105         next
00106             if $arg eq 'self'
00107             || $arg eq 'this'
00108             || $arg eq 'class';
00109         
00110         if ($first) {
00111             undef $first;
00112         } else {
00113             print ', ';
00114         }
00115         
00116         print "void * $arg";
00117     }
00118     
00119     $flags{indent} .= '    ';
00120     $self->SUPER::generate(%flags);
00121     print $tail;
00122 }
00123 
00124 ###########################################################################
00125 ###########################################################################
00126 
00127 =item   C<ancestor($self, $ancestor)>
00128 
00129 Set ancestor for class object.
00130 
00131 =cut
00132 
00133 sub ancestor    # $self, $ancestor
00134 {
00135     my ($self, $ancestor) = @_;
00136     
00137 #   print STDERR __PACKAGE__, "::ancestor($ancestor)\n";
00138     
00139   ancestor:
00140     for my $anc (split /(?:\s*,)?\s+/, $ancestor) {
00141         for my $have (@{$self->{ancestors}}) {
00142             next ancestor
00143                 if $have eq $anc;
00144         }
00145         
00146         push @{$self->{ancestors}}, $anc;
00147     }
00148 }
00149 
00150 ###########################################################################
00151 ###########################################################################
00152 
00153 1
00154 
00155 __END__
00156 
00157 =back
00158 
00159 =head1 SEE ALSO
00160 
00161 DoxyFilt.pl, Doxygen::Item, Doxygen::Filter
00162 
00163 =head1 AUTHOR
00164 
00165 Marc M. Adkins, L<mailto:Perl@Doorways.org>
00166 
00167 =head1 COPYRIGHT AND LICENSE
00168 
00169 Copyright 2004-2010 by Marc M. Adkins
00170 
00171 This library is free software; you can redistribute it and/or modify
00172 it under the same terms as Perl itself.
00173 
00174 =cut

Generated on Mon Dec 27 2010 15:15:39 for DoxyFilt by  doxygen 1.7.1

www.dimension.org logo

(C)opyright 1998 - 2012 Dimension.org

WebMaster