#include <ace/Arg_Shifter.h>
class ACE_Arg_Shifter {
public:
ACE_Arg_Shifter (int &argc, char **argv, char **temp = 0);
~ACE_Arg_Shifter (void);
char *get_current (void) const;
int consume_arg (int number = 1);
int ignore_arg (int number = 1);
int is_anything_left (void) const;
int is_option_next (void) const;
int is_parameter_next (void) const;
int num_ignored_args (void) const;
private:
int &argc_;
int total_size_;
char **temp_;
char **argv_;
int current_index_;
int back_;
int front_;
};
ACE_Arg_Shifter
copies the pointers of the argv vector
into a temporary array. As the ACE_Arg_Shifter
iterates over
the temp, is places known arguments in the rear of the argv
and unknown ones in the beginning. So, after having visited
all the arguments in the temp vector, ACE_Arg_Shifter
has
placed all the unknown arguments in their original order at
the front of argv.
ACE_Arg_Shifter (int &argc, char **argv, char **temp = 0);
ACE_Arg_Shifter
to the vector over which to
iterate, also providing the temporary array if the client doesn't
want the arg_shifter to dynamically allocate its own. If internal
dynamic allocation fails, the ACE_Arg_Shifter
will set all the
indices to the end of the vector, forbidding iteration. Following
iteration over argv, the argc value will contain the number of
unconsumed arguments.
~ACE_Arg_Shifter (void);
char *get_current (void) const;
int consume_arg (int number = 1);
number
argument(s) by sticking them/it on the end of
the vector.
int ignore_arg (int number = 1);
number
arguments in the same relative order ahead of the
known arguemnts in the vector.
int is_anything_left (void) const;
int is_option_next (void) const;
int is_parameter_next (void) const;
int num_ignored_args (void) const;