1 # This file was automatically generated by SWIG (http://www.swig.org).
4 # Do not make changes to this file unless you know what you are doing--modify
5 # the SWIG interface file instead.
7 package Amanda::Cmdline;
9 use base qw(DynaLoader);
10 package Amanda::Cmdlinec;
11 bootstrap Amanda::Cmdline;
12 package Amanda::Cmdline;
15 # ---------- BASE METHODS -------------
17 package Amanda::Cmdline;
20 my ($classname,$obj) = @_;
21 return bless $obj, $classname;
31 my ($self,$field) = @_;
32 my $member_func = "swig_${field}_get";
33 $self->$member_func();
37 my ($self,$field,$newval) = @_;
38 my $member_func = "swig_${field}_set";
39 $self->$member_func($newval);
48 # ------- FUNCTION WRAPPERS --------
50 package Amanda::Cmdline;
52 *format_dumpspec_components = *Amanda::Cmdlinec::format_dumpspec_components;
53 *parse_dumpspecs = *Amanda::Cmdlinec::parse_dumpspecs;
54 *header_matches_dumpspecs = *Amanda::Cmdlinec::header_matches_dumpspecs;
56 ############# Class : Amanda::Cmdline::dumpspec_t ##############
58 package Amanda::Cmdline::dumpspec_t;
59 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
60 @ISA = qw( Amanda::Cmdline );
63 *swig_host_get = *Amanda::Cmdlinec::dumpspec_t_host_get;
64 *swig_host_set = *Amanda::Cmdlinec::dumpspec_t_host_set;
65 *swig_disk_get = *Amanda::Cmdlinec::dumpspec_t_disk_get;
66 *swig_disk_set = *Amanda::Cmdlinec::dumpspec_t_disk_set;
67 *swig_datestamp_get = *Amanda::Cmdlinec::dumpspec_t_datestamp_get;
68 *swig_datestamp_set = *Amanda::Cmdlinec::dumpspec_t_datestamp_set;
69 *swig_level_get = *Amanda::Cmdlinec::dumpspec_t_level_get;
70 *swig_level_set = *Amanda::Cmdlinec::dumpspec_t_level_set;
73 my $self = Amanda::Cmdlinec::new_dumpspec_t(@_);
74 bless $self, $pkg if defined($self);
78 return unless $_[0]->isa('HASH');
79 my $self = tied(%{$_[0]});
80 return unless defined $self;
81 delete $ITERATORS{$self};
82 if (exists $OWNER{$self}) {
83 Amanda::Cmdlinec::delete_dumpspec_t($self);
88 *format = *Amanda::Cmdlinec::dumpspec_t_format;
91 my $ptr = tied(%$self);
97 my $ptr = tied(%$self);
102 # ------- VARIABLE STUBS --------
104 package Amanda::Cmdline;
106 *CMDLINE_PARSE_DATESTAMP = *Amanda::Cmdlinec::CMDLINE_PARSE_DATESTAMP;
107 *CMDLINE_PARSE_LEVEL = *Amanda::Cmdlinec::CMDLINE_PARSE_LEVEL;
108 *CMDLINE_EMPTY_TO_WILDCARD = *Amanda::Cmdlinec::CMDLINE_EMPTY_TO_WILDCARD;
116 Amanda::Cmdline - utilities for handling command lines
122 my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level);
123 print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
125 my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
126 $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
128 =head1 Amanda::Cmdline::dumpspec_t Objects
130 =head2 Instance Variables
150 Format the dumpspec as a string.
158 =item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
160 This function returns a string representing the formatted form of the
161 given dumpspec. This formatting is the same as performed by
162 C<format_dumpspec_components>, but does not need a C<dumpspec_t>.
164 =item C<parse_dumpspecs([@cmdline], $flags)>
166 This function parses C<@cmdline> into a list of C<dumpspec_t> objects,
167 according to C<$flags>, which is a logical combination of zero or more
168 of C<$CMDLINE_PARSE_DATESTAMP> to recognize datestamps and
169 C<$CMDLINE_PARSE_LEVEL> to recognize levels.
171 =item C<header_matches_dumpspecs($hdr, [@dumpspecs])>
173 This function compares a header to a list of dumpspecs, returning true if the
174 header matches at least one dumpspec. If C<@dumpspecs> is empty, the function
181 L<Amanda::Config> handles C<-o> options itself, through
188 push @EXPORT_OK, qw(cmdline_parse_dumpspecs_flags_to_strings);
189 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw(cmdline_parse_dumpspecs_flags_to_strings);
191 my %_cmdline_parse_dumpspecs_flags_VALUES;
192 #Convert a flag value to a list of names for flags that are set.
193 sub cmdline_parse_dumpspecs_flags_to_strings {
197 for my $k (keys %_cmdline_parse_dumpspecs_flags_VALUES) {
198 my $v = $_cmdline_parse_dumpspecs_flags_VALUES{$k};
200 #is this a matching flag?
201 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
206 #by default, just return the number as a 1-element list
214 push @EXPORT_OK, qw($CMDLINE_PARSE_DATESTAMP);
215 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_DATESTAMP);
217 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_DATESTAMP"} = $CMDLINE_PARSE_DATESTAMP;
219 push @EXPORT_OK, qw($CMDLINE_PARSE_LEVEL);
220 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_LEVEL);
222 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_LEVEL"} = $CMDLINE_PARSE_LEVEL;
224 push @EXPORT_OK, qw($CMDLINE_EMPTY_TO_WILDCARD);
225 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_EMPTY_TO_WILDCARD);
227 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_EMPTY_TO_WILDCARD"} = $CMDLINE_EMPTY_TO_WILDCARD;
229 push @EXPORT_OK, qw(header_matches_dumpspecs);