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;
111 *CMDLINE_EXACT_MATCH = *Amanda::Cmdlinec::CMDLINE_EXACT_MATCH;
119 Amanda::Cmdline - utilities for handling command lines
125 my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level, $write_timestamp);
126 print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
128 my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
129 $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
131 =head1 Amanda::Cmdline::dumpspec_t Objects
133 Note that this class was called C<Amanda::Cmdline::dumpspec_t> in older versions;
134 that name will still work, but is deprecated.
138 Each key contains a match expression, in the form of a string, or undef. Note
139 that the values of these keys are read-only.
143 =item C<< $ds->{'host'} >>
147 =item C<< $ds->{'disk'} >>
151 =item C<< $ds->{'datestamp'} >>
155 =item C<< $ds->{'level'} >>
159 =item C<< $ds->{'write_timestamp'} >>
161 Timestamp when the dump is written to storage media.
169 =item C<< $ds->format() >>
171 Format the dumpspec as a string.
175 =head1 Package Functions
179 =item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
181 This function returns a string representing the formatted form of the
182 given dumpspec. This formatting is the same as performed by
183 C<< $ds->format() >>, but does not need a C<Dumpspec>.
185 =item C<parse_dumpspecs([@cmdline], $flags)>
187 This function parses C<@cmdline> into a list of C<Dumpspec> objects,
188 according to C<$flags>, which is a logical combination of zero or more
191 $CMDLINE_PARSE_DATESTAMP - recognize datestamps
192 $CMDLINE_PARSE_LEVEL - recognize levels
193 $CMDLINE_EMPTY_TO_WILDCARD - if @cmdline is empty, make a wildcard dumpspec
195 These constants are available in export tag C<:constants>. The command-line
198 [host [disk [datestamp [level [host [..]]]]]]
200 Note that there is no facility for specifying C<write_timestamp> on the command
203 =item C<header_matches_dumpspecs($hdr, [@dumpspecs])>
205 This function compares a header to a list of dumpspecs, returning true if the
206 header matches at least one dumpspec. If C<@dumpspecs> is empty, the function
213 L<Amanda::Config> handles C<-o> options itself, through
220 push @EXPORT_OK, qw(cmdline_parse_dumpspecs_flags_to_strings);
221 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw(cmdline_parse_dumpspecs_flags_to_strings);
223 my %_cmdline_parse_dumpspecs_flags_VALUES;
224 #Convert a flag value to a list of names for flags that are set.
225 sub cmdline_parse_dumpspecs_flags_to_strings {
229 for my $k (keys %_cmdline_parse_dumpspecs_flags_VALUES) {
230 my $v = $_cmdline_parse_dumpspecs_flags_VALUES{$k};
232 #is this a matching flag?
233 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
238 #by default, just return the number as a 1-element list
246 push @EXPORT_OK, qw($CMDLINE_PARSE_DATESTAMP);
247 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_DATESTAMP);
249 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_DATESTAMP"} = $CMDLINE_PARSE_DATESTAMP;
251 push @EXPORT_OK, qw($CMDLINE_PARSE_LEVEL);
252 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_LEVEL);
254 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_LEVEL"} = $CMDLINE_PARSE_LEVEL;
256 push @EXPORT_OK, qw($CMDLINE_EMPTY_TO_WILDCARD);
257 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_EMPTY_TO_WILDCARD);
259 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_EMPTY_TO_WILDCARD"} = $CMDLINE_EMPTY_TO_WILDCARD;
261 push @EXPORT_OK, qw($CMDLINE_EXACT_MATCH);
262 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_EXACT_MATCH);
264 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_EXACT_MATCH"} = $CMDLINE_EXACT_MATCH;
266 #copy symbols in cmdline_parse_dumpspecs_flags to constants
267 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}};
269 push @EXPORT_OK, qw(header_matches_dumpspecs parse_dumpspecs format_dumpspec_components);