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;
71 *swig_write_timestamp_get = *Amanda::Cmdlinec::dumpspec_t_write_timestamp_get;
72 *swig_write_timestamp_set = *Amanda::Cmdlinec::dumpspec_t_write_timestamp_set;
75 my $self = Amanda::Cmdlinec::new_dumpspec_t(@_);
76 bless $self, $pkg if defined($self);
80 return unless $_[0]->isa('HASH');
81 my $self = tied(%{$_[0]});
82 return unless defined $self;
83 delete $ITERATORS{$self};
84 if (exists $OWNER{$self}) {
85 Amanda::Cmdlinec::delete_dumpspec_t($self);
90 *format = *Amanda::Cmdlinec::dumpspec_t_format;
93 my $ptr = tied(%$self);
99 my $ptr = tied(%$self);
104 # ------- VARIABLE STUBS --------
106 package Amanda::Cmdline;
108 *CMDLINE_PARSE_DATESTAMP = *Amanda::Cmdlinec::CMDLINE_PARSE_DATESTAMP;
109 *CMDLINE_PARSE_LEVEL = *Amanda::Cmdlinec::CMDLINE_PARSE_LEVEL;
110 *CMDLINE_EMPTY_TO_WILDCARD = *Amanda::Cmdlinec::CMDLINE_EMPTY_TO_WILDCARD;
118 Amanda::Cmdline - utilities for handling command lines
124 my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level, $write_timestamp);
125 print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
127 my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
128 $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
130 =head1 Amanda::Cmdline::dumpspec_t Objects
132 Note that this class was called C<Amanda::Cmdline::dumpspec_t> in older versions;
133 that name will still work, but is deprecated.
137 Each key contains a match expression, in the form of a string, or undef. Note
138 that the values of these keys are read-only.
142 =item C<< $ds->{'host'} >>
146 =item C<< $ds->{'disk'} >>
150 =item C<< $ds->{'datestamp'} >>
154 =item C<< $ds->{'level'} >>
158 =item C<< $ds->{'write_timestamp'} >>
160 Timestamp when the dump is written to storage media.
168 =item C<< $ds->format() >>
170 Format the dumpspec as a string.
174 =head1 Package Functions
178 =item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
180 This function returns a string representing the formatted form of the
181 given dumpspec. This formatting is the same as performed by
182 C<< $ds->format() >>, but does not need a C<Dumpspec>.
184 =item C<parse_dumpspecs([@cmdline], $flags)>
186 This function parses C<@cmdline> into a list of C<Dumpspec> objects,
187 according to C<$flags>, which is a logical combination of zero or more
190 $CMDLINE_PARSE_DATESTAMP - recognize datestamps
191 $CMDLINE_PARSE_LEVEL - recognize levels
192 $CMDLINE_EMPTY_TO_WILDCARD - if @cmdline is empty, make a wildcard dumpspec
194 These constants are available in export tag C<:constants>. The command-line
197 [host [disk [datestamp [level [host [..]]]]]]
199 Note that there is no facility for specifying C<write_timestamp> on the command
202 =item C<header_matches_dumpspecs($hdr, [@dumpspecs])>
204 This function compares a header to a list of dumpspecs, returning true if the
205 header matches at least one dumpspec. If C<@dumpspecs> is empty, the function
212 L<Amanda::Config> handles C<-o> options itself, through
219 push @EXPORT_OK, qw(cmdline_parse_dumpspecs_flags_to_strings);
220 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw(cmdline_parse_dumpspecs_flags_to_strings);
222 my %_cmdline_parse_dumpspecs_flags_VALUES;
223 #Convert a flag value to a list of names for flags that are set.
224 sub cmdline_parse_dumpspecs_flags_to_strings {
228 for my $k (keys %_cmdline_parse_dumpspecs_flags_VALUES) {
229 my $v = $_cmdline_parse_dumpspecs_flags_VALUES{$k};
231 #is this a matching flag?
232 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
237 #by default, just return the number as a 1-element list
245 push @EXPORT_OK, qw($CMDLINE_PARSE_DATESTAMP);
246 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_DATESTAMP);
248 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_DATESTAMP"} = $CMDLINE_PARSE_DATESTAMP;
250 push @EXPORT_OK, qw($CMDLINE_PARSE_LEVEL);
251 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_LEVEL);
253 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_LEVEL"} = $CMDLINE_PARSE_LEVEL;
255 push @EXPORT_OK, qw($CMDLINE_EMPTY_TO_WILDCARD);
256 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_EMPTY_TO_WILDCARD);
258 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_EMPTY_TO_WILDCARD"} = $CMDLINE_EMPTY_TO_WILDCARD;
260 #copy symbols in cmdline_parse_dumpspecs_flags to constants
261 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}};
263 push @EXPORT_OK, qw(header_matches_dumpspecs parse_dumpspecs format_dumpspec_components);