buf
into an argv
style vector of
strings or an argv
style vector of string buf
, performing
environment variable substitutions if necessary.
#include <ace/ARGV.h>
class ACE_ARGV {
public:
ACE_ARGV (const ASYS_TCHAR buf[], int substitute_env_args = 1);
ACE_ARGV (ASYS_TCHAR *argv[], int substitute_env_args = 1);
ACE_ARGV ( ASYS_TCHAR *first_argv[], ASYS_TCHAR *second_argv[], int substitute_env_args =1 );
ACE_ARGV (int substitute_env_args = 1);
~ACE_ARGV (void);
const ASYS_TCHAR *operator[] (size_t index);
ASYS_TCHAR **argv (void);
size_t argc (void) const;
const ASYS_TCHAR *buf (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
int add (const ASYS_TCHAR *next_arg);
int add (ASYS_TCHAR *argv[]);
int state (void) const;
enum States{ TO_STRING = 1, TO_PTR_ARRAY = 2, ITERATIVE = 3 };
private:
int create_buf_from_queue (void);
int string_to_argv (void);
int argv_to_string (ASYS_TCHAR **argv, ASYS_TCHAR *&buf);
int substitute_env_args_;
int state_;
size_t argc_;
ASYS_TCHAR **argv_;
ASYS_TCHAR *buf_;
size_t length_;
ACE_Unbounded_Queue<ASYS_TCHAR *> queue_;
};
ACE_ARGV (const ASYS_TCHAR buf[], int substitute_env_args = 1);
buf
into an argv
-style vector of strings. If
substitute_env_args
is enabled then we'll substitute the
environment variables for each $ENV encountered in the string.
The subscript and argv
operations are not allowed on an
ACE_ARGV created this way.
ACE_ARGV (ASYS_TCHAR *argv[], int substitute_env_args = 1);
argv
into a linear string. If substitute_env_args
is enabled then we'll substitute the environment variables for
each $ENV encountered in the string. The buf
operation is not
allowed on an ACE_ARGV created this way.
ACE_ARGV (
ASYS_TCHAR *first_argv[],
ASYS_TCHAR *second_argv[],
int substitute_env_args =1
);
ACE_ARGV (int substitute_env_args = 1);
add
method. When this constructor is used,
the ITERATIVE
state is enabled. The argv
and buf
methods
are allowed, and the result is recreated when called multiple
times. The subscript operator is not allowed.
~ACE_ARGV (void);
const ASYS_TCHAR *operator[] (size_t index);
index
th string in the ARGV array.
ASYS_TCHAR **argv (void);
argv
array. Caller should not delete this memory
since the ARGV
destructor will delete it. If the caller
modifies the array in the iterative mode, the changes are not
saved to the queue.
size_t argc (void) const;
argc
.
const ASYS_TCHAR *buf (void);
buf
. Caller should not delete this memory since
the ARGV
destructor will delete it.
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
int add (const ASYS_TCHAR *next_arg);
ITERATIVE
state.
Returns -1 on failure and 0 on success.
int add (ASYS_TCHAR *argv[]);
argv
array. The argv
parameter must be NULL
terminated. This only works in the ITERATIVE
state. Returns
-1 on failure and 0 on success.
int state (void) const;
These are the states possible via the different constructors.