1 # This file was automatically generated by SWIG (http://www.swig.org).
4 # Don't modify this file, modify the SWIG interface instead.
6 package Amanda::Cmdline;
9 @ISA = qw(Exporter 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;
55 ############# Class : Amanda::Cmdline::dumpspec_t ##############
57 package Amanda::Cmdline::dumpspec_t;
58 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
59 @ISA = qw( Amanda::Cmdline );
62 *swig_host_get = *Amanda::Cmdlinec::dumpspec_t_host_get;
63 *swig_host_set = *Amanda::Cmdlinec::dumpspec_t_host_set;
64 *swig_disk_get = *Amanda::Cmdlinec::dumpspec_t_disk_get;
65 *swig_disk_set = *Amanda::Cmdlinec::dumpspec_t_disk_set;
66 *swig_datestamp_get = *Amanda::Cmdlinec::dumpspec_t_datestamp_get;
67 *swig_datestamp_set = *Amanda::Cmdlinec::dumpspec_t_datestamp_set;
68 *swig_level_get = *Amanda::Cmdlinec::dumpspec_t_level_get;
69 *swig_level_set = *Amanda::Cmdlinec::dumpspec_t_level_set;
72 my $self = Amanda::Cmdlinec::new_dumpspec_t(@_);
73 bless $self, $pkg if defined($self);
77 return unless $_[0]->isa('HASH');
78 my $self = tied(%{$_[0]});
79 return unless defined $self;
80 delete $ITERATORS{$self};
81 if (exists $OWNER{$self}) {
82 Amanda::Cmdlinec::delete_dumpspec_t($self);
87 *format = *Amanda::Cmdlinec::dumpspec_t_format;
90 my $ptr = tied(%$self);
96 my $ptr = tied(%$self);
101 # ------- VARIABLE STUBS --------
103 package Amanda::Cmdline;
105 *CMDLINE_PARSE_DATESTAMP = *Amanda::Cmdlinec::CMDLINE_PARSE_DATESTAMP;
106 *CMDLINE_PARSE_LEVEL = *Amanda::Cmdlinec::CMDLINE_PARSE_LEVEL;
107 *CMDLINE_EMPTY_TO_WILDCARD = *Amanda::Cmdlinec::CMDLINE_EMPTY_TO_WILDCARD;
114 Amanda::Cmdline - utilities for handling command lines
120 my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level);
121 print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
123 my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
124 $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
130 =head1 Amanda::Cmdline::dumpspec_t Objects
132 =head2 Instance Variables
152 Format the dumpspec as a string.
160 =item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
162 This function returns a string representing the formatted form of the given dumpspec. This formatting
163 is the same as performed by C<format_dumpspec_components>, but does not need a C<dumpspec_t>.
165 =item C<parse_dumpspecs(@cmdline, $flags)>
167 This function parses C<@cmdline> into a list of C<dumpspec_t> objects,
168 according to C<$flags>, which is a logical combination of zero or
169 more of C<$CMDLINE_PARSE_DATESTAMP> to recognize datestamps and
170 C<$CMDLINE_PARSE_LEVEL> to recognize levels.
176 L<Amanda::Config> handles C<-o> options itself, through C<config_overwrites>.
180 push @EXPORT_OK, qw(cmdline_parse_dumpspecs_flags_to_strings);
181 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw(cmdline_parse_dumpspecs_flags_to_strings);
183 my %_cmdline_parse_dumpspecs_flags_VALUES;
184 #Convert a flag value to a list of names for flags that are set.
185 sub cmdline_parse_dumpspecs_flags_to_strings {
189 for my $k (keys %_cmdline_parse_dumpspecs_flags_VALUES) {
190 my $v = $_cmdline_parse_dumpspecs_flags_VALUES{$k};
192 #is this a matching flag?
193 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
198 #by default, just return the number as a 1-element list
206 push @EXPORT_OK, qw($CMDLINE_PARSE_DATESTAMP);
207 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_DATESTAMP);
209 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_DATESTAMP"} = $CMDLINE_PARSE_DATESTAMP;
211 push @EXPORT_OK, qw($CMDLINE_PARSE_LEVEL);
212 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_PARSE_LEVEL);
214 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_PARSE_LEVEL"} = $CMDLINE_PARSE_LEVEL;
216 push @EXPORT_OK, qw($CMDLINE_EMPTY_TO_WILDCARD);
217 push @{$EXPORT_TAGS{"cmdline_parse_dumpspecs_flags"}}, qw($CMDLINE_EMPTY_TO_WILDCARD);
219 $_cmdline_parse_dumpspecs_flags_VALUES{"CMDLINE_EMPTY_TO_WILDCARD"} = $CMDLINE_EMPTY_TO_WILDCARD;