#include <ARGV.h>
Public Member Functions | |
ACE_ARGV_T (const CHAR_TYPE buf[], bool substitute_env_args=true) | |
ACE_ARGV_T (int argc, CHAR_TYPE *argv[], bool substitute_env_args=true, bool quote_args=false) | |
ACE_ARGV_T (CHAR_TYPE *argv[], bool substitute_env_args=true, bool quote_args=false) | |
ACE_ARGV_T (CHAR_TYPE *first_argv[], CHAR_TYPE *second_argv[], bool substitute_env_args=true, bool quote_args=false) | |
ACE_ARGV_T (bool substitute_env_args=true) | |
~ACE_ARGV_T (void) | |
Destructor. | |
void | dump (void) const |
Dump the state of this object. | |
int | add (const CHAR_TYPE *next_arg, bool quote_arg=false) |
int | add (CHAR_TYPE *argv[], bool quote_args=false) |
Accessor methods | |
These methods access the argument vector contained in this object. | |
const CHAR_TYPE * | operator[] (size_t index) |
CHAR_TYPE ** | argv (void) |
int | argc (void) const |
Returns the current number of arguments. | |
const CHAR_TYPE * | buf (void) |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Private Member Functions | |
ACE_ARGV_T (const ACE_ARGV_T< CHAR_TYPE > &) | |
Copy constructor not implemented. | |
ACE_ARGV_T | operator= (const ACE_ARGV_T< CHAR_TYPE > &) |
Assignment operator not implemented. | |
int | create_buf_from_queue (void) |
Creates buf_ from the queue of added args, deletes previous buf_. | |
int | string_to_argv (void) |
Converts buf_ into the CHAR_TYPE *argv[] format. | |
Private Attributes | |
bool | substitute_env_args_ |
Replace args with environment variable values? | |
bool | iterative_ |
int | argc_ |
Number of arguments in the ARGV array. | |
CHAR_TYPE ** | argv_ |
The array of string arguments. | |
CHAR_TYPE * | buf_ |
Buffer containing the <argv> contents. | |
size_t | length_ |
ACE_Unbounded_Queue < ACE_ARGV_Queue_Entry_T < CHAR_TYPE > > | queue_ |
This class can substitute environment variable values for tokens that are environment variable references (e.g., $VAR
). This only works if the token is an environment variable reference and nothing else; it doesn't substitute environment variable references within a token. For example, $HOME/file
will not substitute the value of the HOME environment variable.
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | const CHAR_TYPE | buf[], | |
bool | substitute_env_args = true | |||
) | [inline, explicit] |
Splits the specified string into an argument vector. Arguments in the string are delimited by whitespace. Whitespace-containing arguments must be enclosed in quotes, either single (') or double (").
buf | A nul-terminated CHAR_TYPE array to split into arguments for the vector. | |
substitute_env_args | If non-zero, any token that is an environment variable reference (e.g., $VAR ) will have its environment variable value in the resultant vector in place of the environment variable name. |
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | int | argc, | |
CHAR_TYPE * | argv[], | |||
bool | substitute_env_args = true , |
|||
bool | quote_args = false | |||
) | [inline, explicit] |
Initializes the argument vector from a set of arguments. Any environment variable references are translated (if applicable) during execution of this method. In contrast with ACE_ARGV_T(CHAR_TYPE *[], bool, bool), this ctor does not require argv to be 0-terminated as the number of arguments is provided explicitely.
argc | The number of arguments in the argv array. | |
argv | An array of tokens to initialize the object with. All needed data is copied from argv during this call; the pointers in argv are not needed after this call, and the memory referred to by argv is not referenced by this object. | |
substitute_env_args | If non-zero, any element of argv that is an environment variable reference (e.g., $VAR ) will have its environment variable value in the resultant vector in place of the environment variable name. | |
quote_args | If non-zero each argument argv[i] needs to be enclosed in double quotes ('"'). |
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | CHAR_TYPE * | argv[], | |
bool | substitute_env_args = true , |
|||
bool | quote_args = false | |||
) | [inline, explicit] |
Initializes the argument vector from a set of arguments. Any environment variable references are translated (if applicable) during execution of this method.
argv | An array of tokens to initialize the object with. The array must be terminated with a 0 pointer. All needed data is copied from argv during this call; the pointers in argv are not needed after this call, and the memory referred to by argv is not referenced by this object. | |
substitute_env_args | If non-zero, any element of argv that is an environment variable reference (e.g., $VAR ) will have its environment variable value in the resultant vector in place of the environment variable name. | |
quote_args | If non-zero each argument argv[i] needs to be enclosed in double quotes ('"'). |
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | CHAR_TYPE * | first_argv[], | |
CHAR_TYPE * | second_argv[], | |||
bool | substitute_env_args = true , |
|||
bool | quote_args = false | |||
) | [inline] |
Initializes the argument vector from two combined argument vectors.
first_argv | An array of tokens to initialize the object with. The array must be terminated with a 0 pointer. | |
second_argv | An array of tokens that is concatenated with the the tokens in first_argv. The array must be terminated with a 0 pointer. | |
substitute_env_args | If non-zero, any element of first_argv or second_argv that is an environment variable reference (e.g., $VAR ) will have its environment variable value in the resultant vector in place of the environment variable name. | |
quote_args | If non-zero each arguments first_argv[i] and second_argv[i] needs to be enclosed in double quotes ('"'). |
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | bool | substitute_env_args = true |
) | [inline, explicit] |
Initialize this object so arguments can be added later using one of the add methods. This is referred to as the iterative method of adding arguments to this object.
ACE_ARGV_T< CHAR_TYPE >::~ACE_ARGV_T | ( | void | ) | [inline] |
Destructor.
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | const ACE_ARGV_T< CHAR_TYPE > & | ) | [private] |
Copy constructor not implemented.
ACE_INLINE const CHAR_TYPE * ACE_ARGV_T< CHAR_TYPE >::operator[] | ( | size_t | index | ) | [inline] |
Returns the specified element of the current argument vector.
index | Index to the desired element. |
Pointer | to the indexed string. | |
0 | if index is out of bounds. |
ACE_INLINE CHAR_TYPE ** ACE_ARGV_T< CHAR_TYPE >::argv | ( | void | ) | [inline] |
Returns the current argument vector. The returned pointers are to data maintained internally to this class. Do not change or delete either the pointers or the memory to which they refer.
ACE_INLINE int ACE_ARGV_T< CHAR_TYPE >::argc | ( | void | ) | const [inline] |
Returns the current number of arguments.
ACE_INLINE const CHAR_TYPE * ACE_ARGV_T< CHAR_TYPE >::buf | ( | void | ) | [inline] |
Returns a single string form of the current arguments. The returned pointer refers to memory maintained internally to this class. Do not change or delete it.
void ACE_ARGV_T< CHAR_TYPE >::dump | ( | void | ) | const [inline] |
Dump the state of this object.
int ACE_ARGV_T< CHAR_TYPE >::add | ( | const CHAR_TYPE * | next_arg, | |
bool | quote_arg = false | |||
) | [inline] |
Add another argument. This only works in the iterative mode.
next_arg | Pointer to the next argument to add to the vector. | |
quote_arg | The argument next_arg need to be quoted while adding to the vector. |
0 | on success; -1 on failure. Most likely errno values are:
|
int ACE_ARGV_T< CHAR_TYPE >::add | ( | CHAR_TYPE * | argv[], | |
bool | quote_args = false | |||
) | [inline] |
Add an array of arguments. This only works in the iterative mode.
argv | Pointers to the arguments to add to the vector. argv must be terminated by a 0 pointer. | |
quote_args | If non-zero each argument argv[i] needs to be enclosed in double quotes ('"'). |
0 | on success; -1 on failure. Most likely errno values are:
|
ACE_ARGV_T ACE_ARGV_T< CHAR_TYPE >::operator= | ( | const ACE_ARGV_T< CHAR_TYPE > & | ) | [private] |
Assignment operator not implemented.
int ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue | ( | void | ) | [inline, private] |
Creates buf_ from the queue of added args, deletes previous buf_.
int ACE_ARGV_T< CHAR_TYPE >::string_to_argv | ( | void | ) | [inline, private] |
Converts buf_ into the CHAR_TYPE *argv[] format.
ACE_ARGV_T< CHAR_TYPE >::ACE_ALLOC_HOOK_DECLARE |
bool ACE_ARGV_T< CHAR_TYPE >::substitute_env_args_ [private] |
Replace args with environment variable values?
bool ACE_ARGV_T< CHAR_TYPE >::iterative_ [private] |
int ACE_ARGV_T< CHAR_TYPE >::argc_ [private] |
Number of arguments in the ARGV array.
CHAR_TYPE** ACE_ARGV_T< CHAR_TYPE >::argv_ [private] |
The array of string arguments.
CHAR_TYPE* ACE_ARGV_T< CHAR_TYPE >::buf_ [private] |
Buffer containing the <argv> contents.
size_t ACE_ARGV_T< CHAR_TYPE >::length_ [private] |
Total length of the arguments in the queue, not counting separating spaces
ACE_Unbounded_Queue<ACE_ARGV_Queue_Entry_T<CHAR_TYPE> > ACE_ARGV_T< CHAR_TYPE >::queue_ [private] |
Queue which keeps user supplied arguments. This is only active in the "iterative" mode.