[1980] | 1 | # ------------------------------------------------------------------------------ |
---|
| 2 | # (C) Crown copyright Met Office. All rights reserved. |
---|
| 3 | # For further details please refer to the file COPYRIGHT.txt |
---|
| 4 | # which you should have received as part of this distribution. |
---|
| 5 | # ------------------------------------------------------------------------------ |
---|
| 6 | use strict; |
---|
| 7 | use warnings; |
---|
| 8 | |
---|
| 9 | package Fcm::Keyword::Formatter::Entries; |
---|
| 10 | |
---|
| 11 | use Fcm::Keyword::Formatter::Entry; |
---|
| 12 | |
---|
| 13 | ################################################################################ |
---|
| 14 | # Constructor |
---|
| 15 | sub new { |
---|
| 16 | my ($class) = @_; |
---|
| 17 | return bless(\do{my $annon_scalar}, $class); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | ################################################################################ |
---|
| 21 | # Formats a keyword entry |
---|
| 22 | sub format { |
---|
| 23 | my ($self, $entries) = @_; |
---|
| 24 | my $formatter = Fcm::Keyword::Formatter::Entry->new(); |
---|
| 25 | my $return = q{}; |
---|
| 26 | for my $entry ( |
---|
| 27 | sort {$a->get_key() cmp $b->get_key()} |
---|
| 28 | grep {!$_->can('is_implied') || !$_->is_implied()} |
---|
| 29 | $entries->get_all_entries() |
---|
| 30 | ) { |
---|
| 31 | $return .= $formatter->format($entry); |
---|
| 32 | } |
---|
| 33 | return $return; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | 1; |
---|
| 37 | __END__ |
---|
| 38 | |
---|
| 39 | =head1 NAME |
---|
| 40 | |
---|
| 41 | Fcm::Keyword::Formatter::Entries |
---|
| 42 | |
---|
| 43 | =head1 SYNOPSIS |
---|
| 44 | |
---|
| 45 | use Fcm::Keyword::Formatter::Entries; |
---|
| 46 | $formatter = Fcm::Keyword::Formatter::Entries->new(); |
---|
| 47 | print($formatter->format($entries)); |
---|
| 48 | |
---|
| 49 | =head1 DESCRIPTION |
---|
| 50 | |
---|
| 51 | An object of this class is used to format a keyword entries object. |
---|
| 52 | |
---|
| 53 | =head1 METHODS |
---|
| 54 | |
---|
| 55 | =over 4 |
---|
| 56 | |
---|
| 57 | =item new() |
---|
| 58 | |
---|
| 59 | Constructor. |
---|
| 60 | |
---|
| 61 | =item format($entries) |
---|
| 62 | |
---|
| 63 | Returns a simple string representation of $entries. |
---|
| 64 | |
---|
| 65 | =back |
---|
| 66 | |
---|
| 67 | =head1 SEE ALSO |
---|
| 68 | |
---|
| 69 | L<Fcm::Keyword::Entries|Fcm::Keyword::Entries>, |
---|
| 70 | L<Fcm::Keyword::Entry|Fcm::Keyword::Entry>, |
---|
| 71 | L<Fcm::Keyword::Formatter::Entry|Fcm::Keyword::Formatter::Entry> |
---|
| 72 | |
---|
| 73 | =head1 COPYRIGHT |
---|
| 74 | |
---|
| 75 | E<169> Crown copyright Met Office. All rights reserved. |
---|
| 76 | |
---|
| 77 | =cut |
---|