Go to the documentation of this file.00001 package Doxygen::POD::Item::Over;
00002
00003 =head1 NAME
00004
00005 Doxygen::POD::Item::Over - Perl extension for generating Doxygen documentation
00006
00007 =head1 SYNOPSIS
00008
00009 my $item = new Doxygen::POD::Item::Over;
00010
00011 =head1 ABSTRACT
00012
00013 A block of source code in a POD source file.
00014
00015 =head1 DESCRIPTION
00016
00017 Represents a list of items which is indented in the displayed format.
00018 Provides three choices:
00019
00020 =over
00021
00022 =item *
00023
00024 Bulleted
00025
00026 =item *
00027
00028 Numbered
00029
00030 =item *
00031
00032 Named definitions
00033
00034 =back
00035
00036 This has three advantages:
00037
00038 =over
00039
00040 =item 1
00041
00042 First advantage
00043
00044 =item 2
00045
00046 Second advantage
00047
00048 =item 3
00049
00050 Third advantage
00051
00052 =back
00053
00054 =head1 METHODS
00055
00056 =over
00057
00058 =cut
00059
00060 use 5.005; # just to pick something, but not really tested
00061 use strict;
00062 use warnings;
00063 use UNIVERSAL qw(isa);
00064
00065 use base qw(Doxygen::POD::Item);
00066
00067 our $VERSION = '0.01';
00068
00069 use constant {
00070 TYPE_BULLET => 1,
00071 TYPE_NUMBER => 2,
00072 TYPE_NAMED => 3
00073 };
00074
00075 use constant TYPE_TAG => [
00076 undef,
00077 'ul',
00078 'ol',
00079 'dl'
00080 ];
00081
00082 ###########################################################################
00083 ###########################################################################
00084
00085 =item C<generate($self, %flags)>
00086
00087 Generates output understandable by doxygen to standard output.
00088
00089 In order to determine what type of list to generate,
00090 it is necessary to look at all of the contained items and
00091 figure out how they are supposed to be displayed.
00092 There are three cases we recognize:
00093
00094 =over
00095
00096 =item C<TYPE_BULLET>
00097
00098 The items in the list are bulleted.
00099 This corresponds to HTML C<ul> tags.
00100
00101 =item C<TYPE_NUMBER>
00102
00103 The items in the list are all numbered.
00104 This corresponds to HTML C<ol> tags.
00105
00106 =item C<TYPE_NAMED>
00107
00108 The items in the list are named,
00109 as defined terms.
00110 This corresponds to HTML C<dl> tags.
00111
00112 =back
00113
00114 These are conceived of as ordered, so that the presence of
00115 C<TYPE_NUMBER> will outrank C<TYPE_BULLET> and C<TYPE_NAMED>
00116 outranks both.
00117 It is not currently possible to mix them in the same list.
00118
00119 =cut
00120
00121 sub generate # $self, %flags
00122 {
00123 my ($self, %flags) = @_;
00124 my $text = $self->text($flags{which});
00125
00126 return # nothing there...
00127 unless isa($text, 'ARRAY')
00128 && @$text;
00129
00130 unless ($self->{type}) {
00131 # Need to figure out what type of list we represent:
00132 $self->{_item_count_} = 0;
00133
00134 for (@$text) {
00135 unless (isa($_, 'Doxygen::POD::Item')) {
00136 $flags{source}->log
00137 ('W', "Non-POD::Item in Over list: ", $_, "\n");
00138 next;
00139 }
00140
00141 next
00142 if $_->{disabled};
00143
00144 $self->{_item_count_}++;
00145
00146 my $type = TYPE_NAMED;
00147
00148 if ($_->{name} =~ /\s*[\*\+\-]\s*$/) {
00149 # Simple bullet type:
00150 $type = TYPE_BULLET;
00151 } elsif ($_->{name} =~ /\s*\d+\s*$/) {
00152 # Numbered item list:
00153 $type = TYPE_NUMBER;
00154 }
00155
00156 $self->{type} = $type
00157 unless $self->{type}
00158 && $self->{type} >= $type;
00159 }
00160 }
00161
00162 return
00163 unless $self->{_item_count_};
00164
00165 $flags{comment} = 1;
00166 $flags{named} = $self->{type} == TYPE_NAMED;
00167
00168 Doxygen::Item::genThing('<' . TYPE_TAG->[$self->{type}] . ">\n", %flags)
00169 if $self->{type};
00170
00171 $self->SUPER::generate
00172 (%flags, over => ($flags{over} ? " $flags{over}" : ' '));
00173
00174 Doxygen::Item::genThing('</' . TYPE_TAG->[$self->{type}] . ">\n", %flags)
00175 if $self->{type};
00176 }
00177
00178 ###########################################################################
00179 ###########################################################################
00180
00181 1
00182
00183 __END__
00184
00185 =back
00186
00187 =head1 SEE ALSO
00188
00189 DoxyFilt.pl Doxygen::Item Doxygen::POD::Item
00190
00191 =head1 AUTHOR
00192
00193 Marc M. Adkins, L<mailTo:Perl@Doorways.org>
00194
00195 =head1 COPYRIGHT AND LICENSE
00196
00197 Copyright 2004 by Marc M. Adkins
00198
00199 This library is free software; you can redistribute it and/or modify
00200 it under the same terms as Perl itself.
00201
00202 =cut